From 3357dc2f695c58e7f2b04a714544c643f44f04e2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 30 Apr 2024 07:46:44 +0000 Subject: [PATCH] deploy: KusionStack/kusionstack.io@5906323a37540df25cd1b97790f3e513b3a2aeeb --- 404.html | 8 ++++---- assets/js/01439c8e.73089375.js | 1 - assets/js/01439c8e.823a3d9e.js | 1 + assets/js/030b8d03.1cd548fa.js | 1 + assets/js/030b8d03.e8977684.js | 1 - assets/js/03253e12.1e0acf26.js | 1 + assets/js/03253e12.e61e6743.js | 1 - .../{0400c277.fb900e8e.js => 0400c277.27c21fee.js} | 2 +- assets/js/043680c6.0aa5ff9f.js | 1 - assets/js/043680c6.f3a12810.js | 1 + assets/js/045fa4ba.1fc1adcc.js | 1 - assets/js/045fa4ba.6fc5d885.js | 1 + assets/js/05e2121e.009d4753.js | 1 + assets/js/05e2121e.4e566dd6.js | 1 - assets/js/064aa373.70aaf374.js | 1 - assets/js/064aa373.b5b64da4.js | 1 + assets/js/082d3c28.2643487a.js | 1 + assets/js/082d3c28.c33a4fee.js | 1 - assets/js/091a426a.21792e07.js | 1 + assets/js/091a426a.2c44207b.js | 1 - assets/js/0a185701.ad3fea43.js | 1 + assets/js/0a185701.dda5c0ee.js | 1 - assets/js/0a57f7df.51538d2f.js | 1 + assets/js/0a57f7df.b7aed711.js | 1 - .../{0a8d339f.8241bef2.js => 0a8d339f.a6d34ab0.js} | 2 +- .../{0a99afe0.573bd0fb.js => 0a99afe0.eeb4b30f.js} | 2 +- assets/js/0b745da3.12c94f6f.js | 1 - assets/js/0b745da3.4ad49bdc.js | 1 + assets/js/0d383345.40a38ff6.js | 1 + assets/js/0d383345.9d67235e.js | 1 - assets/js/0d662946.2a16f681.js | 1 - assets/js/0d662946.7f7d468a.js | 1 + assets/js/0ed14211.1e09a987.js | 1 - assets/js/0ed14211.1f338424.js | 1 + assets/js/0feba5eb.2e875425.js | 1 + assets/js/0feba5eb.34198b40.js | 1 - assets/js/10669232.7d91494e.js | 1 - assets/js/10669232.c7f81478.js | 1 + assets/js/12216004.24717c2b.js | 1 + assets/js/12216004.b0bfea70.js | 1 - .../{13e25c40.e20487bc.js => 13e25c40.f5ef4c7e.js} | 2 +- assets/js/163cf949.5abc9c73.js | 1 + assets/js/163cf949.6371565d.js | 1 - assets/js/16a19535.19833e67.js | 1 - assets/js/16a19535.2e160473.js | 1 + assets/js/16bff117.185946e6.js | 1 + assets/js/16bff117.9d605764.js | 1 - .../{17658ce1.7bf5ac4b.js => 17658ce1.b4908420.js} | 2 +- assets/js/17a1e8ae.45c60e6d.js | 1 - assets/js/17a1e8ae.ccf48d6a.js | 1 + .../{180ff8b9.814b6860.js => 180ff8b9.7ee38d2d.js} | 2 +- assets/js/18d9b529.258fd535.js | 1 - assets/js/18d9b529.6440b594.js | 1 + assets/js/18fa340a.7e78f7eb.js | 1 - assets/js/18fa340a.da7036b2.js | 1 + assets/js/194f885d.950b5f7d.js | 1 - assets/js/194f885d.b56556c2.js | 1 + assets/js/19556a9e.65609499.js | 1 - assets/js/19556a9e.a7c83650.js | 1 + assets/js/1961a063.a2b468e0.js | 1 + assets/js/1961a063.eef31fca.js | 1 - assets/js/1aa0cc2e.4ffe9435.js | 1 - assets/js/1aa0cc2e.f9b61ca1.js | 1 + assets/js/1b95d76e.03d4d1b3.js | 1 - assets/js/1b95d76e.5e3ecc75.js | 1 + assets/js/1b9ff86e.1e420a8e.js | 1 + assets/js/1b9ff86e.f8a2e2b1.js | 1 - assets/js/1bd21934.3f9288e7.js | 1 + assets/js/1bd21934.d404b432.js | 1 - assets/js/1ec179f1.70173c27.js | 1 + assets/js/1ec179f1.ee7eaa9a.js | 1 - assets/js/1efb9d39.91c9b74d.js | 1 + assets/js/1efb9d39.e674c412.js | 1 - .../{1f997fd4.89e6fc1e.js => 1f997fd4.55636f89.js} | 2 +- assets/js/1fe4756a.40e4c2a7.js | 1 + assets/js/1fe4756a.ca0c0f84.js | 1 - assets/js/20db72b2.3748d1e5.js | 1 - assets/js/20db72b2.64bf6dd5.js | 1 + .../{2115f1af.266e19d6.js => 2115f1af.4814f939.js} | 2 +- assets/js/21746641.a22d74e2.js | 1 + assets/js/21746641.ddb36f72.js | 1 - assets/js/21778a34.af0d4491.js | 1 + assets/js/21778a34.e8ceb514.js | 1 - assets/js/2326e64e.695057c6.js | 1 - assets/js/2326e64e.77b416b7.js | 1 + assets/js/24657d42.b0fcf53c.js | 1 - assets/js/24657d42.d0dbc8c0.js | 1 + .../{252357e3.2f60bfc3.js => 252357e3.fcce83b6.js} | 2 +- assets/js/27e25305.4faae2d3.js | 1 + assets/js/27e25305.8b7d4e57.js | 1 - assets/js/28530a7a.1a12b246.js | 1 - assets/js/28530a7a.96fe6330.js | 1 + .../{2871ff48.b82416e1.js => 2871ff48.3f6c40f3.js} | 2 +- assets/js/2a719713.4ab3dc05.js | 1 - assets/js/2a719713.ff0653df.js | 1 + assets/js/2b0acc78.a87574cc.js | 1 + assets/js/2b0acc78.c585ed54.js | 1 - assets/js/2be338c6.0a4a7306.js | 1 + assets/js/2be338c6.ab8a4e1d.js | 1 - assets/js/2bf7c981.5f304794.js | 1 - assets/js/2bf7c981.b51e5670.js | 1 + assets/js/2e408e18.058934e9.js | 1 - assets/js/2e408e18.7df979fa.js | 1 + .../{2e7a9059.9e60dfcd.js => 2e7a9059.17e42187.js} | 2 +- .../{2ed6f3e5.1963be6d.js => 2ed6f3e5.7ce7fa5d.js} | 2 +- assets/js/2fec9cb7.379ca2a4.js | 1 - assets/js/2fec9cb7.4bc97e56.js | 1 + .../{30ab2121.afe82661.js => 30ab2121.5e0396c2.js} | 2 +- assets/js/312696f8.1f62176d.js | 1 - assets/js/312696f8.a017a544.js | 1 + assets/js/32773aa2.1c6bd5c3.js | 1 + assets/js/32773aa2.8ee95384.js | 1 - assets/js/32956a74.14d57419.js | 1 + assets/js/32956a74.502a8e15.js | 1 - assets/js/33b38546.8edd6905.js | 1 - assets/js/33b38546.e191937e.js | 1 + assets/js/35b54083.20a1e69b.js | 1 + assets/js/35b54083.d5979de7.js | 1 - assets/js/3777d550.13a3ca30.js | 1 - assets/js/3777d550.d2c0d61e.js | 1 + .../{385397a2.8bb89edc.js => 385397a2.a6296923.js} | 2 +- .../{386fece6.0b6a6574.js => 386fece6.092f735d.js} | 2 +- assets/js/38900147.30d2af4f.js | 1 + assets/js/38900147.9b2f5f1c.js | 1 - assets/js/389ba035.4e81bd6b.js | 1 + assets/js/389ba035.951fd21a.js | 1 - assets/js/3ab8bb90.a84f7ca5.js | 1 - assets/js/3ab8bb90.b62d3cca.js | 1 + assets/js/3c3bc024.7d0384fb.js | 1 - assets/js/3c3bc024.84151040.js | 1 + assets/js/3de1edc5.1527b90a.js | 1 + assets/js/3de1edc5.271177f3.js | 1 - assets/js/3f78da0c.546f6f37.js | 1 + assets/js/3f78da0c.f5d61cbf.js | 1 - assets/js/3ff7cb20.ce0dcfda.js | 1 + assets/js/3ff7cb20.d303ba5e.js | 1 - assets/js/40870e5b.d9050fb9.js | 1 - assets/js/40870e5b.fd31b514.js | 1 + assets/js/426f7ee9.32946274.js | 1 - assets/js/426f7ee9.9dee291a.js | 1 + assets/js/42dede29.3498f3da.js | 1 + assets/js/42dede29.a76fdbec.js | 1 - assets/js/434d80d9.9b3696cc.js | 1 + assets/js/434d80d9.daa91dd9.js | 1 - assets/js/44a7a3de.11cacf55.js | 1 + assets/js/44a7a3de.275109cb.js | 1 - assets/js/44ecec25.8162efd8.js | 1 - assets/js/44ecec25.e74a971f.js | 1 + assets/js/4559f654.c457d849.js | 1 - assets/js/4559f654.f8b6f069.js | 1 + assets/js/462b352b.e82a1cb3.js | 1 - assets/js/462b352b.f462ffde.js | 1 + assets/js/47943cb5.c0e6220e.js | 1 + assets/js/47943cb5.c3bc9807.js | 1 - .../{486b02f9.e4a58489.js => 486b02f9.bb440204.js} | 2 +- assets/js/48c1907d.3c597648.js | 1 - assets/js/48c1907d.42daa2af.js | 1 + .../{4969cfcb.1845e166.js => 4969cfcb.dc5c37da.js} | 2 +- .../{4ab041ea.5744d7e7.js => 4ab041ea.eec883a9.js} | 2 +- .../{4b36b697.24dd0190.js => 4b36b697.34256134.js} | 2 +- .../{4bcd6c5f.e4f525d7.js => 4bcd6c5f.f3907997.js} | 2 +- assets/js/4c24e21f.27837737.js | 1 + assets/js/4c24e21f.2b7e3efb.js | 1 - assets/js/4c493feb.654a91d4.js | 1 + assets/js/4c493feb.f803f261.js | 1 - .../{4e2c8581.75557d41.js => 4e2c8581.5cff4508.js} | 2 +- assets/js/4e363eb9.b26c531f.js | 1 - assets/js/4e363eb9.f325c951.js | 1 + assets/js/4e8f51cf.035f5435.js | 1 + assets/js/4e8f51cf.65a4d96e.js | 1 - assets/js/4f047c6d.ce4299f9.js | 1 + assets/js/4f047c6d.ea484907.js | 1 - .../{500b21de.1c392b82.js => 500b21de.f39b00f1.js} | 2 +- assets/js/5080e45a.19e842cf.js | 1 + assets/js/5080e45a.86958deb.js | 1 - assets/js/50dd0c7d.05190e23.js | 1 - assets/js/50dd0c7d.fde4efc6.js | 1 + assets/js/50dd26bc.12228cc7.js | 1 - assets/js/50dd26bc.3e76f5ad.js | 1 + assets/js/5112681f.30df3157.js | 1 + assets/js/5112681f.981f3443.js | 1 - assets/js/5207b198.258d7282.js | 1 + assets/js/5207b198.e4f0175c.js | 1 - assets/js/530384b4.14cc70cb.js | 1 - assets/js/530384b4.509f1f7b.js | 1 + .../{5353a7a1.807a83d8.js => 5353a7a1.acf7247a.js} | 2 +- .../{563e94c0.b0a2f6fc.js => 563e94c0.b3f13273.js} | 2 +- assets/js/5849eb93.348d5665.js | 1 - assets/js/5849eb93.4cbf0ec0.js | 1 + assets/js/588e0fb2.5121320c.js | 1 + assets/js/588e0fb2.e73f62cf.js | 1 - assets/js/59cd1056.a387685a.js | 1 - assets/js/59cd1056.b873aae5.js | 1 + assets/js/59edad29.7daf6025.js | 1 + assets/js/59edad29.b738aae0.js | 1 - assets/js/5a0745f3.8b86feb2.js | 1 - assets/js/5a0745f3.bb5a50b1.js | 1 + .../{5a9b41ac.fa2f5aa4.js => 5a9b41ac.09bbdc9a.js} | 2 +- assets/js/5b1b6e2c.99ece6ed.js | 1 + assets/js/5b1b6e2c.9dc9d453.js | 1 - assets/js/5b317457.ac8a23b2.js | 1 - assets/js/5b317457.acf5a882.js | 1 + assets/js/5bd88873.4375957b.js | 1 + assets/js/5bd88873.ac783374.js | 1 - assets/js/5cbd74ee.15b2e02b.js | 1 + assets/js/5cbd74ee.fba2c4b5.js | 1 - assets/js/5d01e53a.0665130a.js | 1 - assets/js/5d01e53a.e38e21f2.js | 1 + assets/js/5d07f957.5de78b3d.js | 1 - assets/js/5d07f957.9a2b83a9.js | 1 + assets/js/5d5d02b0.46d9fecf.js | 1 + assets/js/5d5d02b0.8dbc39cf.js | 1 - assets/js/5d71f5cd.1d61dcf9.js | 1 + assets/js/5d71f5cd.fffe957a.js | 1 - .../{5de204ea.89c5ae44.js => 5de204ea.2898ab31.js} | 2 +- assets/js/5f7776bb.c301a574.js | 1 - assets/js/5f7776bb.f8a6a15e.js | 1 + assets/js/5f9bf2e5.86e1ead6.js | 1 - assets/js/5f9bf2e5.9618bbcb.js | 1 + assets/js/60cfcd23.2f992f85.js | 1 - assets/js/60cfcd23.7c2398c8.js | 1 + assets/js/6145b3f7.d30adfd8.js | 1 + assets/js/6145b3f7.ea8dc753.js | 1 - assets/js/61f95e53.5954a63b.js | 1 - assets/js/61f95e53.915b50b7.js | 1 + assets/js/62fad4c6.5366a0a7.js | 1 - assets/js/62fad4c6.c826fbdd.js | 1 + assets/js/64d48972.379e0dc7.js | 1 + assets/js/64d48972.ad91f1ad.js | 1 - .../{6609e39c.96b388c1.js => 6609e39c.80d94871.js} | 2 +- assets/js/66880af1.4d9c1453.js | 1 + assets/js/66880af1.7abdeeba.js | 1 - assets/js/66add7b5.79b514ea.js | 1 - assets/js/66add7b5.8c7bc2be.js | 1 + assets/js/68966825.36ce7642.js | 1 + assets/js/68966825.921ddbb7.js | 1 - assets/js/6a5caa1d.3ca38124.js | 1 + assets/js/6a5caa1d.d20023dc.js | 1 - assets/js/6b2b9057.76e77f82.js | 1 + assets/js/6b2b9057.81d9e7c2.js | 1 - assets/js/6b830420.6adaf4a0.js | 1 + assets/js/6b830420.dee41f7c.js | 1 - .../{6c13589d.f196275e.js => 6c13589d.b05a3592.js} | 2 +- assets/js/6dc132fb.6044aa53.js | 1 + assets/js/6dc132fb.85de332e.js | 1 - assets/js/6fb6dfc9.70fe88bd.js | 1 - assets/js/6fb6dfc9.b1266252.js | 1 + assets/js/70fd01e9.2e4d3f4c.js | 1 - assets/js/70fd01e9.5c5bd58c.js | 1 + .../{725d07b1.5197ba8f.js => 725d07b1.f484fcea.js} | 2 +- assets/js/72b4a38a.9c82468f.js | 1 - assets/js/72b4a38a.f5e5db44.js | 1 + assets/js/73743333.881b46c2.js | 1 - assets/js/73743333.a6cb08b1.js | 1 + assets/js/74aaa9a4.0c340cc6.js | 1 + assets/js/74aaa9a4.48e191b2.js | 1 - .../{74fcf2e7.404d89f0.js => 74fcf2e7.10d4c088.js} | 2 +- assets/js/75071e09.4cbcf657.js | 1 + assets/js/75071e09.b3920acf.js | 1 - assets/js/75b6673c.69b623ea.js | 1 - assets/js/75b6673c.af8ec448.js | 1 + .../{75ecccc2.9515e54d.js => 75ecccc2.f8d9a328.js} | 2 +- assets/js/76129d61.0fbc5b39.js | 1 - assets/js/76129d61.55da8d5b.js | 1 + assets/js/772d0280.19b7c1dd.js | 1 + assets/js/772d0280.64b9a2f7.js | 1 - assets/js/77c6b439.64e42f0f.js | 1 - assets/js/77c6b439.b917d45b.js | 1 + assets/js/77cf6619.682c6b07.js | 1 - assets/js/77cf6619.d9ed76ca.js | 1 + assets/js/79507ce0.00c9bdc8.js | 1 - assets/js/79507ce0.1fbd4fe6.js | 1 + .../{7a493ae1.74a76dca.js => 7a493ae1.b805c274.js} | 2 +- .../{7b7347a8.6b8a043b.js => 7b7347a8.e9109b80.js} | 2 +- assets/js/7c47ad75.4749175e.js | 1 - assets/js/7c47ad75.ad260db1.js | 1 + .../{7d99d243.54012244.js => 7d99d243.d6656fe6.js} | 2 +- assets/js/7dad11d2.dad942d9.js | 1 - assets/js/7dad11d2.fef3060c.js | 1 + assets/js/7de5ceea.5445c664.js | 1 + assets/js/7de5ceea.b2af9ad9.js | 1 - assets/js/81f06d1d.223390d8.js | 1 + assets/js/81f06d1d.60bcd9fe.js | 1 - .../{83a718dd.0adb0e64.js => 83a718dd.2ec37ad9.js} | 2 +- assets/js/84d0485c.8bd39c4b.js | 1 - assets/js/84d0485c.9ebc7e60.js | 1 + assets/js/84d7eb88.0b23a5c2.js | 1 - assets/js/84d7eb88.8354a109.js | 1 + assets/js/84e0516e.4464f876.js | 1 + assets/js/84e0516e.6228a083.js | 1 - assets/js/86470930.36c5dffa.js | 1 - assets/js/86470930.54135190.js | 1 + assets/js/86b70772.08e3b047.js | 1 - assets/js/86b70772.c1e63193.js | 1 + assets/js/8892d5ac.86e54523.js | 1 - assets/js/8892d5ac.9ea5ed3b.js | 1 + .../{891a814b.a7aa745a.js => 891a814b.de2a1f1e.js} | 2 +- assets/js/891ff042.ce730ce0.js | 1 - assets/js/891ff042.f1877020.js | 1 + assets/js/8953171e.1bc88db1.js | 1 + assets/js/8953171e.a6a9cbaf.js | 1 - assets/js/8af73e9a.64f55652.js | 1 + assets/js/8af73e9a.e866ca18.js | 1 - assets/js/8b16a1f6.b2db6316.js | 1 + assets/js/8b16a1f6.c902b5e1.js | 1 - assets/js/8b66fb2a.570bd90e.js | 1 - assets/js/8b66fb2a.c2a7076e.js | 1 + .../{8c906d29.e6affb24.js => 8c906d29.479eb620.js} | 2 +- assets/js/8cadf11f.0432a380.js | 1 + assets/js/8cadf11f.0d5f1f3d.js | 1 - .../{8cc3f780.fe64d87c.js => 8cc3f780.3792f34a.js} | 2 +- assets/js/8dc01f00.4350e041.js | 1 - assets/js/8dc01f00.7181f8a5.js | 1 + assets/js/8e8efec7.58572336.js | 1 + assets/js/8e8efec7.dc28db82.js | 1 - assets/js/8ed9d5b5.8d7dd474.js | 1 + assets/js/8ed9d5b5.d4f98026.js | 1 - assets/js/8fcded8c.8eb56230.js | 1 + assets/js/8fcded8c.b2a5625d.js | 1 - .../{90c4e188.5499a4f1.js => 90c4e188.08e509b3.js} | 2 +- assets/js/914bff86.0ff03e69.js | 1 - assets/js/914bff86.64064a50.js | 1 + assets/js/9218050e.a11620aa.js | 1 - assets/js/9218050e.aa0e81f8.js | 1 + assets/js/926125d1.1f30f9d3.js | 1 + assets/js/926125d1.6aa425a8.js | 1 - .../{9333a297.255e30a6.js => 9333a297.30a3ec3c.js} | 2 +- assets/js/9437cc2c.c3c3a0d2.js | 1 + assets/js/9437cc2c.ca1a1f53.js | 1 - .../{974b9b1f.3ab3fae7.js => 974b9b1f.0b4a5b97.js} | 2 +- assets/js/977fdfc4.020c4ba0.js | 1 + assets/js/977fdfc4.859a2a9a.js | 1 - assets/js/97cb7c6f.2185af50.js | 1 + assets/js/97cb7c6f.dd8c1393.js | 1 - assets/js/97d4b178.12592fa3.js | 1 + assets/js/97d4b178.28fad91d.js | 1 - assets/js/98c2782f.61de7134.js | 1 + assets/js/98c2782f.a19bf2ce.js | 1 - .../{992984a1.ceaf33a6.js => 992984a1.02a7186d.js} | 2 +- assets/js/99c9a9f3.90422214.js | 1 + assets/js/99c9a9f3.b1aedf2f.js | 1 - .../{9a8d2f85.580daa71.js => 9a8d2f85.6d07595b.js} | 2 +- assets/js/9aa67784.0d83ccfd.js | 1 - assets/js/9aa67784.c7446483.js | 1 + assets/js/9abd7762.1509a21c.js | 1 + assets/js/9abd7762.dae98762.js | 1 - assets/js/9b7cb8f9.8a3f1b13.js | 1 + assets/js/9b7cb8f9.aaa4f137.js | 1 - assets/js/9beb799b.b2b00fd2.js | 1 + assets/js/9beb799b.f02903a4.js | 1 - assets/js/9bfd3055.16d500d1.js | 1 + assets/js/9bfd3055.f9d9c90c.js | 1 - assets/js/9d46269e.14524253.js | 1 - assets/js/9d46269e.15887a17.js | 1 + assets/js/9e3571d8.4c2b1e30.js | 1 - assets/js/9e3571d8.5da745d6.js | 1 + assets/js/9edb4516.add35d2f.js | 1 + assets/js/9edb4516.e67e8686.js | 1 - assets/js/9f069a65.8014090f.js | 1 + assets/js/9f069a65.cd32031e.js | 1 - .../{9f0c4bd9.fc5837ef.js => 9f0c4bd9.5d0af657.js} | 2 +- assets/js/a08f9b67.6358c955.js | 1 - assets/js/a08f9b67.a413e8c6.js | 1 + assets/js/a0ca06fd.442ef2f5.js | 1 - assets/js/a0ca06fd.7662ee3d.js | 1 + assets/js/a104d7e6.45f528cc.js | 1 - assets/js/a104d7e6.5c0b558b.js | 1 + assets/js/a121ee0b.1e882ad3.js | 1 - assets/js/a121ee0b.7047d8dc.js | 1 + assets/js/a28f322c.12c6f0b8.js | 1 + assets/js/a28f322c.a1e5c3f8.js | 1 - assets/js/a2e57478.24d50fe6.js | 1 - assets/js/a2e57478.ea1a93b5.js | 1 + assets/js/a3522fac.18e9a347.js | 1 + assets/js/a3522fac.69c8cc5a.js | 1 - assets/js/a3e670f9.da664c98.js | 1 - assets/js/a3e670f9.f9e02389.js | 1 + assets/js/a61b46cc.60ee14bb.js | 1 - assets/js/a61b46cc.a0cda03b.js | 1 + assets/js/a6996c29.227566bd.js | 1 + assets/js/a6996c29.8a862112.js | 1 - assets/js/a8efa3a6.37e7878c.js | 1 - assets/js/a8efa3a6.adf8fbfd.js | 1 + .../{a8fa00b4.f3fdcbf2.js => a8fa00b4.02a7cc6f.js} | 2 +- assets/js/a932aaa1.0003ecd5.js | 1 + assets/js/a932aaa1.34a3a6e8.js | 1 - assets/js/a93b393b.27db29b6.js | 1 + assets/js/a93b393b.e801a22b.js | 1 - assets/js/a9c8d21a.5730115f.js | 1 + assets/js/a9c8d21a.917f5173.js | 1 - assets/js/abc4e0a8.0265feac.js | 1 + assets/js/abc4e0a8.f41be974.js | 1 - .../{ac6eab16.4263d3ab.js => ac6eab16.3499020a.js} | 2 +- assets/js/acb8ea0c.6bdeb423.js | 1 - assets/js/acb8ea0c.84aa6e61.js | 1 + assets/js/b57a4a2d.56b941fa.js | 1 - assets/js/b57a4a2d.db2ba8b0.js | 1 + .../{b62a942b.94d65b8e.js => b62a942b.283f5e5c.js} | 2 +- .../{b72e870b.b0818aeb.js => b72e870b.f840b411.js} | 2 +- assets/js/b8f8e7bf.4e4dfc0d.js | 1 + assets/js/b8f8e7bf.dbffdb30.js | 1 - assets/js/b934881b.8479e883.js | 1 - assets/js/b934881b.a099556d.js | 1 + .../{b9aad1dc.be1a308a.js => b9aad1dc.2dee3bfb.js} | 2 +- assets/js/b9b61d04.8d3b8115.js | 1 + assets/js/b9b61d04.8db21dcd.js | 1 - assets/js/baa12f70.015fb44d.js | 1 + assets/js/baa12f70.4258b9b2.js | 1 - assets/js/bae34ec2.12294e92.js | 1 + assets/js/bae34ec2.c5b53470.js | 1 - assets/js/bbb94644.86d079f1.js | 1 + assets/js/bbb94644.96817887.js | 1 - .../{bc5f1a80.26e6b53e.js => bc5f1a80.bfe53943.js} | 2 +- .../{bcb97d3a.6c1fa7b3.js => bcb97d3a.1a45de23.js} | 2 +- assets/js/bcd317c5.26419d17.js | 1 - assets/js/bcd317c5.d2f0c1b7.js | 1 + .../{bd8a8750.ef84805c.js => bd8a8750.e897ea28.js} | 2 +- assets/js/befc1215.8ccc048a.js | 1 - assets/js/befc1215.8e7340ee.js | 1 + assets/js/bffab106.0b259a05.js | 1 - assets/js/bffab106.a3eadc7f.js | 1 + assets/js/c02a675f.48b63c0a.js | 1 + assets/js/c02a675f.e722c66a.js | 1 - assets/js/c09b0fe7.5e5f6711.js | 1 + assets/js/c09b0fe7.b7002711.js | 1 - assets/js/c1bf8f22.9f9467fb.js | 1 - assets/js/c1bf8f22.b1c3cbce.js | 1 + assets/js/c1ddaab4.0c684afa.js | 1 - assets/js/c1ddaab4.fd25e463.js | 1 + assets/js/c3289e2b.1269f85c.js | 1 + assets/js/c3289e2b.9a6b37cc.js | 1 - assets/js/c3570998.03ff44e5.js | 1 - assets/js/c3570998.3c700b8c.js | 1 + assets/js/c3d74b12.947e859a.js | 1 + assets/js/c3d74b12.fceaefaa.js | 1 - .../{c4ff0a86.1ecf8fd3.js => c4ff0a86.1924faf9.js} | 2 +- assets/js/c5353c60.6a970d87.js | 1 - assets/js/c5353c60.8eab6d98.js | 1 + .../{c61f38e7.c1e5d186.js => c61f38e7.b2d9e077.js} | 2 +- assets/js/c6834bbf.3ffadd29.js | 1 - assets/js/c6834bbf.eb4dba57.js | 1 + assets/js/c6c2c73a.2d4e6873.js | 1 - assets/js/c6c2c73a.7ac6213d.js | 1 + assets/js/c7fa01e5.7af0056d.js | 1 - assets/js/c7fa01e5.7caa0d33.js | 1 + assets/js/c89433e3.1f981f18.js | 1 + assets/js/c89433e3.7aa27d5a.js | 1 - .../{c89804bb.c65aabdc.js => c89804bb.7cf91a3f.js} | 2 +- assets/js/c9777963.5ba749f7.js | 1 + assets/js/c9777963.7e80098d.js | 1 - assets/js/ca110a3e.8c10aa50.js | 1 - assets/js/ca110a3e.a1c26b21.js | 1 + assets/js/cae059c7.41f1107d.js | 1 + assets/js/cae059c7.9a3294b2.js | 1 - .../{cbd4dc33.9e38ea9e.js => cbd4dc33.1d5c2b1e.js} | 2 +- assets/js/cc1bc459.3169c291.js | 1 + assets/js/cc1bc459.fd1982bd.js | 1 - assets/js/cc91f96a.54c6a58a.js | 1 + assets/js/cc91f96a.5ae33ec2.js | 1 - .../{cd9e621c.c5f6b1df.js => cd9e621c.8bb18043.js} | 2 +- assets/js/ce316b05.01be9a2c.js | 1 + assets/js/ce316b05.1e3c7ad4.js | 1 - assets/js/d037b23d.189944c3.js | 1 + assets/js/d037b23d.a66e20ea.js | 1 - assets/js/d08bdbd3.10a63872.js | 1 - assets/js/d08bdbd3.669c653a.js | 1 + assets/js/d268f61a.63f2b8af.js | 1 + assets/js/d268f61a.c7364271.js | 1 - assets/js/d33f5cb2.3b3f47c1.js | 1 + assets/js/d33f5cb2.624ddb03.js | 1 - .../{d3d0d205.6dafa386.js => d3d0d205.d80208a3.js} | 2 +- assets/js/d4850a38.039adaf2.js | 1 + assets/js/d4850a38.117e9e2e.js | 1 - assets/js/d5099334.aabe751f.js | 1 + assets/js/d5099334.ac38b340.js | 1 - assets/js/d5b05897.41fb008f.js | 1 - assets/js/d5b05897.b930149e.js | 1 + assets/js/d622cb4f.06b809a3.js | 1 + assets/js/d622cb4f.fcbc5b14.js | 1 - .../{d64f1887.84b17165.js => d64f1887.8de6e388.js} | 2 +- assets/js/d76a14be.6a141c62.js | 1 - assets/js/d76a14be.8e1306fd.js | 1 + .../{d82a2a7b.82200028.js => d82a2a7b.bb6e1f92.js} | 2 +- assets/js/d889ad2d.1171bb5a.js | 1 - assets/js/d889ad2d.1f7d09b5.js | 1 + .../{d8f7b805.ca96f4f9.js => d8f7b805.37f5ed3d.js} | 2 +- assets/js/d9d9f449.854e9d59.js | 1 + assets/js/d9d9f449.db80164e.js | 1 - .../{daa78d60.ba90eba3.js => daa78d60.2b50f61c.js} | 2 +- .../{db343463.4fdd00a2.js => db343463.8ca2a907.js} | 2 +- assets/js/db719915.ea11932d.js | 1 + assets/js/db719915.fa9b8b30.js | 1 - assets/js/de5e0098.84a7cfaa.js | 1 - assets/js/de5e0098.bb9b7fba.js | 1 + assets/js/de7874bb.2fabde79.js | 1 + assets/js/de7874bb.8984941a.js | 1 - .../{e08a2305.b272811d.js => e08a2305.51f3299b.js} | 2 +- assets/js/e0d4068f.079fd85a.js | 1 + assets/js/e0d4068f.5a1b5eaa.js | 1 - assets/js/e14874ff.b3f06a1c.js | 1 - assets/js/e14874ff.c571c778.js | 1 + assets/js/e1b9f8c7.82bd3d24.js | 1 + assets/js/e1b9f8c7.890bb2d6.js | 1 - .../{e1c24df0.5dc84bae.js => e1c24df0.9cbd257d.js} | 2 +- assets/js/e31dd6e1.a71cef1b.js | 1 - assets/js/e31dd6e1.f180556b.js | 1 + assets/js/e3966691.b0802950.js | 1 - assets/js/e3966691.daa202c5.js | 1 + assets/js/e4f1eb77.dbe0b5ca.js | 1 + assets/js/e4f1eb77.e6514259.js | 1 - .../{e5474da6.6e0a0db1.js => e5474da6.3cbbe942.js} | 2 +- assets/js/e5601569.6499cac4.js | 1 + assets/js/e5601569.d299888b.js | 1 - assets/js/e7791cad.12fbf57a.js | 1 - assets/js/e7791cad.cd201f42.js | 1 + assets/js/e803704a.519838ad.js | 1 - assets/js/e803704a.9ab4b3c3.js | 1 + assets/js/e82e5e58.85ec3add.js | 1 + assets/js/e82e5e58.d14836ef.js | 1 - assets/js/e86c9445.6f7a9de5.js | 1 - assets/js/e86c9445.89363706.js | 1 + .../{e8d372a7.a591a1f2.js => e8d372a7.3be01d80.js} | 2 +- assets/js/ec5071fd.1f58f84c.js | 1 - assets/js/ec5071fd.27ec8539.js | 1 + assets/js/ed44aa5e.1aec9ae5.js | 1 + assets/js/ed44aa5e.c9cfe6ea.js | 1 - .../{ee6d0512.6863f847.js => ee6d0512.f0855176.js} | 2 +- assets/js/f0c48f07.34e650bc.js | 1 + assets/js/f0c48f07.c7c9d3c6.js | 1 - assets/js/f158ec46.0220f71a.js | 1 - assets/js/f158ec46.6156892f.js | 1 + .../{f2140f39.aea0316d.js => f2140f39.2036c39d.js} | 2 +- assets/js/f293b4fc.55c985c1.js | 1 + assets/js/f293b4fc.bbc711c1.js | 1 - .../{f3facea8.ae53abab.js => f3facea8.2cf09d7b.js} | 2 +- assets/js/f4dc87f8.2ceeae98.js | 1 + assets/js/f4dc87f8.6783e1d2.js | 1 - assets/js/f72402e6.4a6909ca.js | 1 + assets/js/f72402e6.ac257c96.js | 1 - .../{f7cb8cb3.d23819bc.js => f7cb8cb3.d4399452.js} | 2 +- assets/js/f7f2164e.72299f2a.js | 1 + assets/js/f7f2164e.c81197c7.js | 1 - assets/js/f8e6c3d7.4bbd2653.js | 1 + assets/js/f8e6c3d7.fe66a94a.js | 1 - assets/js/faf6f2db.401c99df.js | 1 - assets/js/faf6f2db.bae87dc3.js | 1 + assets/js/fb3f88b1.bfb726f8.js | 1 - assets/js/fb3f88b1.fea87c31.js | 1 + assets/js/fb634d25.27100a36.js | 1 - assets/js/fb634d25.bd5a7df9.js | 1 + assets/js/fd1fdd14.b6d76bd7.js | 1 - assets/js/fd1fdd14.f3f7fdc6.js | 1 + .../{fd8fca12.d31b2cf4.js => fd8fca12.a37baf25.js} | 2 +- assets/js/ff1602b7.3e795999.js | 1 + assets/js/ff1602b7.e9c1b048.js | 1 - assets/js/{main.5fb7170a.js => main.195c2ab4.js} | 4 ++-- ...a.js.LICENSE.txt => main.195c2ab4.js.LICENSE.txt} | 0 ...ime~main.fd8f2c37.js => runtime~main.3b125a4d.js} | 2 +- blog/2021-kcl-intro/index.html | 8 ++++---- blog/2021-kusion-intro/index.html | 8 ++++---- .../index.html | 8 ++++---- blog/2022-learn-from-scale-practice/index.html | 8 ++++---- blog/2022-open-day/index.html | 8 ++++---- blog/2022-origin-present-and-future/index.html | 8 ++++---- blog/2022-post-cloud-native-era-operation/index.html | 8 ++++---- blog/2022-sense-of-open-day/index.html | 8 ++++---- blog/2023-05-26-qcon-guangzhou/index.html | 8 ++++---- blog/archive/index.html | 8 ++++---- blog/index.html | 8 ++++---- blog/page/2/index.html | 8 ++++---- blog/page/3/index.html | 8 ++++---- blog/page/4/index.html | 8 ++++---- blog/page/5/index.html | 8 ++++---- blog/tags/index.html | 8 ++++---- blog/tags/kcl/index.html | 8 ++++---- blog/tags/kclvm/index.html | 8 ++++---- blog/tags/kusion-stack/index.html | 8 ++++---- blog/tags/kusion-stack/page/2/index.html | 8 ++++---- blog/tags/kusion-stack/page/3/index.html | 8 ++++---- blog/tags/kusion-stack/page/4/index.html | 8 ++++---- blog/tags/kusion/index.html | 8 ++++---- blog/tags/kusion/page/2/index.html | 8 ++++---- blog/tags/kusion/page/3/index.html | 8 ++++---- blog/tags/kusion/page/4/index.html | 8 ++++---- blog/tags/large-scale/index.html | 8 ++++---- blog/tags/platform-engineering/index.html | 8 ++++---- community/intro/index.html | 8 ++++---- ctrlmesh/concepts/index.html | 8 ++++---- ctrlmesh/faq/index.html | 8 ++++---- ctrlmesh/intro/index.html | 8 ++++---- ctrlmesh/next/concepts/index.html | 8 ++++---- ctrlmesh/next/faq/index.html | 8 ++++---- ctrlmesh/next/intro/index.html | 8 ++++---- ctrlmesh/next/started/install/index.html | 8 ++++---- ctrlmesh/next/started/try/index.html | 8 ++++---- ctrlmesh/started/install/index.html | 8 ++++---- ctrlmesh/started/try/index.html | 8 ++++---- docs/concepts/app-configuration/index.html | 10 +++++----- docs/concepts/backend/index.html | 10 +++++----- docs/concepts/configuration/index.html | 10 +++++----- docs/concepts/how-kusion-works/index.html | 10 +++++----- docs/concepts/kusion-module/app-dev-guide/index.html | 10 +++++----- docs/concepts/kusion-module/develop-guide/index.html | 12 ++++++------ docs/concepts/kusion-module/overview/index.html | 10 +++++----- docs/concepts/project/configuration/index.html | 10 +++++----- docs/concepts/project/overview/index.html | 10 +++++----- docs/concepts/spec/index.html | 10 +++++----- docs/concepts/stack/configuration/index.html | 10 +++++----- docs/concepts/stack/overview/index.html | 10 +++++----- docs/concepts/workspace/index.html | 10 +++++----- .../base-override/index.html | 10 +++++----- docs/configuration-walkthrough/databse/index.html | 10 +++++----- docs/configuration-walkthrough/kcl-basics/index.html | 10 +++++----- docs/configuration-walkthrough/monitoring/index.html | 10 +++++----- docs/configuration-walkthrough/networking/index.html | 10 +++++----- .../operational-rules/index.html | 10 +++++----- docs/configuration-walkthrough/overview/index.html | 10 +++++----- docs/configuration-walkthrough/secret/index.html | 10 +++++----- docs/configuration-walkthrough/workload/index.html | 10 +++++----- docs/faq/install-error/index.html | 10 +++++----- docs/faq/kcl/index.html | 10 +++++----- docs/getting-started/deliver-quickstart/index.html | 10 +++++----- docs/getting-started/install-kusion/index.html | 10 +++++----- docs/index.html | 10 +++++----- docs/next/concepts/app-configuration/index.html | 10 +++++----- docs/next/concepts/backend/index.html | 10 +++++----- docs/next/concepts/configuration/index.html | 10 +++++----- docs/next/concepts/how-kusion-works/index.html | 10 +++++----- .../concepts/kusion-module/app-dev-guide/index.html | 10 +++++----- .../concepts/kusion-module/develop-guide/index.html | 12 ++++++------ docs/next/concepts/kusion-module/overview/index.html | 10 +++++----- docs/next/concepts/project/configuration/index.html | 10 +++++----- docs/next/concepts/project/overview/index.html | 10 +++++----- docs/next/concepts/spec/index.html | 10 +++++----- docs/next/concepts/stack/configuration/index.html | 10 +++++----- docs/next/concepts/stack/overview/index.html | 10 +++++----- docs/next/concepts/workspace/index.html | 10 +++++----- .../base-override/index.html | 10 +++++----- .../configuration-walkthrough/databse/index.html | 10 +++++----- .../configuration-walkthrough/kcl-basics/index.html | 10 +++++----- .../configuration-walkthrough/monitoring/index.html | 10 +++++----- .../configuration-walkthrough/networking/index.html | 10 +++++----- .../operational-rules/index.html | 10 +++++----- .../configuration-walkthrough/overview/index.html | 10 +++++----- .../next/configuration-walkthrough/secret/index.html | 10 +++++----- .../configuration-walkthrough/workload/index.html | 10 +++++----- docs/next/faq/install-error/index.html | 10 +++++----- docs/next/faq/kcl/index.html | 10 +++++----- .../getting-started/deliver-quickstart/index.html | 10 +++++----- docs/next/getting-started/install-kusion/index.html | 10 +++++----- docs/next/index.html | 10 +++++----- docs/next/reference/commands/index.html | 10 +++++----- docs/next/reference/commands/kusion-apply/index.html | 10 +++++----- .../reference/commands/kusion-config-get/index.html | 10 +++++----- .../reference/commands/kusion-config-list/index.html | 10 +++++----- .../reference/commands/kusion-config-set/index.html | 10 +++++----- .../commands/kusion-config-unset/index.html | 10 +++++----- .../next/reference/commands/kusion-config/index.html | 10 +++++----- .../reference/commands/kusion-destroy/index.html | 10 +++++----- .../reference/commands/kusion-generate/index.html | 10 +++++----- docs/next/reference/commands/kusion-init/index.html | 10 +++++----- .../reference/commands/kusion-mod-init/index.html | 10 +++++----- .../reference/commands/kusion-mod-push/index.html | 10 +++++----- docs/next/reference/commands/kusion-mod/index.html | 10 +++++----- .../reference/commands/kusion-options/index.html | 10 +++++----- .../reference/commands/kusion-preview/index.html | 10 +++++----- .../commands/kusion-project-create/index.html | 10 +++++----- .../reference/commands/kusion-project/index.html | 10 +++++----- .../commands/kusion-stack-create/index.html | 10 +++++----- docs/next/reference/commands/kusion-stack/index.html | 10 +++++----- .../reference/commands/kusion-version/index.html | 10 +++++----- .../commands/kusion-workspace-create/index.html | 10 +++++----- .../commands/kusion-workspace-delete/index.html | 10 +++++----- .../commands/kusion-workspace-list/index.html | 10 +++++----- .../commands/kusion-workspace-show/index.html | 10 +++++----- .../commands/kusion-workspace-switch/index.html | 10 +++++----- .../commands/kusion-workspace-update/index.html | 10 +++++----- .../reference/commands/kusion-workspace/index.html | 10 +++++----- .../developer-schemas/app-configuration/index.html | 10 +++++----- .../developer-schemas/database/mysql/index.html | 10 +++++----- .../developer-schemas/database/postgres/index.html | 10 +++++----- .../developer-schemas/internal/common/index.html | 10 +++++----- .../developer-schemas/internal/container/index.html | 10 +++++----- .../internal/container/lifecycle/index.html | 10 +++++----- .../internal/container/probe/index.html | 10 +++++----- .../developer-schemas/internal/secret/index.html | 10 +++++----- .../monitoring/prometheus/index.html | 10 +++++----- .../modules/developer-schemas/network/index.html | 10 +++++----- .../modules/developer-schemas/opsrule/index.html | 10 +++++----- .../developer-schemas/workload/job/index.html | 10 +++++----- .../developer-schemas/workload/service/index.html | 10 +++++----- docs/next/reference/modules/index.html | 10 +++++----- .../reference/modules/naming-conventions/index.html | 10 +++++----- .../workspace-configs/database/mysql/index.html | 10 +++++----- .../workspace-configs/database/postgres/index.html | 10 +++++----- .../monitoring/prometheus/index.html | 10 +++++----- .../workspace-configs/networking/network/index.html | 10 +++++----- .../modules/workspace-configs/opsrule/index.html | 10 +++++----- .../workspace-configs/workload/job/index.html | 10 +++++----- .../workspace-configs/workload/service/index.html | 10 +++++----- docs/next/reference/roadmap/index.html | 10 +++++----- .../user-guides/cloud-resources/database/index.html | 10 +++++----- .../cloud-resources/expose-service/index.html | 10 +++++----- .../user-guides/observability/prometheus/index.html | 10 +++++----- .../using-cloud-secrets/index.html | 10 +++++----- .../working-with-k8s/container/index.html | 10 +++++----- .../working-with-k8s/deploy-application/index.html | 10 +++++----- .../working-with-k8s/image-upgrade/index.html | 10 +++++----- .../next/user-guides/working-with-k8s/job/index.html | 10 +++++----- .../working-with-k8s/resource-spec/index.html | 10 +++++----- .../user-guides/working-with-k8s/service/index.html | 10 +++++----- .../set-up-operational-rules/index.html | 10 +++++----- docs/next/what-is-kusion/kusion-vs-x/index.html | 10 +++++----- docs/reference/commands/index.html | 10 +++++----- docs/reference/commands/kusion-apply/index.html | 10 +++++----- docs/reference/commands/kusion-config-get/index.html | 10 +++++----- .../reference/commands/kusion-config-list/index.html | 10 +++++----- docs/reference/commands/kusion-config-set/index.html | 10 +++++----- .../commands/kusion-config-unset/index.html | 10 +++++----- docs/reference/commands/kusion-config/index.html | 10 +++++----- docs/reference/commands/kusion-destroy/index.html | 10 +++++----- docs/reference/commands/kusion-generate/index.html | 10 +++++----- docs/reference/commands/kusion-init/index.html | 10 +++++----- docs/reference/commands/kusion-mod-init/index.html | 10 +++++----- docs/reference/commands/kusion-mod-push/index.html | 10 +++++----- docs/reference/commands/kusion-mod/index.html | 10 +++++----- docs/reference/commands/kusion-options/index.html | 10 +++++----- docs/reference/commands/kusion-preview/index.html | 10 +++++----- .../commands/kusion-project-create/index.html | 10 +++++----- docs/reference/commands/kusion-project/index.html | 10 +++++----- .../commands/kusion-stack-create/index.html | 10 +++++----- docs/reference/commands/kusion-stack/index.html | 10 +++++----- docs/reference/commands/kusion-version/index.html | 10 +++++----- .../commands/kusion-workspace-create/index.html | 10 +++++----- .../commands/kusion-workspace-delete/index.html | 10 +++++----- .../commands/kusion-workspace-list/index.html | 10 +++++----- .../commands/kusion-workspace-show/index.html | 10 +++++----- .../commands/kusion-workspace-switch/index.html | 10 +++++----- .../commands/kusion-workspace-update/index.html | 10 +++++----- docs/reference/commands/kusion-workspace/index.html | 10 +++++----- .../developer-schemas/app-configuration/index.html | 10 +++++----- .../developer-schemas/database/mysql/index.html | 10 +++++----- .../developer-schemas/database/postgres/index.html | 10 +++++----- .../developer-schemas/internal/common/index.html | 10 +++++----- .../developer-schemas/internal/container/index.html | 10 +++++----- .../internal/container/lifecycle/index.html | 10 +++++----- .../internal/container/probe/index.html | 10 +++++----- .../developer-schemas/internal/secret/index.html | 10 +++++----- .../monitoring/prometheus/index.html | 10 +++++----- .../modules/developer-schemas/network/index.html | 10 +++++----- .../modules/developer-schemas/opsrule/index.html | 10 +++++----- .../developer-schemas/workload/job/index.html | 10 +++++----- .../developer-schemas/workload/service/index.html | 10 +++++----- docs/reference/modules/index.html | 10 +++++----- docs/reference/modules/naming-conventions/index.html | 10 +++++----- .../workspace-configs/database/mysql/index.html | 10 +++++----- .../workspace-configs/database/postgres/index.html | 10 +++++----- .../monitoring/prometheus/index.html | 10 +++++----- .../workspace-configs/networking/network/index.html | 10 +++++----- .../modules/workspace-configs/opsrule/index.html | 10 +++++----- .../workspace-configs/workload/job/index.html | 10 +++++----- .../workspace-configs/workload/service/index.html | 10 +++++----- docs/reference/roadmap/index.html | 10 +++++----- docs/user-guides/cloud-resources/database/index.html | 10 +++++----- .../cloud-resources/expose-service/index.html | 10 +++++----- docs/user-guides/observability/prometheus/index.html | 10 +++++----- .../using-cloud-secrets/index.html | 10 +++++----- .../working-with-k8s/container/index.html | 10 +++++----- .../working-with-k8s/deploy-application/index.html | 10 +++++----- .../working-with-k8s/image-upgrade/index.html | 10 +++++----- docs/user-guides/working-with-k8s/job/index.html | 10 +++++----- .../working-with-k8s/resource-spec/index.html | 10 +++++----- docs/user-guides/working-with-k8s/service/index.html | 10 +++++----- .../set-up-operational-rules/index.html | 10 +++++----- docs/v0.10/concepts/app-configuration/index.html | 10 +++++----- docs/v0.10/concepts/backend-configuration/index.html | 10 +++++----- docs/v0.10/concepts/how-kusion-works/index.html | 10 +++++----- docs/v0.10/concepts/intent/index.html | 10 +++++----- docs/v0.10/concepts/kusion-module/index.html | 10 +++++----- docs/v0.10/concepts/project/configuration/index.html | 10 +++++----- docs/v0.10/concepts/project/overview/index.html | 10 +++++----- docs/v0.10/concepts/stack/configuration/index.html | 10 +++++----- docs/v0.10/concepts/stack/overview/index.html | 10 +++++----- docs/v0.10/concepts/workspace/index.html | 10 +++++----- .../base-override/index.html | 10 +++++----- .../configuration-walkthrough/databse/index.html | 10 +++++----- .../configuration-walkthrough/kcl-basics/index.html | 10 +++++----- .../configuration-walkthrough/monitoring/index.html | 10 +++++----- .../configuration-walkthrough/networking/index.html | 10 +++++----- .../operational-rules/index.html | 10 +++++----- .../configuration-walkthrough/overview/index.html | 10 +++++----- .../configuration-walkthrough/secret/index.html | 10 +++++----- .../configuration-walkthrough/workload/index.html | 10 +++++----- docs/v0.10/faq/install-error/index.html | 10 +++++----- docs/v0.10/faq/kcl/index.html | 10 +++++----- .../getting-started/deliver-wordpress/index.html | 10 +++++----- docs/v0.10/getting-started/install-kusion/index.html | 10 +++++----- docs/v0.10/index.html | 10 +++++----- docs/v0.10/reference/commands/index.html | 10 +++++----- .../v0.10/reference/commands/kusion-apply/index.html | 10 +++++----- .../v0.10/reference/commands/kusion-build/index.html | 10 +++++----- .../reference/commands/kusion-compile/index.html | 10 +++++----- .../reference/commands/kusion-destroy/index.html | 10 +++++----- docs/v0.10/reference/commands/kusion-init/index.html | 10 +++++----- .../reference/commands/kusion-preview/index.html | 10 +++++----- .../reference/commands/kusion-version/index.html | 10 +++++----- .../commands/kusion-workspace-create/index.html | 10 +++++----- .../commands/kusion-workspace-delete/index.html | 10 +++++----- .../commands/kusion-workspace-list/index.html | 10 +++++----- .../commands/kusion-workspace-show/index.html | 10 +++++----- .../commands/kusion-workspace-update/index.html | 10 +++++----- .../reference/commands/kusion-workspace/index.html | 10 +++++----- .../catalog-models/app-configuration/index.html | 10 +++++----- .../modules/catalog-models/database/mysql/index.html | 10 +++++----- .../catalog-models/database/postgres/index.html | 10 +++++----- .../catalog-models/internal/common/index.html | 10 +++++----- .../catalog-models/internal/container/index.html | 10 +++++----- .../internal/container/lifecycle/index.html | 10 +++++----- .../internal/container/probe/index.html | 10 +++++----- .../catalog-models/internal/network/port/index.html | 10 +++++----- .../catalog-models/internal/secret/index.html | 10 +++++----- .../catalog-models/monitoring/prometheus/index.html | 10 +++++----- .../modules/catalog-models/trait/opsrule/index.html | 10 +++++----- .../modules/catalog-models/workload/job/index.html | 10 +++++----- .../catalog-models/workload/service/index.html | 10 +++++----- docs/v0.10/reference/modules/index.html | 10 +++++----- .../reference/modules/naming-conventions/index.html | 10 +++++----- .../workspace-configs/database/mysql/index.html | 10 +++++----- .../workspace-configs/database/postgres/index.html | 10 +++++----- .../monitoring/prometheus/index.html | 10 +++++----- .../workspace-configs/networking/port/index.html | 10 +++++----- .../workspace-configs/trait/opsrule/index.html | 10 +++++----- .../workspace-configs/workload/job/index.html | 10 +++++----- .../workspace-configs/workload/service/index.html | 10 +++++----- docs/v0.10/reference/roadmap/index.html | 10 +++++----- .../user-guides/cloud-resources/database/index.html | 10 +++++----- .../cloud-resources/expose-service/index.html | 10 +++++----- .../deploy-application-via-github-actions/index.html | 10 +++++----- .../user-guides/observability/prometheus/index.html | 10 +++++----- .../using-cloud-secrets/index.html | 10 +++++----- .../working-with-k8s/container/index.html | 10 +++++----- .../working-with-k8s/deploy-application/index.html | 10 +++++----- .../working-with-k8s/image-upgrade/index.html | 10 +++++----- .../user-guides/working-with-k8s/job/index.html | 10 +++++----- .../working-with-k8s/resource-spec/index.html | 10 +++++----- .../user-guides/working-with-k8s/service/index.html | 10 +++++----- .../set-up-operational-rules/index.html | 10 +++++----- docs/v0.10/what-is-kusion/kusion-vs-x/index.html | 10 +++++----- docs/v0.9/concepts/appconfiguration/index.html | 10 +++++----- docs/v0.9/concepts/arch/index.html | 10 +++++----- docs/v0.9/concepts/glossary/index.html | 10 +++++----- docs/v0.9/concepts/index.html | 10 +++++----- docs/v0.9/concepts/intent/index.html | 10 +++++----- docs/v0.9/concepts/kusion/index.html | 10 +++++----- .../v0.9/config-walkthrough/base_override/index.html | 10 +++++----- docs/v0.9/config-walkthrough/database/index.html | 10 +++++----- docs/v0.9/config-walkthrough/kcl_basics/index.html | 10 +++++----- docs/v0.9/config-walkthrough/monitoring/index.html | 10 +++++----- docs/v0.9/config-walkthrough/networking/index.html | 10 +++++----- .../config-walkthrough/operational_rules/index.html | 10 +++++----- docs/v0.9/config-walkthrough/overview/index.html | 10 +++++----- docs/v0.9/config-walkthrough/secret/index.html | 10 +++++----- docs/v0.9/config-walkthrough/workload/index.html | 10 +++++----- .../getting-started/deliver-wordpress/index.html | 10 +++++----- docs/v0.9/getting-started/index.html | 10 +++++----- docs/v0.9/getting-started/install-kusion/index.html | 10 +++++----- docs/v0.9/guides/cloud-resources/database/index.html | 10 +++++----- .../guides/cloud-resources/expose-service/index.html | 10 +++++----- .../index.html | 10 +++++----- docs/v0.9/guides/index.html | 10 +++++----- docs/v0.9/guides/observability/prometheus/index.html | 10 +++++----- .../guides/working-with-k8s/container/index.html | 10 +++++----- .../working-with-k8s/deploy-application/index.html | 10 +++++----- .../guides/working-with-k8s/image-upgrade/index.html | 10 +++++----- docs/v0.9/guides/working-with-k8s/index.html | 10 +++++----- .../guides/working-with-k8s/resource-spec/index.html | 10 +++++----- docs/v0.9/guides/working-with-k8s/service/index.html | 10 +++++----- docs/v0.9/index.html | 10 +++++----- docs/v0.9/intro/kusion-vs-x/index.html | 10 +++++----- .../cli/backend/backend-configuration/index.html | 10 +++++----- docs/v0.9/reference/cli/index.html | 10 +++++----- docs/v0.9/reference/cli/kusion/index.html | 10 +++++----- .../reference/cli/kusion/kusion_apply/index.html | 10 +++++----- .../reference/cli/kusion/kusion_build/index.html | 10 +++++----- .../reference/cli/kusion/kusion_compile/index.html | 10 +++++----- .../reference/cli/kusion/kusion_destroy/index.html | 10 +++++----- .../v0.9/reference/cli/kusion/kusion_init/index.html | 10 +++++----- .../reference/cli/kusion/kusion_preview/index.html | 10 +++++----- .../reference/cli/kusion/kusion_version/index.html | 10 +++++----- .../catalog_models/database/doc_database/index.html | 10 +++++----- .../catalog_models/doc_app_configuration/index.html | 10 +++++----- .../internal/container/doc_container/index.html | 10 +++++----- .../container/lifecycle/doc_lifecycle/index.html | 10 +++++----- .../internal/container/probe/doc_probe/index.html | 10 +++++----- .../catalog_models/internal/doc_common/index.html | 10 +++++----- .../internal/network/doc_port/index.html | 10 +++++----- .../internal/secret/doc_secret/index.html | 10 +++++----- .../monitoring/doc_prometheus/index.html | 10 +++++----- .../catalog_models/trait/doc_opsrule/index.html | 10 +++++----- .../model/catalog_models/workload/doc_job/index.html | 10 +++++----- .../catalog_models/workload/doc_service/index.html | 10 +++++----- docs/v0.9/reference/model/index.html | 10 +++++----- .../reference/model/naming-conventions/index.html | 10 +++++----- docs/v0.9/reference/model/overview/index.html | 10 +++++----- .../model/project-stack-config-items/index.html | 10 +++++----- docs/v0.9/reference/roadmap/index.html | 10 +++++----- docs/v0.9/support/index.html | 10 +++++----- docs/v0.9/support/install-error/index.html | 10 +++++----- docs/v0.9/support/kcl/index.html | 10 +++++----- docs/what-is-kusion/kusion-vs-x/index.html | 10 +++++----- index.html | 8 ++++---- markdown-page/index.html | 8 ++++---- operating/concepts/podopslifecycle/index.html | 8 ++++---- operating/introduction/index.html | 8 ++++---- operating/manuals/collaset/index.html | 8 ++++---- operating/manuals/poddecoration/index.html | 8 ++++---- operating/manuals/podtransitionrule/index.html | 8 ++++---- operating/manuals/resourceconsist/index.html | 8 ++++---- operating/next/concepts/podopslifecycle/index.html | 8 ++++---- operating/next/introduction/index.html | 8 ++++---- operating/next/manuals/collaset/index.html | 8 ++++---- operating/next/manuals/poddecoration/index.html | 8 ++++---- operating/next/manuals/podtransitionrule/index.html | 8 ++++---- operating/next/manuals/resourceconsist/index.html | 8 ++++---- .../next/started/demo-graceful-operation/index.html | 8 ++++---- operating/next/started/install/index.html | 8 ++++---- operating/started/demo-graceful-operation/index.html | 8 ++++---- operating/started/install/index.html | 8 ++++---- search/index.html | 10 +++++----- 929 files changed, 2120 insertions(+), 2120 deletions(-) delete mode 100644 assets/js/01439c8e.73089375.js create mode 100644 assets/js/01439c8e.823a3d9e.js create mode 100644 assets/js/030b8d03.1cd548fa.js delete mode 100644 assets/js/030b8d03.e8977684.js create mode 100644 assets/js/03253e12.1e0acf26.js delete mode 100644 assets/js/03253e12.e61e6743.js rename assets/js/{0400c277.fb900e8e.js => 0400c277.27c21fee.js} (66%) delete mode 100644 assets/js/043680c6.0aa5ff9f.js create mode 100644 assets/js/043680c6.f3a12810.js delete mode 100644 assets/js/045fa4ba.1fc1adcc.js create mode 100644 assets/js/045fa4ba.6fc5d885.js create mode 100644 assets/js/05e2121e.009d4753.js delete mode 100644 assets/js/05e2121e.4e566dd6.js delete mode 100644 assets/js/064aa373.70aaf374.js create mode 100644 assets/js/064aa373.b5b64da4.js create mode 100644 assets/js/082d3c28.2643487a.js delete mode 100644 assets/js/082d3c28.c33a4fee.js create mode 100644 assets/js/091a426a.21792e07.js delete mode 100644 assets/js/091a426a.2c44207b.js create mode 100644 assets/js/0a185701.ad3fea43.js delete mode 100644 assets/js/0a185701.dda5c0ee.js create mode 100644 assets/js/0a57f7df.51538d2f.js delete mode 100644 assets/js/0a57f7df.b7aed711.js rename assets/js/{0a8d339f.8241bef2.js => 0a8d339f.a6d34ab0.js} (55%) rename assets/js/{0a99afe0.573bd0fb.js => 0a99afe0.eeb4b30f.js} (50%) delete mode 100644 assets/js/0b745da3.12c94f6f.js create mode 100644 assets/js/0b745da3.4ad49bdc.js create mode 100644 assets/js/0d383345.40a38ff6.js delete mode 100644 assets/js/0d383345.9d67235e.js delete mode 100644 assets/js/0d662946.2a16f681.js create mode 100644 assets/js/0d662946.7f7d468a.js delete mode 100644 assets/js/0ed14211.1e09a987.js create mode 100644 assets/js/0ed14211.1f338424.js create mode 100644 assets/js/0feba5eb.2e875425.js delete mode 100644 assets/js/0feba5eb.34198b40.js delete mode 100644 assets/js/10669232.7d91494e.js create mode 100644 assets/js/10669232.c7f81478.js create mode 100644 assets/js/12216004.24717c2b.js delete mode 100644 assets/js/12216004.b0bfea70.js rename assets/js/{13e25c40.e20487bc.js => 13e25c40.f5ef4c7e.js} (54%) create mode 100644 assets/js/163cf949.5abc9c73.js delete mode 100644 assets/js/163cf949.6371565d.js delete mode 100644 assets/js/16a19535.19833e67.js create mode 100644 assets/js/16a19535.2e160473.js create mode 100644 assets/js/16bff117.185946e6.js delete mode 100644 assets/js/16bff117.9d605764.js rename assets/js/{17658ce1.7bf5ac4b.js => 17658ce1.b4908420.js} (78%) delete mode 100644 assets/js/17a1e8ae.45c60e6d.js create mode 100644 assets/js/17a1e8ae.ccf48d6a.js rename assets/js/{180ff8b9.814b6860.js => 180ff8b9.7ee38d2d.js} (52%) delete mode 100644 assets/js/18d9b529.258fd535.js create mode 100644 assets/js/18d9b529.6440b594.js delete mode 100644 assets/js/18fa340a.7e78f7eb.js create mode 100644 assets/js/18fa340a.da7036b2.js delete mode 100644 assets/js/194f885d.950b5f7d.js create mode 100644 assets/js/194f885d.b56556c2.js delete mode 100644 assets/js/19556a9e.65609499.js create mode 100644 assets/js/19556a9e.a7c83650.js create mode 100644 assets/js/1961a063.a2b468e0.js delete mode 100644 assets/js/1961a063.eef31fca.js delete mode 100644 assets/js/1aa0cc2e.4ffe9435.js create mode 100644 assets/js/1aa0cc2e.f9b61ca1.js delete mode 100644 assets/js/1b95d76e.03d4d1b3.js create mode 100644 assets/js/1b95d76e.5e3ecc75.js create mode 100644 assets/js/1b9ff86e.1e420a8e.js delete mode 100644 assets/js/1b9ff86e.f8a2e2b1.js create mode 100644 assets/js/1bd21934.3f9288e7.js delete mode 100644 assets/js/1bd21934.d404b432.js create mode 100644 assets/js/1ec179f1.70173c27.js delete mode 100644 assets/js/1ec179f1.ee7eaa9a.js create mode 100644 assets/js/1efb9d39.91c9b74d.js delete mode 100644 assets/js/1efb9d39.e674c412.js rename assets/js/{1f997fd4.89e6fc1e.js => 1f997fd4.55636f89.js} (52%) create mode 100644 assets/js/1fe4756a.40e4c2a7.js delete mode 100644 assets/js/1fe4756a.ca0c0f84.js delete mode 100644 assets/js/20db72b2.3748d1e5.js create mode 100644 assets/js/20db72b2.64bf6dd5.js rename assets/js/{2115f1af.266e19d6.js => 2115f1af.4814f939.js} (51%) create mode 100644 assets/js/21746641.a22d74e2.js delete mode 100644 assets/js/21746641.ddb36f72.js create mode 100644 assets/js/21778a34.af0d4491.js delete mode 100644 assets/js/21778a34.e8ceb514.js delete mode 100644 assets/js/2326e64e.695057c6.js create mode 100644 assets/js/2326e64e.77b416b7.js delete mode 100644 assets/js/24657d42.b0fcf53c.js create mode 100644 assets/js/24657d42.d0dbc8c0.js rename assets/js/{252357e3.2f60bfc3.js => 252357e3.fcce83b6.js} (81%) create mode 100644 assets/js/27e25305.4faae2d3.js delete mode 100644 assets/js/27e25305.8b7d4e57.js delete mode 100644 assets/js/28530a7a.1a12b246.js create mode 100644 assets/js/28530a7a.96fe6330.js rename assets/js/{2871ff48.b82416e1.js => 2871ff48.3f6c40f3.js} (67%) delete mode 100644 assets/js/2a719713.4ab3dc05.js create mode 100644 assets/js/2a719713.ff0653df.js create mode 100644 assets/js/2b0acc78.a87574cc.js delete mode 100644 assets/js/2b0acc78.c585ed54.js create mode 100644 assets/js/2be338c6.0a4a7306.js delete mode 100644 assets/js/2be338c6.ab8a4e1d.js delete mode 100644 assets/js/2bf7c981.5f304794.js create mode 100644 assets/js/2bf7c981.b51e5670.js delete mode 100644 assets/js/2e408e18.058934e9.js create mode 100644 assets/js/2e408e18.7df979fa.js rename assets/js/{2e7a9059.9e60dfcd.js => 2e7a9059.17e42187.js} (50%) rename assets/js/{2ed6f3e5.1963be6d.js => 2ed6f3e5.7ce7fa5d.js} (51%) delete mode 100644 assets/js/2fec9cb7.379ca2a4.js create mode 100644 assets/js/2fec9cb7.4bc97e56.js rename assets/js/{30ab2121.afe82661.js => 30ab2121.5e0396c2.js} (62%) delete mode 100644 assets/js/312696f8.1f62176d.js create mode 100644 assets/js/312696f8.a017a544.js create mode 100644 assets/js/32773aa2.1c6bd5c3.js delete mode 100644 assets/js/32773aa2.8ee95384.js create mode 100644 assets/js/32956a74.14d57419.js delete mode 100644 assets/js/32956a74.502a8e15.js delete mode 100644 assets/js/33b38546.8edd6905.js create mode 100644 assets/js/33b38546.e191937e.js create mode 100644 assets/js/35b54083.20a1e69b.js delete mode 100644 assets/js/35b54083.d5979de7.js delete mode 100644 assets/js/3777d550.13a3ca30.js create mode 100644 assets/js/3777d550.d2c0d61e.js rename assets/js/{385397a2.8bb89edc.js => 385397a2.a6296923.js} (54%) rename assets/js/{386fece6.0b6a6574.js => 386fece6.092f735d.js} (53%) create mode 100644 assets/js/38900147.30d2af4f.js delete mode 100644 assets/js/38900147.9b2f5f1c.js create mode 100644 assets/js/389ba035.4e81bd6b.js delete mode 100644 assets/js/389ba035.951fd21a.js delete mode 100644 assets/js/3ab8bb90.a84f7ca5.js create mode 100644 assets/js/3ab8bb90.b62d3cca.js delete mode 100644 assets/js/3c3bc024.7d0384fb.js create mode 100644 assets/js/3c3bc024.84151040.js create mode 100644 assets/js/3de1edc5.1527b90a.js delete mode 100644 assets/js/3de1edc5.271177f3.js create mode 100644 assets/js/3f78da0c.546f6f37.js delete mode 100644 assets/js/3f78da0c.f5d61cbf.js create mode 100644 assets/js/3ff7cb20.ce0dcfda.js delete mode 100644 assets/js/3ff7cb20.d303ba5e.js delete mode 100644 assets/js/40870e5b.d9050fb9.js create mode 100644 assets/js/40870e5b.fd31b514.js delete mode 100644 assets/js/426f7ee9.32946274.js create mode 100644 assets/js/426f7ee9.9dee291a.js create mode 100644 assets/js/42dede29.3498f3da.js delete mode 100644 assets/js/42dede29.a76fdbec.js create mode 100644 assets/js/434d80d9.9b3696cc.js delete mode 100644 assets/js/434d80d9.daa91dd9.js create mode 100644 assets/js/44a7a3de.11cacf55.js delete mode 100644 assets/js/44a7a3de.275109cb.js delete mode 100644 assets/js/44ecec25.8162efd8.js create mode 100644 assets/js/44ecec25.e74a971f.js delete mode 100644 assets/js/4559f654.c457d849.js create mode 100644 assets/js/4559f654.f8b6f069.js delete mode 100644 assets/js/462b352b.e82a1cb3.js create mode 100644 assets/js/462b352b.f462ffde.js create mode 100644 assets/js/47943cb5.c0e6220e.js delete mode 100644 assets/js/47943cb5.c3bc9807.js rename assets/js/{486b02f9.e4a58489.js => 486b02f9.bb440204.js} (53%) delete mode 100644 assets/js/48c1907d.3c597648.js create mode 100644 assets/js/48c1907d.42daa2af.js rename assets/js/{4969cfcb.1845e166.js => 4969cfcb.dc5c37da.js} (65%) rename assets/js/{4ab041ea.5744d7e7.js => 4ab041ea.eec883a9.js} (82%) rename assets/js/{4b36b697.24dd0190.js => 4b36b697.34256134.js} (64%) rename assets/js/{4bcd6c5f.e4f525d7.js => 4bcd6c5f.f3907997.js} (58%) create mode 100644 assets/js/4c24e21f.27837737.js delete mode 100644 assets/js/4c24e21f.2b7e3efb.js create mode 100644 assets/js/4c493feb.654a91d4.js delete mode 100644 assets/js/4c493feb.f803f261.js rename assets/js/{4e2c8581.75557d41.js => 4e2c8581.5cff4508.js} (65%) delete mode 100644 assets/js/4e363eb9.b26c531f.js create mode 100644 assets/js/4e363eb9.f325c951.js create mode 100644 assets/js/4e8f51cf.035f5435.js delete mode 100644 assets/js/4e8f51cf.65a4d96e.js create mode 100644 assets/js/4f047c6d.ce4299f9.js delete mode 100644 assets/js/4f047c6d.ea484907.js rename assets/js/{500b21de.1c392b82.js => 500b21de.f39b00f1.js} (72%) create mode 100644 assets/js/5080e45a.19e842cf.js delete mode 100644 assets/js/5080e45a.86958deb.js delete mode 100644 assets/js/50dd0c7d.05190e23.js create mode 100644 assets/js/50dd0c7d.fde4efc6.js delete mode 100644 assets/js/50dd26bc.12228cc7.js create mode 100644 assets/js/50dd26bc.3e76f5ad.js create mode 100644 assets/js/5112681f.30df3157.js delete mode 100644 assets/js/5112681f.981f3443.js create mode 100644 assets/js/5207b198.258d7282.js delete mode 100644 assets/js/5207b198.e4f0175c.js delete mode 100644 assets/js/530384b4.14cc70cb.js create mode 100644 assets/js/530384b4.509f1f7b.js rename assets/js/{5353a7a1.807a83d8.js => 5353a7a1.acf7247a.js} (56%) rename assets/js/{563e94c0.b0a2f6fc.js => 563e94c0.b3f13273.js} (53%) delete mode 100644 assets/js/5849eb93.348d5665.js create mode 100644 assets/js/5849eb93.4cbf0ec0.js create mode 100644 assets/js/588e0fb2.5121320c.js delete mode 100644 assets/js/588e0fb2.e73f62cf.js delete mode 100644 assets/js/59cd1056.a387685a.js create mode 100644 assets/js/59cd1056.b873aae5.js create mode 100644 assets/js/59edad29.7daf6025.js delete mode 100644 assets/js/59edad29.b738aae0.js delete mode 100644 assets/js/5a0745f3.8b86feb2.js create mode 100644 assets/js/5a0745f3.bb5a50b1.js rename assets/js/{5a9b41ac.fa2f5aa4.js => 5a9b41ac.09bbdc9a.js} (50%) create mode 100644 assets/js/5b1b6e2c.99ece6ed.js delete mode 100644 assets/js/5b1b6e2c.9dc9d453.js delete mode 100644 assets/js/5b317457.ac8a23b2.js create mode 100644 assets/js/5b317457.acf5a882.js create mode 100644 assets/js/5bd88873.4375957b.js delete mode 100644 assets/js/5bd88873.ac783374.js create mode 100644 assets/js/5cbd74ee.15b2e02b.js delete mode 100644 assets/js/5cbd74ee.fba2c4b5.js delete mode 100644 assets/js/5d01e53a.0665130a.js create mode 100644 assets/js/5d01e53a.e38e21f2.js delete mode 100644 assets/js/5d07f957.5de78b3d.js create mode 100644 assets/js/5d07f957.9a2b83a9.js create mode 100644 assets/js/5d5d02b0.46d9fecf.js delete mode 100644 assets/js/5d5d02b0.8dbc39cf.js create mode 100644 assets/js/5d71f5cd.1d61dcf9.js delete mode 100644 assets/js/5d71f5cd.fffe957a.js rename assets/js/{5de204ea.89c5ae44.js => 5de204ea.2898ab31.js} (54%) delete mode 100644 assets/js/5f7776bb.c301a574.js create mode 100644 assets/js/5f7776bb.f8a6a15e.js delete mode 100644 assets/js/5f9bf2e5.86e1ead6.js create mode 100644 assets/js/5f9bf2e5.9618bbcb.js delete mode 100644 assets/js/60cfcd23.2f992f85.js create mode 100644 assets/js/60cfcd23.7c2398c8.js create mode 100644 assets/js/6145b3f7.d30adfd8.js delete mode 100644 assets/js/6145b3f7.ea8dc753.js delete mode 100644 assets/js/61f95e53.5954a63b.js create mode 100644 assets/js/61f95e53.915b50b7.js delete mode 100644 assets/js/62fad4c6.5366a0a7.js create mode 100644 assets/js/62fad4c6.c826fbdd.js create mode 100644 assets/js/64d48972.379e0dc7.js delete mode 100644 assets/js/64d48972.ad91f1ad.js rename assets/js/{6609e39c.96b388c1.js => 6609e39c.80d94871.js} (51%) create mode 100644 assets/js/66880af1.4d9c1453.js delete mode 100644 assets/js/66880af1.7abdeeba.js delete mode 100644 assets/js/66add7b5.79b514ea.js create mode 100644 assets/js/66add7b5.8c7bc2be.js create mode 100644 assets/js/68966825.36ce7642.js delete mode 100644 assets/js/68966825.921ddbb7.js create mode 100644 assets/js/6a5caa1d.3ca38124.js delete mode 100644 assets/js/6a5caa1d.d20023dc.js create mode 100644 assets/js/6b2b9057.76e77f82.js delete mode 100644 assets/js/6b2b9057.81d9e7c2.js create mode 100644 assets/js/6b830420.6adaf4a0.js delete mode 100644 assets/js/6b830420.dee41f7c.js rename assets/js/{6c13589d.f196275e.js => 6c13589d.b05a3592.js} (51%) create mode 100644 assets/js/6dc132fb.6044aa53.js delete mode 100644 assets/js/6dc132fb.85de332e.js delete mode 100644 assets/js/6fb6dfc9.70fe88bd.js create mode 100644 assets/js/6fb6dfc9.b1266252.js delete mode 100644 assets/js/70fd01e9.2e4d3f4c.js create mode 100644 assets/js/70fd01e9.5c5bd58c.js rename assets/js/{725d07b1.5197ba8f.js => 725d07b1.f484fcea.js} (51%) delete mode 100644 assets/js/72b4a38a.9c82468f.js create mode 100644 assets/js/72b4a38a.f5e5db44.js delete mode 100644 assets/js/73743333.881b46c2.js create mode 100644 assets/js/73743333.a6cb08b1.js create mode 100644 assets/js/74aaa9a4.0c340cc6.js delete mode 100644 assets/js/74aaa9a4.48e191b2.js rename assets/js/{74fcf2e7.404d89f0.js => 74fcf2e7.10d4c088.js} (51%) create mode 100644 assets/js/75071e09.4cbcf657.js delete mode 100644 assets/js/75071e09.b3920acf.js delete mode 100644 assets/js/75b6673c.69b623ea.js create mode 100644 assets/js/75b6673c.af8ec448.js rename assets/js/{75ecccc2.9515e54d.js => 75ecccc2.f8d9a328.js} (53%) delete mode 100644 assets/js/76129d61.0fbc5b39.js create mode 100644 assets/js/76129d61.55da8d5b.js create mode 100644 assets/js/772d0280.19b7c1dd.js delete mode 100644 assets/js/772d0280.64b9a2f7.js delete mode 100644 assets/js/77c6b439.64e42f0f.js create mode 100644 assets/js/77c6b439.b917d45b.js delete mode 100644 assets/js/77cf6619.682c6b07.js create mode 100644 assets/js/77cf6619.d9ed76ca.js delete mode 100644 assets/js/79507ce0.00c9bdc8.js create mode 100644 assets/js/79507ce0.1fbd4fe6.js rename assets/js/{7a493ae1.74a76dca.js => 7a493ae1.b805c274.js} (52%) rename assets/js/{7b7347a8.6b8a043b.js => 7b7347a8.e9109b80.js} (56%) delete mode 100644 assets/js/7c47ad75.4749175e.js create mode 100644 assets/js/7c47ad75.ad260db1.js rename assets/js/{7d99d243.54012244.js => 7d99d243.d6656fe6.js} (85%) delete mode 100644 assets/js/7dad11d2.dad942d9.js create mode 100644 assets/js/7dad11d2.fef3060c.js create mode 100644 assets/js/7de5ceea.5445c664.js delete mode 100644 assets/js/7de5ceea.b2af9ad9.js create mode 100644 assets/js/81f06d1d.223390d8.js delete mode 100644 assets/js/81f06d1d.60bcd9fe.js rename assets/js/{83a718dd.0adb0e64.js => 83a718dd.2ec37ad9.js} (58%) delete mode 100644 assets/js/84d0485c.8bd39c4b.js create mode 100644 assets/js/84d0485c.9ebc7e60.js delete mode 100644 assets/js/84d7eb88.0b23a5c2.js create mode 100644 assets/js/84d7eb88.8354a109.js create mode 100644 assets/js/84e0516e.4464f876.js delete mode 100644 assets/js/84e0516e.6228a083.js delete mode 100644 assets/js/86470930.36c5dffa.js create mode 100644 assets/js/86470930.54135190.js delete mode 100644 assets/js/86b70772.08e3b047.js create mode 100644 assets/js/86b70772.c1e63193.js delete mode 100644 assets/js/8892d5ac.86e54523.js create mode 100644 assets/js/8892d5ac.9ea5ed3b.js rename assets/js/{891a814b.a7aa745a.js => 891a814b.de2a1f1e.js} (50%) delete mode 100644 assets/js/891ff042.ce730ce0.js create mode 100644 assets/js/891ff042.f1877020.js create mode 100644 assets/js/8953171e.1bc88db1.js delete mode 100644 assets/js/8953171e.a6a9cbaf.js create mode 100644 assets/js/8af73e9a.64f55652.js delete mode 100644 assets/js/8af73e9a.e866ca18.js create mode 100644 assets/js/8b16a1f6.b2db6316.js delete mode 100644 assets/js/8b16a1f6.c902b5e1.js delete mode 100644 assets/js/8b66fb2a.570bd90e.js create mode 100644 assets/js/8b66fb2a.c2a7076e.js rename assets/js/{8c906d29.e6affb24.js => 8c906d29.479eb620.js} (81%) create mode 100644 assets/js/8cadf11f.0432a380.js delete mode 100644 assets/js/8cadf11f.0d5f1f3d.js rename assets/js/{8cc3f780.fe64d87c.js => 8cc3f780.3792f34a.js} (59%) delete mode 100644 assets/js/8dc01f00.4350e041.js create mode 100644 assets/js/8dc01f00.7181f8a5.js create mode 100644 assets/js/8e8efec7.58572336.js delete mode 100644 assets/js/8e8efec7.dc28db82.js create mode 100644 assets/js/8ed9d5b5.8d7dd474.js delete mode 100644 assets/js/8ed9d5b5.d4f98026.js create mode 100644 assets/js/8fcded8c.8eb56230.js delete mode 100644 assets/js/8fcded8c.b2a5625d.js rename assets/js/{90c4e188.5499a4f1.js => 90c4e188.08e509b3.js} (51%) delete mode 100644 assets/js/914bff86.0ff03e69.js create mode 100644 assets/js/914bff86.64064a50.js delete mode 100644 assets/js/9218050e.a11620aa.js create mode 100644 assets/js/9218050e.aa0e81f8.js create mode 100644 assets/js/926125d1.1f30f9d3.js delete mode 100644 assets/js/926125d1.6aa425a8.js rename assets/js/{9333a297.255e30a6.js => 9333a297.30a3ec3c.js} (57%) create mode 100644 assets/js/9437cc2c.c3c3a0d2.js delete mode 100644 assets/js/9437cc2c.ca1a1f53.js rename assets/js/{974b9b1f.3ab3fae7.js => 974b9b1f.0b4a5b97.js} (54%) create mode 100644 assets/js/977fdfc4.020c4ba0.js delete mode 100644 assets/js/977fdfc4.859a2a9a.js create mode 100644 assets/js/97cb7c6f.2185af50.js delete mode 100644 assets/js/97cb7c6f.dd8c1393.js create mode 100644 assets/js/97d4b178.12592fa3.js delete mode 100644 assets/js/97d4b178.28fad91d.js create mode 100644 assets/js/98c2782f.61de7134.js delete mode 100644 assets/js/98c2782f.a19bf2ce.js rename assets/js/{992984a1.ceaf33a6.js => 992984a1.02a7186d.js} (54%) create mode 100644 assets/js/99c9a9f3.90422214.js delete mode 100644 assets/js/99c9a9f3.b1aedf2f.js rename assets/js/{9a8d2f85.580daa71.js => 9a8d2f85.6d07595b.js} (83%) delete mode 100644 assets/js/9aa67784.0d83ccfd.js create mode 100644 assets/js/9aa67784.c7446483.js create mode 100644 assets/js/9abd7762.1509a21c.js delete mode 100644 assets/js/9abd7762.dae98762.js create mode 100644 assets/js/9b7cb8f9.8a3f1b13.js delete mode 100644 assets/js/9b7cb8f9.aaa4f137.js create mode 100644 assets/js/9beb799b.b2b00fd2.js delete mode 100644 assets/js/9beb799b.f02903a4.js create mode 100644 assets/js/9bfd3055.16d500d1.js delete mode 100644 assets/js/9bfd3055.f9d9c90c.js delete mode 100644 assets/js/9d46269e.14524253.js create mode 100644 assets/js/9d46269e.15887a17.js delete mode 100644 assets/js/9e3571d8.4c2b1e30.js create mode 100644 assets/js/9e3571d8.5da745d6.js create mode 100644 assets/js/9edb4516.add35d2f.js delete mode 100644 assets/js/9edb4516.e67e8686.js create mode 100644 assets/js/9f069a65.8014090f.js delete mode 100644 assets/js/9f069a65.cd32031e.js rename assets/js/{9f0c4bd9.fc5837ef.js => 9f0c4bd9.5d0af657.js} (56%) delete mode 100644 assets/js/a08f9b67.6358c955.js create mode 100644 assets/js/a08f9b67.a413e8c6.js delete mode 100644 assets/js/a0ca06fd.442ef2f5.js create mode 100644 assets/js/a0ca06fd.7662ee3d.js delete mode 100644 assets/js/a104d7e6.45f528cc.js create mode 100644 assets/js/a104d7e6.5c0b558b.js delete mode 100644 assets/js/a121ee0b.1e882ad3.js create mode 100644 assets/js/a121ee0b.7047d8dc.js create mode 100644 assets/js/a28f322c.12c6f0b8.js delete mode 100644 assets/js/a28f322c.a1e5c3f8.js delete mode 100644 assets/js/a2e57478.24d50fe6.js create mode 100644 assets/js/a2e57478.ea1a93b5.js create mode 100644 assets/js/a3522fac.18e9a347.js delete mode 100644 assets/js/a3522fac.69c8cc5a.js delete mode 100644 assets/js/a3e670f9.da664c98.js create mode 100644 assets/js/a3e670f9.f9e02389.js delete mode 100644 assets/js/a61b46cc.60ee14bb.js create mode 100644 assets/js/a61b46cc.a0cda03b.js create mode 100644 assets/js/a6996c29.227566bd.js delete mode 100644 assets/js/a6996c29.8a862112.js delete mode 100644 assets/js/a8efa3a6.37e7878c.js create mode 100644 assets/js/a8efa3a6.adf8fbfd.js rename assets/js/{a8fa00b4.f3fdcbf2.js => a8fa00b4.02a7cc6f.js} (52%) create mode 100644 assets/js/a932aaa1.0003ecd5.js delete mode 100644 assets/js/a932aaa1.34a3a6e8.js create mode 100644 assets/js/a93b393b.27db29b6.js delete mode 100644 assets/js/a93b393b.e801a22b.js create mode 100644 assets/js/a9c8d21a.5730115f.js delete mode 100644 assets/js/a9c8d21a.917f5173.js create mode 100644 assets/js/abc4e0a8.0265feac.js delete mode 100644 assets/js/abc4e0a8.f41be974.js rename assets/js/{ac6eab16.4263d3ab.js => ac6eab16.3499020a.js} (55%) delete mode 100644 assets/js/acb8ea0c.6bdeb423.js create mode 100644 assets/js/acb8ea0c.84aa6e61.js delete mode 100644 assets/js/b57a4a2d.56b941fa.js create mode 100644 assets/js/b57a4a2d.db2ba8b0.js rename assets/js/{b62a942b.94d65b8e.js => b62a942b.283f5e5c.js} (56%) rename assets/js/{b72e870b.b0818aeb.js => b72e870b.f840b411.js} (53%) create mode 100644 assets/js/b8f8e7bf.4e4dfc0d.js delete mode 100644 assets/js/b8f8e7bf.dbffdb30.js delete mode 100644 assets/js/b934881b.8479e883.js create mode 100644 assets/js/b934881b.a099556d.js rename assets/js/{b9aad1dc.be1a308a.js => b9aad1dc.2dee3bfb.js} (62%) create mode 100644 assets/js/b9b61d04.8d3b8115.js delete mode 100644 assets/js/b9b61d04.8db21dcd.js create mode 100644 assets/js/baa12f70.015fb44d.js delete mode 100644 assets/js/baa12f70.4258b9b2.js create mode 100644 assets/js/bae34ec2.12294e92.js delete mode 100644 assets/js/bae34ec2.c5b53470.js create mode 100644 assets/js/bbb94644.86d079f1.js delete mode 100644 assets/js/bbb94644.96817887.js rename assets/js/{bc5f1a80.26e6b53e.js => bc5f1a80.bfe53943.js} (50%) rename assets/js/{bcb97d3a.6c1fa7b3.js => bcb97d3a.1a45de23.js} (52%) delete mode 100644 assets/js/bcd317c5.26419d17.js create mode 100644 assets/js/bcd317c5.d2f0c1b7.js rename assets/js/{bd8a8750.ef84805c.js => bd8a8750.e897ea28.js} (79%) delete mode 100644 assets/js/befc1215.8ccc048a.js create mode 100644 assets/js/befc1215.8e7340ee.js delete mode 100644 assets/js/bffab106.0b259a05.js create mode 100644 assets/js/bffab106.a3eadc7f.js create mode 100644 assets/js/c02a675f.48b63c0a.js delete mode 100644 assets/js/c02a675f.e722c66a.js create mode 100644 assets/js/c09b0fe7.5e5f6711.js delete mode 100644 assets/js/c09b0fe7.b7002711.js delete mode 100644 assets/js/c1bf8f22.9f9467fb.js create mode 100644 assets/js/c1bf8f22.b1c3cbce.js delete mode 100644 assets/js/c1ddaab4.0c684afa.js create mode 100644 assets/js/c1ddaab4.fd25e463.js create mode 100644 assets/js/c3289e2b.1269f85c.js delete mode 100644 assets/js/c3289e2b.9a6b37cc.js delete mode 100644 assets/js/c3570998.03ff44e5.js create mode 100644 assets/js/c3570998.3c700b8c.js create mode 100644 assets/js/c3d74b12.947e859a.js delete mode 100644 assets/js/c3d74b12.fceaefaa.js rename assets/js/{c4ff0a86.1ecf8fd3.js => c4ff0a86.1924faf9.js} (54%) delete mode 100644 assets/js/c5353c60.6a970d87.js create mode 100644 assets/js/c5353c60.8eab6d98.js rename assets/js/{c61f38e7.c1e5d186.js => c61f38e7.b2d9e077.js} (54%) delete mode 100644 assets/js/c6834bbf.3ffadd29.js create mode 100644 assets/js/c6834bbf.eb4dba57.js delete mode 100644 assets/js/c6c2c73a.2d4e6873.js create mode 100644 assets/js/c6c2c73a.7ac6213d.js delete mode 100644 assets/js/c7fa01e5.7af0056d.js create mode 100644 assets/js/c7fa01e5.7caa0d33.js create mode 100644 assets/js/c89433e3.1f981f18.js delete mode 100644 assets/js/c89433e3.7aa27d5a.js rename assets/js/{c89804bb.c65aabdc.js => c89804bb.7cf91a3f.js} (57%) create mode 100644 assets/js/c9777963.5ba749f7.js delete mode 100644 assets/js/c9777963.7e80098d.js delete mode 100644 assets/js/ca110a3e.8c10aa50.js create mode 100644 assets/js/ca110a3e.a1c26b21.js create mode 100644 assets/js/cae059c7.41f1107d.js delete mode 100644 assets/js/cae059c7.9a3294b2.js rename assets/js/{cbd4dc33.9e38ea9e.js => cbd4dc33.1d5c2b1e.js} (51%) create mode 100644 assets/js/cc1bc459.3169c291.js delete mode 100644 assets/js/cc1bc459.fd1982bd.js create mode 100644 assets/js/cc91f96a.54c6a58a.js delete mode 100644 assets/js/cc91f96a.5ae33ec2.js rename assets/js/{cd9e621c.c5f6b1df.js => cd9e621c.8bb18043.js} (54%) create mode 100644 assets/js/ce316b05.01be9a2c.js delete mode 100644 assets/js/ce316b05.1e3c7ad4.js create mode 100644 assets/js/d037b23d.189944c3.js delete mode 100644 assets/js/d037b23d.a66e20ea.js delete mode 100644 assets/js/d08bdbd3.10a63872.js create mode 100644 assets/js/d08bdbd3.669c653a.js create mode 100644 assets/js/d268f61a.63f2b8af.js delete mode 100644 assets/js/d268f61a.c7364271.js create mode 100644 assets/js/d33f5cb2.3b3f47c1.js delete mode 100644 assets/js/d33f5cb2.624ddb03.js rename assets/js/{d3d0d205.6dafa386.js => d3d0d205.d80208a3.js} (51%) create mode 100644 assets/js/d4850a38.039adaf2.js delete mode 100644 assets/js/d4850a38.117e9e2e.js create mode 100644 assets/js/d5099334.aabe751f.js delete mode 100644 assets/js/d5099334.ac38b340.js delete mode 100644 assets/js/d5b05897.41fb008f.js create mode 100644 assets/js/d5b05897.b930149e.js create mode 100644 assets/js/d622cb4f.06b809a3.js delete mode 100644 assets/js/d622cb4f.fcbc5b14.js rename assets/js/{d64f1887.84b17165.js => d64f1887.8de6e388.js} (83%) delete mode 100644 assets/js/d76a14be.6a141c62.js create mode 100644 assets/js/d76a14be.8e1306fd.js rename assets/js/{d82a2a7b.82200028.js => d82a2a7b.bb6e1f92.js} (82%) delete mode 100644 assets/js/d889ad2d.1171bb5a.js create mode 100644 assets/js/d889ad2d.1f7d09b5.js rename assets/js/{d8f7b805.ca96f4f9.js => d8f7b805.37f5ed3d.js} (57%) create mode 100644 assets/js/d9d9f449.854e9d59.js delete mode 100644 assets/js/d9d9f449.db80164e.js rename assets/js/{daa78d60.ba90eba3.js => daa78d60.2b50f61c.js} (61%) rename assets/js/{db343463.4fdd00a2.js => db343463.8ca2a907.js} (53%) create mode 100644 assets/js/db719915.ea11932d.js delete mode 100644 assets/js/db719915.fa9b8b30.js delete mode 100644 assets/js/de5e0098.84a7cfaa.js create mode 100644 assets/js/de5e0098.bb9b7fba.js create mode 100644 assets/js/de7874bb.2fabde79.js delete mode 100644 assets/js/de7874bb.8984941a.js rename assets/js/{e08a2305.b272811d.js => e08a2305.51f3299b.js} (83%) create mode 100644 assets/js/e0d4068f.079fd85a.js delete mode 100644 assets/js/e0d4068f.5a1b5eaa.js delete mode 100644 assets/js/e14874ff.b3f06a1c.js create mode 100644 assets/js/e14874ff.c571c778.js create mode 100644 assets/js/e1b9f8c7.82bd3d24.js delete mode 100644 assets/js/e1b9f8c7.890bb2d6.js rename assets/js/{e1c24df0.5dc84bae.js => e1c24df0.9cbd257d.js} (54%) delete mode 100644 assets/js/e31dd6e1.a71cef1b.js create mode 100644 assets/js/e31dd6e1.f180556b.js delete mode 100644 assets/js/e3966691.b0802950.js create mode 100644 assets/js/e3966691.daa202c5.js create mode 100644 assets/js/e4f1eb77.dbe0b5ca.js delete mode 100644 assets/js/e4f1eb77.e6514259.js rename assets/js/{e5474da6.6e0a0db1.js => e5474da6.3cbbe942.js} (50%) create mode 100644 assets/js/e5601569.6499cac4.js delete mode 100644 assets/js/e5601569.d299888b.js delete mode 100644 assets/js/e7791cad.12fbf57a.js create mode 100644 assets/js/e7791cad.cd201f42.js delete mode 100644 assets/js/e803704a.519838ad.js create mode 100644 assets/js/e803704a.9ab4b3c3.js create mode 100644 assets/js/e82e5e58.85ec3add.js delete mode 100644 assets/js/e82e5e58.d14836ef.js delete mode 100644 assets/js/e86c9445.6f7a9de5.js create mode 100644 assets/js/e86c9445.89363706.js rename assets/js/{e8d372a7.a591a1f2.js => e8d372a7.3be01d80.js} (54%) delete mode 100644 assets/js/ec5071fd.1f58f84c.js create mode 100644 assets/js/ec5071fd.27ec8539.js create mode 100644 assets/js/ed44aa5e.1aec9ae5.js delete mode 100644 assets/js/ed44aa5e.c9cfe6ea.js rename assets/js/{ee6d0512.6863f847.js => ee6d0512.f0855176.js} (82%) create mode 100644 assets/js/f0c48f07.34e650bc.js delete mode 100644 assets/js/f0c48f07.c7c9d3c6.js delete mode 100644 assets/js/f158ec46.0220f71a.js create mode 100644 assets/js/f158ec46.6156892f.js rename assets/js/{f2140f39.aea0316d.js => f2140f39.2036c39d.js} (70%) create mode 100644 assets/js/f293b4fc.55c985c1.js delete mode 100644 assets/js/f293b4fc.bbc711c1.js rename assets/js/{f3facea8.ae53abab.js => f3facea8.2cf09d7b.js} (50%) create mode 100644 assets/js/f4dc87f8.2ceeae98.js delete mode 100644 assets/js/f4dc87f8.6783e1d2.js create mode 100644 assets/js/f72402e6.4a6909ca.js delete mode 100644 assets/js/f72402e6.ac257c96.js rename assets/js/{f7cb8cb3.d23819bc.js => f7cb8cb3.d4399452.js} (56%) create mode 100644 assets/js/f7f2164e.72299f2a.js delete mode 100644 assets/js/f7f2164e.c81197c7.js create mode 100644 assets/js/f8e6c3d7.4bbd2653.js delete mode 100644 assets/js/f8e6c3d7.fe66a94a.js delete mode 100644 assets/js/faf6f2db.401c99df.js create mode 100644 assets/js/faf6f2db.bae87dc3.js delete mode 100644 assets/js/fb3f88b1.bfb726f8.js create mode 100644 assets/js/fb3f88b1.fea87c31.js delete mode 100644 assets/js/fb634d25.27100a36.js create mode 100644 assets/js/fb634d25.bd5a7df9.js delete mode 100644 assets/js/fd1fdd14.b6d76bd7.js create mode 100644 assets/js/fd1fdd14.f3f7fdc6.js rename assets/js/{fd8fca12.d31b2cf4.js => fd8fca12.a37baf25.js} (50%) create mode 100644 assets/js/ff1602b7.3e795999.js delete mode 100644 assets/js/ff1602b7.e9c1b048.js rename assets/js/{main.5fb7170a.js => main.195c2ab4.js} (99%) rename assets/js/{main.5fb7170a.js.LICENSE.txt => main.195c2ab4.js.LICENSE.txt} (100%) rename assets/js/{runtime~main.fd8f2c37.js => runtime~main.3b125a4d.js} (61%) diff --git a/404.html b/404.html index 711aa479412..b6a6ae7c132 100644 --- a/404.html +++ b/404.html @@ -13,13 +13,13 @@ - - + +
Skip to main content

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

- - + + \ No newline at end of file diff --git a/assets/js/01439c8e.73089375.js b/assets/js/01439c8e.73089375.js deleted file mode 100644 index 375b26f2140..00000000000 --- a/assets/js/01439c8e.73089375.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6504],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=l(n),m=o,f=d["".concat(c,".").concat(m)]||d[m]||p[m]||a;return n?r.createElement(f,i(i({ref:t},u),{},{components:n})):r.createElement(f,i({ref:t},u))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>p,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={},i="Kusion Commands",s={unversionedId:"reference/commands/index",id:"version-v0.10/reference/commands/index",title:"Kusion Commands",description:"Kusion is the Platform Orchestrator of KusionStack",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/index.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/",permalink:"/docs/v0.10/reference/commands/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/index.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Using Cloud Secrets Manager",permalink:"/docs/v0.10/user-guides/secrets-management/using-cloud-secrets"},next:{title:"kusion apply",permalink:"/docs/v0.10/reference/commands/kusion-apply"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],u={toc:l};function p(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-commands"},"Kusion Commands"),(0,o.kt)("p",null,"Kusion is the Platform Orchestrator of KusionStack"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"As a Platform Orchestrator, Kusion delivers user intentions to Kubernetes, Clouds and On-Premise resources. Also enables asynchronous cooperation between the development and the platform team and drives the separation of concerns."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion [flags]\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' -h, --help help for kusion\n --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-apply"},"kusion apply"),"\t - Apply the operational intent of various resources to multiple runtimes"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-build"},"kusion build"),"\t - Build Kusion modules in a Stack to the Intent"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-compile"},"kusion compile"),"\t - Deprecated: Use 'kusion build' to generate the Intent instead"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-destroy"},"kusion destroy"),"\t - Destroy resources within the stack."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-init"},"kusion init"),"\t - Initialize the scaffolding for a project"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-preview"},"kusion preview"),"\t - Preview a series of resource changes within the stack"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-version"},"kusion version"),"\t - Print the Kusion version information for the current context"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/01439c8e.823a3d9e.js b/assets/js/01439c8e.823a3d9e.js new file mode 100644 index 00000000000..004035237e7 --- /dev/null +++ b/assets/js/01439c8e.823a3d9e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6504],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},u=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=l(n),m=o,f=d["".concat(c,".").concat(m)]||d[m]||p[m]||a;return n?r.createElement(f,s(s({ref:t},u),{},{components:n})):r.createElement(f,s({ref:t},u))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>p,frontMatter:()=>a,metadata:()=>i,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={},s="Kusion Commands",i={unversionedId:"reference/commands/index",id:"version-v0.10/reference/commands/index",title:"Kusion Commands",description:"Kusion is the Platform Orchestrator of KusionStack",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/index.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/",permalink:"/docs/v0.10/reference/commands/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/index.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Using Cloud Secrets Manager",permalink:"/docs/v0.10/user-guides/secrets-management/using-cloud-secrets"},next:{title:"kusion apply",permalink:"/docs/v0.10/reference/commands/kusion-apply"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],u={toc:l};function p(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-commands"},"Kusion Commands"),(0,o.kt)("p",null,"Kusion is the Platform Orchestrator of KusionStack"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"As a Platform Orchestrator, Kusion delivers user intentions to Kubernetes, Clouds and On-Premise resources. Also enables asynchronous cooperation between the development and the platform team and drives the separation of concerns."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion [flags]\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' -h, --help help for kusion\n --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-apply"},"kusion apply"),"\t - Apply the operational intent of various resources to multiple runtimes"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-build"},"kusion build"),"\t - Build Kusion modules in a Stack to the Intent"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-compile"},"kusion compile"),"\t - Deprecated: Use 'kusion build' to generate the Intent instead"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-destroy"},"kusion destroy"),"\t - Destroy resources within the stack."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-init"},"kusion init"),"\t - Initialize the scaffolding for a project"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-preview"},"kusion preview"),"\t - Preview a series of resource changes within the stack"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-version"},"kusion version"),"\t - Print the Kusion version information for the current context"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/030b8d03.1cd548fa.js b/assets/js/030b8d03.1cd548fa.js new file mode 100644 index 00000000000..fc501d256e3 --- /dev/null +++ b/assets/js/030b8d03.1cd548fa.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5822],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(n),m=a,k=d["".concat(c,".").concat(m)]||d[m]||u[m]||o;return n?r.createElement(k,s(s({ref:t},p),{},{components:n})):r.createElement(k,s({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const o={id:"secret"},s="Secrets",i={unversionedId:"configuration-walkthrough/secret",id:"version-v0.11/configuration-walkthrough/secret",title:"Secrets",description:"Secrets are used to store sensitive data like passwords, API keys, TLS certificates, tokens, or other credentials. Kusion provides multiple secret types, and makes it easy to be consumed in containers.",source:"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/7-secret.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/secret",permalink:"/docs/configuration-walkthrough/secret",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/7-secret.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:7,frontMatter:{id:"secret"},sidebar:"kusion",previous:{title:"Managed Databases",permalink:"/docs/configuration-walkthrough/databse"},next:{title:"Application Monitoring",permalink:"/docs/configuration-walkthrough/monitoring"}},c={},l=[{value:"Using secrets in workload",id:"using-secrets-in-workload",level:2},{value:"Consume secret in an environment variable",id:"consume-secret-in-an-environment-variable",level:3},{value:"Consume all secret keys as environment variables",id:"consume-all-secret-keys-as-environment-variables",level:3},{value:"Types of secrets",id:"types-of-secrets",level:2},{value:"Basic secrets",id:"basic-secrets",level:3},{value:"Token secrets",id:"token-secrets",level:3},{value:"Opaque secrets",id:"opaque-secrets",level:3},{value:"Certificate secrets",id:"certificate-secrets",level:3},{value:"External secrets",id:"external-secrets",level:3},{value:"Immutable secrets",id:"immutable-secrets",level:2}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"secrets"},"Secrets"),(0,a.kt)("p",null,"Secrets are used to store sensitive data like passwords, API keys, TLS certificates, tokens, or other credentials. Kusion provides multiple secret types, and makes it easy to be consumed in containers."),(0,a.kt)("p",null,"For application dependent cloud resources that are managed by Kusion, their credentials are automatically managed by Kusion (generated and injected into application runtime environment variable). You shouldn't have to manually create those."),(0,a.kt)("h2",{id:"using-secrets-in-workload"},"Using secrets in workload"),(0,a.kt)("p",null,"Secrets must be defined in AppConfiguration. The values can be generated by Kusion or reference existing secrets stored in third-party vault. Secrets can be consumed in containers by referencing them through the ",(0,a.kt)("inlineCode",{parentName:"p"},"secret:///")," URI syntax."),(0,a.kt)("h3",{id:"consume-secret-in-an-environment-variable"},"Consume secret in an environment variable"),(0,a.kt)("p",null,"You can consume the data in Secrets as environment variable in your container. For example the db container uses an environment variable to set the root password."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport kam.v1.workload.secret as sec\n\nsampledb: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "db": c.Container {\n image: "mysql"\n env: {\n # Consume db-root-password secret in environment\n "ROOT_PASSWORD": "secret://db-root-password/token"\n }\n }\n }\n # Secrets used to generate token\n secrets: {\n "init-info": sec.Secret {\n type: "token"\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"The example shows the secret ",(0,a.kt)("inlineCode",{parentName:"p"},"root-password")," being consumed as an environment variable in the db container. The secret is of type token and will automatically be generated at runtime by Kusion."),(0,a.kt)("h3",{id:"consume-all-secret-keys-as-environment-variables"},"Consume all secret keys as environment variables"),(0,a.kt)("p",null,"Sometimes your secret contains multiple data that need to be consumed as environment variables. The example below shows how to consume all the values in a secret as environment variables named after the keys."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport kam.v1.workload.secret as sec\n\nsampledb: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "db": c.Container {\n image: "mysql"\n env: {\n # Consume all init-info secret keys as environment variables\n "secret://init-info": ""\n }\n }\n }\n # Secrets used to init mysql instance\n secrets: {\n "init-info": sec.Secret {\n type: "opaque"\n data: {\n "ROOT_PASSWORD": "admin"\n }\n }\n }\n }\n}\n')),(0,a.kt)("p",null,'This will set the environment variable "ROOT_PASSWORD" to the value "admin" in the db container.'),(0,a.kt)("h2",{id:"types-of-secrets"},"Types of secrets"),(0,a.kt)("p",null,"Kusion provides multiple types of secrets to application developers."),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Basic: Used to generate and/or store usernames and passwords."),(0,a.kt)("li",{parentName:"ol"},"Token: Used to generate and/or store secret strings for password."),(0,a.kt)("li",{parentName:"ol"},"Opaque: A generic secret that can store arbitrary user-defined data."),(0,a.kt)("li",{parentName:"ol"},"Certificate: Used to store a certificate and its associated key that are typically used for TLS."),(0,a.kt)("li",{parentName:"ol"},"External: Used to retrieve secret form third-party vault.")),(0,a.kt)("h3",{id:"basic-secrets"},"Basic secrets"),(0,a.kt)("p",null,'Basic secrets are defined in the secrets block with the type "basic".'),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "auth-info": sec.Secret {\n type: "basic"\n data: {\n "username": "admin"\n "password": "******"\n }\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"The basic secret type is typically used for basic authentication. The key names must be username and password. If one or both of the fields are defined with a non-empty string, those values will be used. If the empty string, the default value, is used Acorn will generate random values for one or both."),(0,a.kt)("h3",{id:"token-secrets"},"Token secrets"),(0,a.kt)("p",null,"Token secrets are useful for generating a password or secure string used for passwords when the user is already known or not required."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "api-token": sec.Secret {\n type: "token"\n data: {\n "token": ""\n }\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"The token secret type must be defined. The ",(0,a.kt)("inlineCode",{parentName:"p"},"token")," field in the data object is optional and if left empty Kusion will generate the token, which is 54 characters in length by default. If the ",(0,a.kt)("inlineCode",{parentName:"p"},"token")," is defined that value will always be used."),(0,a.kt)("h3",{id:"opaque-secrets"},"Opaque secrets"),(0,a.kt)("p",null,"Opaque secrets have no defined structure and can have arbitrary key value pairs. "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "my-secret": sec.Secret {\n type: "opaque"\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"certificate-secrets"},"Certificate secrets"),(0,a.kt)("p",null,"Certificate secrets are useful for storing a certificate and its associated key. One common use for TLS Secrets is to configure encryption in transit for an Ingress, but you can also use it with other resources or directly in your workload."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "server-cert": sec.Secret {\n type: "certificate"\n data: {\n # Please do not put private keys in configuration files\n "tls.crt": "The cert file content"\n "tls.key": "The key file content"\n }\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"external-secrets"},"External secrets"),(0,a.kt)("p",null,"As a general principle, storing secrets in a plain text configuration file is highly discouraged, keeping secrets outside of Git is especially important for future-proofing, even encrypted secrets are not recommended to check into Git. The most common approach is to store secrets in a third-party vault (such as Hashicorp Vault, AWS Secrets Manager and Azure Key Vault, etc) and retrieve the secret in the runtime only. External secrets are used to retrieve sensitive data from external secret store to make it easy to be consumed in containers."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "api-access-token": sec.Secret {\n type: "external"\n data: {\n # Please do not put private keys in configuration files\n "accessToken": "ref://api-auth-info/accessToken?version=1"\n }\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"The value field in data object follow ",(0,a.kt)("inlineCode",{parentName:"p"},"ref://PATH[?version=]")," URI syntax. ",(0,a.kt)("inlineCode",{parentName:"p"},"PATH")," is the provider-specific path for the secret to be retried. Kusion provides out-of-the-box integration with ",(0,a.kt)("inlineCode",{parentName:"p"},"Hashicorp Vault"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"AWS Secrets Manager"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"Azure Key Vault")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"Alicloud Secrets Manager"),"."),(0,a.kt)("h2",{id:"immutable-secrets"},"Immutable secrets"),(0,a.kt)("p",null,"You can also declare a secret as immutable to prevent it from being changed accidentally."),(0,a.kt)("p",null,"To declare a secret as immutable:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "my-secret": sec.Secret {\n # ...\n immutable: True\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"You can change a secret from mutable to immutable but not the other way around. That is because the Kubelet will stop watching secrets that are immutable. As the name suggests, you can only delete and re-create immutable secrets but you cannot change them."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/030b8d03.e8977684.js b/assets/js/030b8d03.e8977684.js deleted file mode 100644 index e803f462b3f..00000000000 --- a/assets/js/030b8d03.e8977684.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5822],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(n),m=a,k=d["".concat(c,".").concat(m)]||d[m]||u[m]||o;return n?r.createElement(k,s(s({ref:t},p),{},{components:n})):r.createElement(k,s({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const o={id:"secret"},s="Secrets",i={unversionedId:"configuration-walkthrough/secret",id:"version-v0.11/configuration-walkthrough/secret",title:"Secrets",description:"Secrets are used to store sensitive data like passwords, API keys, TLS certificates, tokens, or other credentials. Kusion provides multiple secret types, and makes it easy to be consumed in containers.",source:"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/7-secret.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/secret",permalink:"/docs/configuration-walkthrough/secret",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/7-secret.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:7,frontMatter:{id:"secret"},sidebar:"kusion",previous:{title:"Managed Databases",permalink:"/docs/configuration-walkthrough/databse"},next:{title:"Application Monitoring",permalink:"/docs/configuration-walkthrough/monitoring"}},c={},l=[{value:"Using secrets in workload",id:"using-secrets-in-workload",level:2},{value:"Consume secret in an environment variable",id:"consume-secret-in-an-environment-variable",level:3},{value:"Consume all secret keys as environment variables",id:"consume-all-secret-keys-as-environment-variables",level:3},{value:"Types of secrets",id:"types-of-secrets",level:2},{value:"Basic secrets",id:"basic-secrets",level:3},{value:"Token secrets",id:"token-secrets",level:3},{value:"Opaque secrets",id:"opaque-secrets",level:3},{value:"Certificate secrets",id:"certificate-secrets",level:3},{value:"External secrets",id:"external-secrets",level:3},{value:"Immutable secrets",id:"immutable-secrets",level:2}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"secrets"},"Secrets"),(0,a.kt)("p",null,"Secrets are used to store sensitive data like passwords, API keys, TLS certificates, tokens, or other credentials. Kusion provides multiple secret types, and makes it easy to be consumed in containers."),(0,a.kt)("p",null,"For application dependent cloud resources that are managed by Kusion, their credentials are automatically managed by Kusion (generated and injected into application runtime environment variable). You shouldn't have to manually create those."),(0,a.kt)("h2",{id:"using-secrets-in-workload"},"Using secrets in workload"),(0,a.kt)("p",null,"Secrets must be defined in AppConfiguration. The values can be generated by Kusion or reference existing secrets stored in third-party vault. Secrets can be consumed in containers by referencing them through the ",(0,a.kt)("inlineCode",{parentName:"p"},"secret:///")," URI syntax."),(0,a.kt)("h3",{id:"consume-secret-in-an-environment-variable"},"Consume secret in an environment variable"),(0,a.kt)("p",null,"You can consume the data in Secrets as environment variable in your container. For example the db container uses an environment variable to set the root password."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport kam.v1.workload.secret as sec\n\nsampledb: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "db": c.Container {\n image: "mysql"\n env: {\n # Consume db-root-password secret in environment\n "ROOT_PASSWORD": "secret://db-root-password/token"\n }\n }\n }\n # Secrets used to generate token\n secrets: {\n "init-info": sec.Secret {\n type: "token"\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"The example shows the secret ",(0,a.kt)("inlineCode",{parentName:"p"},"root-password")," being consumed as an environment variable in the db container. The secret is of type token and will automatically be generated at runtime by Kusion."),(0,a.kt)("h3",{id:"consume-all-secret-keys-as-environment-variables"},"Consume all secret keys as environment variables"),(0,a.kt)("p",null,"Sometimes your secret contains multiple data that need to be consumed as environment variables. The example below shows how to consume all the values in a secret as environment variables named after the keys."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport kam.v1.workload.secret as sec\n\nsampledb: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "db": c.Container {\n image: "mysql"\n env: {\n # Consume all init-info secret keys as environment variables\n "secret://init-info": ""\n }\n }\n }\n # Secrets used to init mysql instance\n secrets: {\n "init-info": sec.Secret {\n type: "opaque"\n data: {\n "ROOT_PASSWORD": "admin"\n }\n }\n }\n }\n}\n')),(0,a.kt)("p",null,'This will set the environment variable "ROOT_PASSWORD" to the value "admin" in the db container.'),(0,a.kt)("h2",{id:"types-of-secrets"},"Types of secrets"),(0,a.kt)("p",null,"Kusion provides multiple types of secrets to application developers."),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Basic: Used to generate and/or store usernames and passwords."),(0,a.kt)("li",{parentName:"ol"},"Token: Used to generate and/or store secret strings for password."),(0,a.kt)("li",{parentName:"ol"},"Opaque: A generic secret that can store arbitrary user-defined data."),(0,a.kt)("li",{parentName:"ol"},"Certificate: Used to store a certificate and its associated key that are typically used for TLS."),(0,a.kt)("li",{parentName:"ol"},"External: Used to retrieve secret form third-party vault.")),(0,a.kt)("h3",{id:"basic-secrets"},"Basic secrets"),(0,a.kt)("p",null,'Basic secrets are defined in the secrets block with the type "basic".'),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "auth-info": sec.Secret {\n type: "basic"\n data: {\n "username": "admin"\n "password": "******"\n }\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"The basic secret type is typically used for basic authentication. The key names must be username and password. If one or both of the fields are defined with a non-empty string, those values will be used. If the empty string, the default value, is used Acorn will generate random values for one or both."),(0,a.kt)("h3",{id:"token-secrets"},"Token secrets"),(0,a.kt)("p",null,"Token secrets are useful for generating a password or secure string used for passwords when the user is already known or not required."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "api-token": sec.Secret {\n type: "token"\n data: {\n "token": ""\n }\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"The token secret type must be defined. The ",(0,a.kt)("inlineCode",{parentName:"p"},"token")," field in the data object is optional and if left empty Kusion will generate the token, which is 54 characters in length by default. If the ",(0,a.kt)("inlineCode",{parentName:"p"},"token")," is defined that value will always be used."),(0,a.kt)("h3",{id:"opaque-secrets"},"Opaque secrets"),(0,a.kt)("p",null,"Opaque secrets have no defined structure and can have arbitrary key value pairs. "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "my-secret": sec.Secret {\n type: "opaque"\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"certificate-secrets"},"Certificate secrets"),(0,a.kt)("p",null,"Certificate secrets are useful for storing a certificate and its associated key. One common use for TLS Secrets is to configure encryption in transit for an Ingress, but you can also use it with other resources or directly in your workload."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "server-cert": sec.Secret {\n type: "certificate"\n data: {\n # Please do not put private keys in configuration files\n "tls.crt": "The cert file content"\n "tls.key": "The key file content"\n }\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"external-secrets"},"External secrets"),(0,a.kt)("p",null,"As a general principle, storing secrets in a plain text configuration file is highly discouraged, keeping secrets outside of Git is especially important for future-proofing, even encrypted secrets are not recommended to check into Git. The most common approach is to store secrets in a third-party vault (such as Hashicorp Vault, AWS Secrets Manager and Azure Key Vault, etc) and retrieve the secret in the runtime only. External secrets are used to retrieve sensitive data from external secret store to make it easy to be consumed in containers."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "api-access-token": sec.Secret {\n type: "external"\n data: {\n # Please do not put private keys in configuration files\n "accessToken": "ref://api-auth-info/accessToken?version=1"\n }\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"The value field in data object follow ",(0,a.kt)("inlineCode",{parentName:"p"},"ref://PATH[?version=]")," URI syntax. ",(0,a.kt)("inlineCode",{parentName:"p"},"PATH")," is the provider-specific path for the secret to be retried. Kusion provides out-of-the-box integration with ",(0,a.kt)("inlineCode",{parentName:"p"},"Hashicorp Vault"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"AWS Secrets Manager"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"Azure Key Vault")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"Alicloud Secrets Manager"),"."),(0,a.kt)("h2",{id:"immutable-secrets"},"Immutable secrets"),(0,a.kt)("p",null,"You can also declare a secret as immutable to prevent it from being changed accidentally."),(0,a.kt)("p",null,"To declare a secret as immutable:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "my-secret": sec.Secret {\n # ...\n immutable: True\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"You can change a secret from mutable to immutable but not the other way around. That is because the Kubelet will stop watching secrets that are immutable. As the name suggests, you can only delete and re-create immutable secrets but you cannot change them."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/03253e12.1e0acf26.js b/assets/js/03253e12.1e0acf26.js new file mode 100644 index 00000000000..6fb66d3dc16 --- /dev/null +++ b/assets/js/03253e12.1e0acf26.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2623],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),d=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=d(e.components);return r.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=d(n),m=a,k=u["".concat(s,".").concat(m)]||u[m]||c[m]||o;return n?r.createElement(k,l(l({ref:t},p),{},{components:n})):r.createElement(k,l({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=u;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var r=n(87462),a=(n(67294),n(3905));const o={id:"naming-conventions",sidebar_label:"Resource Naming Conventions"},l="Resource Naming Conventions",i={unversionedId:"reference/modules/naming-conventions",id:"version-v0.11/reference/modules/naming-conventions",title:"Resource Naming Conventions",description:"Kusion will automatically create Kubernetes or Terraform resources for the applications, many of which do not require users' awareness. This document will introduce the naming conventions for these related resources.",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/3-naming-conventions.md",sourceDirName:"6-reference/2-modules",slug:"/reference/modules/naming-conventions",permalink:"/docs/reference/modules/naming-conventions",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/3-naming-conventions.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{id:"naming-conventions",sidebar_label:"Resource Naming Conventions"},sidebar:"kusion",previous:{title:"service",permalink:"/docs/reference/modules/workspace-configs/workload/service"},next:{title:"Roadmap",permalink:"/docs/reference/roadmap"}},s={},d=[{value:"Kubernetes Resources",id:"kubernetes-resources",level:2},{value:"Terraform Resources",id:"terraform-resources",level:2}],p={toc:d};function c(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"resource-naming-conventions"},"Resource Naming Conventions"),(0,a.kt)("p",null,"Kusion will automatically create Kubernetes or Terraform resources for the applications, many of which do not require users' awareness. This document will introduce the naming conventions for these related resources. "),(0,a.kt)("h2",{id:"kubernetes-resources"},"Kubernetes Resources"),(0,a.kt)("p",null,"Kusion adheres to specific rules when generating the Kubernetes resources for users' applications. The table below lists some common Kubernetes resource naming conventions. Note that ",(0,a.kt)("inlineCode",{parentName:"p"},"Namespace")," can now be specified by users. "),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Resource"),(0,a.kt)("th",{parentName:"tr",align:null},"Concatenation Rule"),(0,a.kt)("th",{parentName:"tr",align:null},"Example ID"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"Namespace"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"v1:Namespace:wordpress-local-db")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"Deployment"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"apps/v1:Deployment:wordpress-local-db:wordpress-local-db-dev-wordpress")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"CronJob"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"batch/v1:CronJob:helloworld:helloworld-dev-helloworld")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"Service"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"}," or ")),(0,a.kt)("td",{parentName:"tr",align:null},"v1:Service:helloworld:helloworld-dev-helloworld-public")))),(0,a.kt)("h2",{id:"terraform-resources"},"Terraform Resources"),(0,a.kt)("p",null,"Similarly, Kusion also adheres to specific naming conventions when generating the Terraform Resources. Some common resources are listed below. "),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Resource"),(0,a.kt)("th",{parentName:"tr",align:null},"Concatenation Rule"),(0,a.kt)("th",{parentName:"tr",align:null},"Example ID"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"random_password"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"hashicorp:random:random_password:wordpress-db-mysql")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"aws_security_group"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"hashicorp:aws:aws_security_group:wordpress-db-mysql")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"aws_db_instance"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"hashicorp:aws:aws_db_instance:wordpress-db")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"alicloud_db_instance"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"aliyun:alicloud:alicloud_db_instance:wordpress-db")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"alicloud_db_connection"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"aliyun:alicloud:alicloud_db_connection:wordpress")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"alicloud_rds_account"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"aliyun:alicloud:alicloud_rds_account:wordpress")))),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"")," is composed of two parts, one of which is the ",(0,a.kt)("inlineCode",{parentName:"p"},"key")," of database declared in ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," and the other is the ",(0,a.kt)("inlineCode",{parentName:"p"},"suffix")," declared in ",(0,a.kt)("inlineCode",{parentName:"p"},"workspace")," configuration. Kusion will concatenate the database key and suffix, convert them to uppercase, and replace ",(0,a.kt)("inlineCode",{parentName:"p"},"-")," with ",(0,a.kt)("inlineCode",{parentName:"p"},"_"),". And the ",(0,a.kt)("inlineCode",{parentName:"p"},"")," supported now includes ",(0,a.kt)("inlineCode",{parentName:"p"},"mysql")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"postgres"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/03253e12.e61e6743.js b/assets/js/03253e12.e61e6743.js deleted file mode 100644 index e8e5049cefd..00000000000 --- a/assets/js/03253e12.e61e6743.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2623],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),d=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=d(e.components);return r.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=d(n),m=a,k=u["".concat(s,".").concat(m)]||u[m]||c[m]||o;return n?r.createElement(k,l(l({ref:t},p),{},{components:n})):r.createElement(k,l({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=u;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var r=n(87462),a=(n(67294),n(3905));const o={id:"naming-conventions",sidebar_label:"Resource Naming Conventions"},l="Resource Naming Conventions",i={unversionedId:"reference/modules/naming-conventions",id:"version-v0.11/reference/modules/naming-conventions",title:"Resource Naming Conventions",description:"Kusion will automatically create Kubernetes or Terraform resources for the applications, many of which do not require users' awareness. This document will introduce the naming conventions for these related resources.",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/3-naming-conventions.md",sourceDirName:"6-reference/2-modules",slug:"/reference/modules/naming-conventions",permalink:"/docs/reference/modules/naming-conventions",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/3-naming-conventions.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{id:"naming-conventions",sidebar_label:"Resource Naming Conventions"},sidebar:"kusion",previous:{title:"service",permalink:"/docs/reference/modules/workspace-configs/workload/service"},next:{title:"Roadmap",permalink:"/docs/reference/roadmap"}},s={},d=[{value:"Kubernetes Resources",id:"kubernetes-resources",level:2},{value:"Terraform Resources",id:"terraform-resources",level:2}],p={toc:d};function c(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"resource-naming-conventions"},"Resource Naming Conventions"),(0,a.kt)("p",null,"Kusion will automatically create Kubernetes or Terraform resources for the applications, many of which do not require users' awareness. This document will introduce the naming conventions for these related resources. "),(0,a.kt)("h2",{id:"kubernetes-resources"},"Kubernetes Resources"),(0,a.kt)("p",null,"Kusion adheres to specific rules when generating the Kubernetes resources for users' applications. The table below lists some common Kubernetes resource naming conventions. Note that ",(0,a.kt)("inlineCode",{parentName:"p"},"Namespace")," can now be specified by users. "),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Resource"),(0,a.kt)("th",{parentName:"tr",align:null},"Concatenation Rule"),(0,a.kt)("th",{parentName:"tr",align:null},"Example ID"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"Namespace"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"v1:Namespace:wordpress-local-db")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"Deployment"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"apps/v1:Deployment:wordpress-local-db:wordpress-local-db-dev-wordpress")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"CronJob"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"batch/v1:CronJob:helloworld:helloworld-dev-helloworld")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"Service"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"}," or ")),(0,a.kt)("td",{parentName:"tr",align:null},"v1:Service:helloworld:helloworld-dev-helloworld-public")))),(0,a.kt)("h2",{id:"terraform-resources"},"Terraform Resources"),(0,a.kt)("p",null,"Similarly, Kusion also adheres to specific naming conventions when generating the Terraform Resources. Some common resources are listed below. "),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Resource"),(0,a.kt)("th",{parentName:"tr",align:null},"Concatenation Rule"),(0,a.kt)("th",{parentName:"tr",align:null},"Example ID"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"random_password"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"hashicorp:random:random_password:wordpress-db-mysql")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"aws_security_group"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"hashicorp:aws:aws_security_group:wordpress-db-mysql")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"aws_db_instance"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"hashicorp:aws:aws_db_instance:wordpress-db")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"alicloud_db_instance"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"aliyun:alicloud:alicloud_db_instance:wordpress-db")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"alicloud_db_connection"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"aliyun:alicloud:alicloud_db_connection:wordpress")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"alicloud_rds_account"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"aliyun:alicloud:alicloud_rds_account:wordpress")))),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"")," is composed of two parts, one of which is the ",(0,a.kt)("inlineCode",{parentName:"p"},"key")," of database declared in ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," and the other is the ",(0,a.kt)("inlineCode",{parentName:"p"},"suffix")," declared in ",(0,a.kt)("inlineCode",{parentName:"p"},"workspace")," configuration. Kusion will concatenate the database key and suffix, convert them to uppercase, and replace ",(0,a.kt)("inlineCode",{parentName:"p"},"-")," with ",(0,a.kt)("inlineCode",{parentName:"p"},"_"),". And the ",(0,a.kt)("inlineCode",{parentName:"p"},"")," supported now includes ",(0,a.kt)("inlineCode",{parentName:"p"},"mysql")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"postgres"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0400c277.fb900e8e.js b/assets/js/0400c277.27c21fee.js similarity index 66% rename from assets/js/0400c277.fb900e8e.js rename to assets/js/0400c277.27c21fee.js index cf8b21de10a..14198696710 100644 --- a/assets/js/0400c277.fb900e8e.js +++ b/assets/js/0400c277.27c21fee.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1372],{3905:(e,t,o)=>{o.d(t,{Zo:()=>l,kt:()=>f});var r=o(67294);function n(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function i(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function a(e){for(var t=1;t=0||(n[o]=e[o]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}var s=r.createContext({}),p=function(e){var t=r.useContext(s),o=t;return e&&(o="function"==typeof e?e(t):a(a({},t),e)),o},l=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var o=e.components,n=e.mdxType,i=e.originalType,s=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=p(o),f=n,v=u["".concat(s,".").concat(f)]||u[f]||d[f]||i;return o?r.createElement(v,a(a({ref:t},l),{},{components:o})):r.createElement(v,a({ref:t},l))}));function f(e,t){var o=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var i=o.length,a=new Array(i);a[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:n,a[1]=c;for(var p=2;p{o.r(t),o.d(t,{assets:()=>s,contentTitle:()=>a,default:()=>d,frontMatter:()=>i,metadata:()=>c,toc:()=>p});var r=o(87462),n=(o(67294),o(3905));const i={sidebar_label:"Overview",id:"overview"},a="Overview",c={unversionedId:"concepts/project/overview",id:"version-v0.10/concepts/project/overview",title:"Overview",description:"A project in Kusion is defined as any folder that contains a project.yaml file and is linked to a Git repository. Typically, the mapping between a project and a repository is 1:1, however, it is possible to have multiple projects connected to a single repository\u2014for example, in the case of a monorepo. A project consists of one or more applications.",source:"@site/docs_versioned_docs/version-v0.10/3-concepts/1-project/1-overview.md",sourceDirName:"3-concepts/1-project",slug:"/concepts/project/overview",permalink:"/docs/v0.10/concepts/project/overview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/3-concepts/1-project/1-overview.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_label:"Overview",id:"overview"},sidebar:"kusion",previous:{title:"Deliver the WordPress Application on Kubernetes",permalink:"/docs/v0.10/getting-started/deliver-wordpress"},next:{title:"Project Configuration",permalink:"/docs/v0.10/concepts/project/configuration"}},s={},p=[],l={toc:p};function d(e){let{components:t,...o}=e;return(0,n.kt)("wrapper",(0,r.Z)({},l,o,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"overview"},"Overview"),(0,n.kt)("p",null,"A project in Kusion is defined as any folder that contains a project.yaml file and is linked to a Git repository. Typically, the mapping between a project and a repository is 1:1, however, it is possible to have multiple projects connected to a single repository\u2014for example, in the case of a monorepo. A project consists of one or more applications."),(0,n.kt)("p",null,"The purpose of the project is to bundle application configurations and refer to a Git repository. Specifically, it organizes logical configurations for internal components to orchestrate the application and assembles these configurations to suit different roles, such as developers and SREs, thereby covering the entire life cycle of application development."),(0,n.kt)("p",null,"From the perspective of the application development life cycle, the configuration delineated by the project is decoupled from the application code. It takes an immutable image as input, allowing users to perform operations and maintain the application within an independent configuration codebase."))}d.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1372],{3905:(e,t,o)=>{o.d(t,{Zo:()=>l,kt:()=>f});var r=o(67294);function n(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function i(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function a(e){for(var t=1;t=0||(n[o]=e[o]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}var s=r.createContext({}),p=function(e){var t=r.useContext(s),o=t;return e&&(o="function"==typeof e?e(t):a(a({},t),e)),o},l=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var o=e.components,n=e.mdxType,i=e.originalType,s=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=p(o),f=n,v=u["".concat(s,".").concat(f)]||u[f]||d[f]||i;return o?r.createElement(v,a(a({ref:t},l),{},{components:o})):r.createElement(v,a({ref:t},l))}));function f(e,t){var o=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var i=o.length,a=new Array(i);a[0]=u;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:n,a[1]=c;for(var p=2;p{o.r(t),o.d(t,{assets:()=>s,contentTitle:()=>a,default:()=>d,frontMatter:()=>i,metadata:()=>c,toc:()=>p});var r=o(87462),n=(o(67294),o(3905));const i={sidebar_label:"Overview",id:"overview"},a="Overview",c={unversionedId:"concepts/project/overview",id:"version-v0.10/concepts/project/overview",title:"Overview",description:"A project in Kusion is defined as any folder that contains a project.yaml file and is linked to a Git repository. Typically, the mapping between a project and a repository is 1:1, however, it is possible to have multiple projects connected to a single repository\u2014for example, in the case of a monorepo. A project consists of one or more applications.",source:"@site/docs_versioned_docs/version-v0.10/3-concepts/1-project/1-overview.md",sourceDirName:"3-concepts/1-project",slug:"/concepts/project/overview",permalink:"/docs/v0.10/concepts/project/overview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/3-concepts/1-project/1-overview.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_label:"Overview",id:"overview"},sidebar:"kusion",previous:{title:"Deliver the WordPress Application on Kubernetes",permalink:"/docs/v0.10/getting-started/deliver-wordpress"},next:{title:"Project Configuration",permalink:"/docs/v0.10/concepts/project/configuration"}},s={},p=[],l={toc:p};function d(e){let{components:t,...o}=e;return(0,n.kt)("wrapper",(0,r.Z)({},l,o,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"overview"},"Overview"),(0,n.kt)("p",null,"A project in Kusion is defined as any folder that contains a project.yaml file and is linked to a Git repository. Typically, the mapping between a project and a repository is 1:1, however, it is possible to have multiple projects connected to a single repository\u2014for example, in the case of a monorepo. A project consists of one or more applications."),(0,n.kt)("p",null,"The purpose of the project is to bundle application configurations and refer to a Git repository. Specifically, it organizes logical configurations for internal components to orchestrate the application and assembles these configurations to suit different roles, such as developers and SREs, thereby covering the entire life cycle of application development."),(0,n.kt)("p",null,"From the perspective of the application development life cycle, the configuration delineated by the project is decoupled from the application code. It takes an immutable image as input, allowing users to perform operations and maintain the application within an independent configuration codebase."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/043680c6.0aa5ff9f.js b/assets/js/043680c6.0aa5ff9f.js deleted file mode 100644 index 604e71ffa57..00000000000 --- a/assets/js/043680c6.0aa5ff9f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1753],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(n),m=a,k=d["".concat(c,".").concat(m)]||d[m]||u[m]||o;return n?r.createElement(k,s(s({ref:t},p),{},{components:n})):r.createElement(k,s({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const o={id:"secret"},s="Secrets",i={unversionedId:"configuration-walkthrough/secret",id:"configuration-walkthrough/secret",title:"Secrets",description:"Secrets are used to store sensitive data like passwords, API keys, TLS certificates, tokens, or other credentials. Kusion provides multiple secret types, and makes it easy to be consumed in containers.",source:"@site/docs/kusion/4-configuration-walkthrough/7-secret.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/secret",permalink:"/docs/next/configuration-walkthrough/secret",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/4-configuration-walkthrough/7-secret.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:7,frontMatter:{id:"secret"},sidebar:"kusion",previous:{title:"Managed Databases",permalink:"/docs/next/configuration-walkthrough/databse"},next:{title:"Application Monitoring",permalink:"/docs/next/configuration-walkthrough/monitoring"}},c={},l=[{value:"Using secrets in workload",id:"using-secrets-in-workload",level:2},{value:"Consume secret in an environment variable",id:"consume-secret-in-an-environment-variable",level:3},{value:"Consume all secret keys as environment variables",id:"consume-all-secret-keys-as-environment-variables",level:3},{value:"Types of secrets",id:"types-of-secrets",level:2},{value:"Basic secrets",id:"basic-secrets",level:3},{value:"Token secrets",id:"token-secrets",level:3},{value:"Opaque secrets",id:"opaque-secrets",level:3},{value:"Certificate secrets",id:"certificate-secrets",level:3},{value:"External secrets",id:"external-secrets",level:3},{value:"Immutable secrets",id:"immutable-secrets",level:2}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"secrets"},"Secrets"),(0,a.kt)("p",null,"Secrets are used to store sensitive data like passwords, API keys, TLS certificates, tokens, or other credentials. Kusion provides multiple secret types, and makes it easy to be consumed in containers."),(0,a.kt)("p",null,"For application dependent cloud resources that are managed by Kusion, their credentials are automatically managed by Kusion (generated and injected into application runtime environment variable). You shouldn't have to manually create those."),(0,a.kt)("h2",{id:"using-secrets-in-workload"},"Using secrets in workload"),(0,a.kt)("p",null,"Secrets must be defined in AppConfiguration. The values can be generated by Kusion or reference existing secrets stored in third-party vault. Secrets can be consumed in containers by referencing them through the ",(0,a.kt)("inlineCode",{parentName:"p"},"secret:///")," URI syntax."),(0,a.kt)("h3",{id:"consume-secret-in-an-environment-variable"},"Consume secret in an environment variable"),(0,a.kt)("p",null,"You can consume the data in Secrets as environment variable in your container. For example the db container uses an environment variable to set the root password."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport kam.v1.workload.secret as sec\n\nsampledb: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "db": c.Container {\n image: "mysql"\n env: {\n # Consume db-root-password secret in environment\n "ROOT_PASSWORD": "secret://db-root-password/token"\n }\n }\n }\n # Secrets used to generate token\n secrets: {\n "init-info": sec.Secret {\n type: "token"\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"The example shows the secret ",(0,a.kt)("inlineCode",{parentName:"p"},"root-password")," being consumed as an environment variable in the db container. The secret is of type token and will automatically be generated at runtime by Kusion."),(0,a.kt)("h3",{id:"consume-all-secret-keys-as-environment-variables"},"Consume all secret keys as environment variables"),(0,a.kt)("p",null,"Sometimes your secret contains multiple data that need to be consumed as environment variables. The example below shows how to consume all the values in a secret as environment variables named after the keys."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport kam.v1.workload.secret as sec\n\nsampledb: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "db": c.Container {\n image: "mysql"\n env: {\n # Consume all init-info secret keys as environment variables\n "secret://init-info": ""\n }\n }\n }\n # Secrets used to init mysql instance\n secrets: {\n "init-info": sec.Secret {\n type: "opaque"\n data: {\n "ROOT_PASSWORD": "admin"\n }\n }\n }\n }\n}\n')),(0,a.kt)("p",null,'This will set the environment variable "ROOT_PASSWORD" to the value "admin" in the db container.'),(0,a.kt)("h2",{id:"types-of-secrets"},"Types of secrets"),(0,a.kt)("p",null,"Kusion provides multiple types of secrets to application developers."),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Basic: Used to generate and/or store usernames and passwords."),(0,a.kt)("li",{parentName:"ol"},"Token: Used to generate and/or store secret strings for password."),(0,a.kt)("li",{parentName:"ol"},"Opaque: A generic secret that can store arbitrary user-defined data."),(0,a.kt)("li",{parentName:"ol"},"Certificate: Used to store a certificate and its associated key that are typically used for TLS."),(0,a.kt)("li",{parentName:"ol"},"External: Used to retrieve secret form third-party vault.")),(0,a.kt)("h3",{id:"basic-secrets"},"Basic secrets"),(0,a.kt)("p",null,'Basic secrets are defined in the secrets block with the type "basic".'),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "auth-info": sec.Secret {\n type: "basic"\n data: {\n "username": "admin"\n "password": "******"\n }\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"The basic secret type is typically used for basic authentication. The key names must be username and password. If one or both of the fields are defined with a non-empty string, those values will be used. If the empty string, the default value, is used Acorn will generate random values for one or both."),(0,a.kt)("h3",{id:"token-secrets"},"Token secrets"),(0,a.kt)("p",null,"Token secrets are useful for generating a password or secure string used for passwords when the user is already known or not required."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "api-token": sec.Secret {\n type: "token"\n data: {\n "token": ""\n }\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"The token secret type must be defined. The ",(0,a.kt)("inlineCode",{parentName:"p"},"token")," field in the data object is optional and if left empty Kusion will generate the token, which is 54 characters in length by default. If the ",(0,a.kt)("inlineCode",{parentName:"p"},"token")," is defined that value will always be used."),(0,a.kt)("h3",{id:"opaque-secrets"},"Opaque secrets"),(0,a.kt)("p",null,"Opaque secrets have no defined structure and can have arbitrary key value pairs. "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "my-secret": sec.Secret {\n type: "opaque"\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"certificate-secrets"},"Certificate secrets"),(0,a.kt)("p",null,"Certificate secrets are useful for storing a certificate and its associated key. One common use for TLS Secrets is to configure encryption in transit for an Ingress, but you can also use it with other resources or directly in your workload."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "server-cert": sec.Secret {\n type: "certificate"\n data: {\n # Please do not put private keys in configuration files\n "tls.crt": "The cert file content"\n "tls.key": "The key file content"\n }\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"external-secrets"},"External secrets"),(0,a.kt)("p",null,"As a general principle, storing secrets in a plain text configuration file is highly discouraged, keeping secrets outside of Git is especially important for future-proofing, even encrypted secrets are not recommended to check into Git. The most common approach is to store secrets in a third-party vault (such as Hashicorp Vault, AWS Secrets Manager and Azure Key Vault, etc) and retrieve the secret in the runtime only. External secrets are used to retrieve sensitive data from external secret store to make it easy to be consumed in containers."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "api-access-token": sec.Secret {\n type: "external"\n data: {\n # Please do not put private keys in configuration files\n "accessToken": "ref://api-auth-info/accessToken?version=1"\n }\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"The value field in data object follow ",(0,a.kt)("inlineCode",{parentName:"p"},"ref://PATH[?version=]")," URI syntax. ",(0,a.kt)("inlineCode",{parentName:"p"},"PATH")," is the provider-specific path for the secret to be retried. Kusion provides out-of-the-box integration with ",(0,a.kt)("inlineCode",{parentName:"p"},"Hashicorp Vault"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"AWS Secrets Manager"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"Azure Key Vault")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"Alicloud Secrets Manager"),"."),(0,a.kt)("h2",{id:"immutable-secrets"},"Immutable secrets"),(0,a.kt)("p",null,"You can also declare a secret as immutable to prevent it from being changed accidentally."),(0,a.kt)("p",null,"To declare a secret as immutable:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "my-secret": sec.Secret {\n # ...\n immutable: True\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"You can change a secret from mutable to immutable but not the other way around. That is because the Kubelet will stop watching secrets that are immutable. As the name suggests, you can only delete and re-create immutable secrets but you cannot change them."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/043680c6.f3a12810.js b/assets/js/043680c6.f3a12810.js new file mode 100644 index 00000000000..33f8699b63a --- /dev/null +++ b/assets/js/043680c6.f3a12810.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1753],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(n),m=a,k=d["".concat(c,".").concat(m)]||d[m]||u[m]||o;return n?r.createElement(k,s(s({ref:t},p),{},{components:n})):r.createElement(k,s({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,s=new Array(o);s[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,s[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const o={id:"secret"},s="Secrets",i={unversionedId:"configuration-walkthrough/secret",id:"configuration-walkthrough/secret",title:"Secrets",description:"Secrets are used to store sensitive data like passwords, API keys, TLS certificates, tokens, or other credentials. Kusion provides multiple secret types, and makes it easy to be consumed in containers.",source:"@site/docs/kusion/4-configuration-walkthrough/7-secret.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/secret",permalink:"/docs/next/configuration-walkthrough/secret",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/4-configuration-walkthrough/7-secret.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:7,frontMatter:{id:"secret"},sidebar:"kusion",previous:{title:"Managed Databases",permalink:"/docs/next/configuration-walkthrough/databse"},next:{title:"Application Monitoring",permalink:"/docs/next/configuration-walkthrough/monitoring"}},c={},l=[{value:"Using secrets in workload",id:"using-secrets-in-workload",level:2},{value:"Consume secret in an environment variable",id:"consume-secret-in-an-environment-variable",level:3},{value:"Consume all secret keys as environment variables",id:"consume-all-secret-keys-as-environment-variables",level:3},{value:"Types of secrets",id:"types-of-secrets",level:2},{value:"Basic secrets",id:"basic-secrets",level:3},{value:"Token secrets",id:"token-secrets",level:3},{value:"Opaque secrets",id:"opaque-secrets",level:3},{value:"Certificate secrets",id:"certificate-secrets",level:3},{value:"External secrets",id:"external-secrets",level:3},{value:"Immutable secrets",id:"immutable-secrets",level:2}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"secrets"},"Secrets"),(0,a.kt)("p",null,"Secrets are used to store sensitive data like passwords, API keys, TLS certificates, tokens, or other credentials. Kusion provides multiple secret types, and makes it easy to be consumed in containers."),(0,a.kt)("p",null,"For application dependent cloud resources that are managed by Kusion, their credentials are automatically managed by Kusion (generated and injected into application runtime environment variable). You shouldn't have to manually create those."),(0,a.kt)("h2",{id:"using-secrets-in-workload"},"Using secrets in workload"),(0,a.kt)("p",null,"Secrets must be defined in AppConfiguration. The values can be generated by Kusion or reference existing secrets stored in third-party vault. Secrets can be consumed in containers by referencing them through the ",(0,a.kt)("inlineCode",{parentName:"p"},"secret:///")," URI syntax."),(0,a.kt)("h3",{id:"consume-secret-in-an-environment-variable"},"Consume secret in an environment variable"),(0,a.kt)("p",null,"You can consume the data in Secrets as environment variable in your container. For example the db container uses an environment variable to set the root password."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport kam.v1.workload.secret as sec\n\nsampledb: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "db": c.Container {\n image: "mysql"\n env: {\n # Consume db-root-password secret in environment\n "ROOT_PASSWORD": "secret://db-root-password/token"\n }\n }\n }\n # Secrets used to generate token\n secrets: {\n "init-info": sec.Secret {\n type: "token"\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"The example shows the secret ",(0,a.kt)("inlineCode",{parentName:"p"},"root-password")," being consumed as an environment variable in the db container. The secret is of type token and will automatically be generated at runtime by Kusion."),(0,a.kt)("h3",{id:"consume-all-secret-keys-as-environment-variables"},"Consume all secret keys as environment variables"),(0,a.kt)("p",null,"Sometimes your secret contains multiple data that need to be consumed as environment variables. The example below shows how to consume all the values in a secret as environment variables named after the keys."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport kam.v1.workload.secret as sec\n\nsampledb: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "db": c.Container {\n image: "mysql"\n env: {\n # Consume all init-info secret keys as environment variables\n "secret://init-info": ""\n }\n }\n }\n # Secrets used to init mysql instance\n secrets: {\n "init-info": sec.Secret {\n type: "opaque"\n data: {\n "ROOT_PASSWORD": "admin"\n }\n }\n }\n }\n}\n')),(0,a.kt)("p",null,'This will set the environment variable "ROOT_PASSWORD" to the value "admin" in the db container.'),(0,a.kt)("h2",{id:"types-of-secrets"},"Types of secrets"),(0,a.kt)("p",null,"Kusion provides multiple types of secrets to application developers."),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Basic: Used to generate and/or store usernames and passwords."),(0,a.kt)("li",{parentName:"ol"},"Token: Used to generate and/or store secret strings for password."),(0,a.kt)("li",{parentName:"ol"},"Opaque: A generic secret that can store arbitrary user-defined data."),(0,a.kt)("li",{parentName:"ol"},"Certificate: Used to store a certificate and its associated key that are typically used for TLS."),(0,a.kt)("li",{parentName:"ol"},"External: Used to retrieve secret form third-party vault.")),(0,a.kt)("h3",{id:"basic-secrets"},"Basic secrets"),(0,a.kt)("p",null,'Basic secrets are defined in the secrets block with the type "basic".'),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "auth-info": sec.Secret {\n type: "basic"\n data: {\n "username": "admin"\n "password": "******"\n }\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"The basic secret type is typically used for basic authentication. The key names must be username and password. If one or both of the fields are defined with a non-empty string, those values will be used. If the empty string, the default value, is used Acorn will generate random values for one or both."),(0,a.kt)("h3",{id:"token-secrets"},"Token secrets"),(0,a.kt)("p",null,"Token secrets are useful for generating a password or secure string used for passwords when the user is already known or not required."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "api-token": sec.Secret {\n type: "token"\n data: {\n "token": ""\n }\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"The token secret type must be defined. The ",(0,a.kt)("inlineCode",{parentName:"p"},"token")," field in the data object is optional and if left empty Kusion will generate the token, which is 54 characters in length by default. If the ",(0,a.kt)("inlineCode",{parentName:"p"},"token")," is defined that value will always be used."),(0,a.kt)("h3",{id:"opaque-secrets"},"Opaque secrets"),(0,a.kt)("p",null,"Opaque secrets have no defined structure and can have arbitrary key value pairs. "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "my-secret": sec.Secret {\n type: "opaque"\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"certificate-secrets"},"Certificate secrets"),(0,a.kt)("p",null,"Certificate secrets are useful for storing a certificate and its associated key. One common use for TLS Secrets is to configure encryption in transit for an Ingress, but you can also use it with other resources or directly in your workload."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "server-cert": sec.Secret {\n type: "certificate"\n data: {\n # Please do not put private keys in configuration files\n "tls.crt": "The cert file content"\n "tls.key": "The key file content"\n }\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"external-secrets"},"External secrets"),(0,a.kt)("p",null,"As a general principle, storing secrets in a plain text configuration file is highly discouraged, keeping secrets outside of Git is especially important for future-proofing, even encrypted secrets are not recommended to check into Git. The most common approach is to store secrets in a third-party vault (such as Hashicorp Vault, AWS Secrets Manager and Azure Key Vault, etc) and retrieve the secret in the runtime only. External secrets are used to retrieve sensitive data from external secret store to make it easy to be consumed in containers."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "api-access-token": sec.Secret {\n type: "external"\n data: {\n # Please do not put private keys in configuration files\n "accessToken": "ref://api-auth-info/accessToken?version=1"\n }\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"The value field in data object follow ",(0,a.kt)("inlineCode",{parentName:"p"},"ref://PATH[?version=]")," URI syntax. ",(0,a.kt)("inlineCode",{parentName:"p"},"PATH")," is the provider-specific path for the secret to be retried. Kusion provides out-of-the-box integration with ",(0,a.kt)("inlineCode",{parentName:"p"},"Hashicorp Vault"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"AWS Secrets Manager"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"Azure Key Vault")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"Alicloud Secrets Manager"),"."),(0,a.kt)("h2",{id:"immutable-secrets"},"Immutable secrets"),(0,a.kt)("p",null,"You can also declare a secret as immutable to prevent it from being changed accidentally."),(0,a.kt)("p",null,"To declare a secret as immutable:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "my-secret": sec.Secret {\n # ...\n immutable: True\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"You can change a secret from mutable to immutable but not the other way around. That is because the Kubelet will stop watching secrets that are immutable. As the name suggests, you can only delete and re-create immutable secrets but you cannot change them."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/045fa4ba.1fc1adcc.js b/assets/js/045fa4ba.1fc1adcc.js deleted file mode 100644 index 63be8483c5e..00000000000 --- a/assets/js/045fa4ba.1fc1adcc.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5517],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var a=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var l=a.createContext({}),c=function(e){var n=a.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},p=function(e){var n=c(e.components);return a.createElement(l.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,o=e.mdxType,r=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=c(t),m=o,f=u["".concat(l,".").concat(m)]||u[m]||d[m]||r;return t?a.createElement(f,i(i({ref:n},p),{},{components:t})):a.createElement(f,i({ref:n},p))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var r=t.length,i=new Array(r);i[0]=u;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var c=2;c{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>r,metadata:()=>s,toc:()=>c});var a=t(87462),o=(t(67294),t(3905));const r={},i="Workspace",s={unversionedId:"concepts/workspace",id:"version-v0.10/concepts/workspace",title:"Workspace",description:"Definition",source:"@site/docs_versioned_docs/version-v0.10/3-concepts/4-workspace.md",sourceDirName:"3-concepts",slug:"/concepts/workspace",permalink:"/docs/v0.10/concepts/workspace",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/3-concepts/4-workspace.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:4,frontMatter:{},sidebar:"kusion",previous:{title:"Kusion Module",permalink:"/docs/v0.10/concepts/kusion-module"},next:{title:"AppConfiguration",permalink:"/docs/v0.10/concepts/app-configuration"}},l={},c=[{value:"Definition",id:"definition",level:2},{value:"Structure",id:"structure",level:2},{value:"Workflow",id:"workflow",level:2}],p={toc:c};function d(e){let{components:n,...r}=e;return(0,o.kt)("wrapper",(0,a.Z)({},p,r,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"workspace"},"Workspace"),(0,o.kt)("h2",{id:"definition"},"Definition"),(0,o.kt)("p",null,"A workspace is a logical concept that represents a target environment for deploying a stack. It contains platform configurations, including a set of configurations, Kubeconfig, and provider authentication information, all of which can be reused by multiple stacks. We recommend organizing workspaces by SDLC (Software Development Life Cycle) phases or by cloud vendors. For example, workspaces could be named ",(0,o.kt)("inlineCode",{parentName:"p"},"dev"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"staging"),", and ",(0,o.kt)("inlineCode",{parentName:"p"},"prod"),", or according to cloud vendors such as ",(0,o.kt)("inlineCode",{parentName:"p"},"AWS"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"Azure"),", and ",(0,o.kt)("inlineCode",{parentName:"p"},"Alibaba Cloud"),"."),(0,o.kt)("p",null,"For clarity, workspace data is categorized into two types: configuration and secret. The configuration data is non-sensitive and is stored locally in YAML files, including module inputs, runtime configurations, and backend configurations. The secret data is sensitive and should be stored as workspace variables. For example, when using AWS, users must set the correct workspace variables for ",(0,o.kt)("inlineCode",{parentName:"p"},"AWS_ACCESS_KEY_ID")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"AWS_SECRET_ACCESS_KEY"),"."),(0,o.kt)("p",null,"If a set of data items serves the same target and contains one or more sensitive data items, then the entire set should be managed using environment variables. This approach ensures a consistent and seamless user experience."),(0,o.kt)("p",null,"Each stack must be associated with a single workspace, and ",(0,o.kt)("strong",{parentName:"p"},"the stack's name must be the same as the workspace it will be deployed to"),"."),(0,o.kt)("p",null,(0,o.kt)("img",{alt:"workspace-project-stack",src:t(27137).Z,width:"587",height:"362"})),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"In product design, Kusion does not support deploying to multiple clouds or multiple regions within a single workspace. While users can technically define a module that provisions resources across multiple clouds or regions, Kusion does not recommend this practice and will not provide technical support for such configurations. If a platform team needs to manage resources across multiple clouds or regions, they should create separate workspaces.")),(0,o.kt)("h2",{id:"structure"},"Structure"),(0,o.kt)("p",null,"The configuration of a workspace is stored in a single YAML file, which consists of three components: ",(0,o.kt)("inlineCode",{parentName:"p"},"modules"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"runtimes"),", and ",(0,o.kt)("inlineCode",{parentName:"p"},"backends"),"."),(0,o.kt)("p",null,"A ",(0,o.kt)("inlineCode",{parentName:"p"},"module")," configuration comprises default configs and several patchers, where the name of each patcher must not be ",(0,o.kt)("strong",{parentName:"p"},"default"),". Configurations in the ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," block will be applied to all applications in this workspace and configurations in the patcher block will only be applied to projects in the ",(0,o.kt)("inlineCode",{parentName:"p"},"projectSelector"),". Values in patchers will override default configs with the same field name.\nFor the default configuration or a specific patcher, field keys must be the same as module input field names defined by the module. Module configurations can be found in the ",(0,o.kt)("a",{parentName:"p",href:"../reference/modules"},"Kusion Modules")),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"runtime")," configuration currently supports Kubernetes and Terraform, where the former includes the field ",(0,o.kt)("inlineCode",{parentName:"p"},"kubeConfig")," to specify the path of Kube Config, and the latter contains data for Terraform providers, which vary across different providers. For Terraform providers, sensitive data should be stored in environment variables."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"backend")," configuration currently supports local, oss, s3, database, and http. This defines the backend for state, intent, and other Kusion data that may require storage in the future. This format requires that all Kusion data share the same backend. As with sensitive data in the runtime configuration, these details should also be stored in environment variables. Backend configurations can be found in the ",(0,o.kt)("a",{parentName:"p",href:"backend-configuration"},"Backend Configuration")),(0,o.kt)("p",null,"An example is shown as below:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-yaml"},"# Module input, each with the format standard\uff1a\n# # :\n# # default: # default configurations, applied to all projects\n# # : \n# # : \n# # ...\n# # : #patcher configurations, applied to the projects assigned in projectSelector\n# # : \n# # ...\n# # projectSelector:\n# # - \n# # ...\nmodules:\n database:\n default:\n provider: aws\n size: 20\n instanceClass: db.t3.micro\n securityIPs:\n - 10.0.0.0/18\n smallClass:\n size: 50\n instanceClass: db.t3.small\n projectSelector:\n - foo\n - bar\n largeClass:\n instanceClass: db.t3.large\n projectSelector:\n - baz\n \n# A set of runtime configs, each with the format standard:\n# # :\n# # : \n# # : \n# # ...\nruntimes:\n kubernetes:\n kubeConfig: /etc/kubeconfig.yaml\n terraform:\n aws:\n version: 1.0.4\n source: hashicorp/aws\n region: us-east-1\n \n# A set of backend configs, each with the following format standard:\n# # :\n# # : \n# # : \n# # ...\nbackends:\n s3: \n bucket: kusion\n region: us-east-1\n")),(0,o.kt)("h2",{id:"workflow"},"Workflow"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"Write the ",(0,o.kt)("inlineCode",{parentName:"li"},"workspace.yaml")," with the format shown above and fulfill all necessary fields."),(0,o.kt)("li",{parentName:"ol"},"Create a workspace with ",(0,o.kt)("inlineCode",{parentName:"li"},"kusion worksapce create -f "),"\nA new workspace configuration file named ",(0,o.kt)("inlineCode",{parentName:"li"},".yaml")," will be created under the path ",(0,o.kt)("inlineCode",{parentName:"li"},"$KUSION_PATH/.workspace"),", and the validation will be done before the creation."),(0,o.kt)("li",{parentName:"ol"},"Update a workspace with ",(0,o.kt)("inlineCode",{parentName:"li"},"kusion worksapce update -f "),"\nThe workspace will be updated with the latest values."),(0,o.kt)("li",{parentName:"ol"},"Delete a workspace with ",(0,o.kt)("inlineCode",{parentName:"li"},"kusion workspace delete ")," if you don't need it anymore.")),(0,o.kt)("p",null,"More workspace commands can be found in the ",(0,o.kt)("a",{parentName:"p",href:"../reference/commands/kusion-workspace"},"reference"),"."))}d.isMDXComponent=!0},27137:(e,n,t)=>{t.d(n,{Z:()=>a});const a=t.p+"assets/images/workspace-project-stack-35aa4e25ab80fe4a1a6bbfbbe024e127.png"}}]); \ No newline at end of file diff --git a/assets/js/045fa4ba.6fc5d885.js b/assets/js/045fa4ba.6fc5d885.js new file mode 100644 index 00000000000..70fab22ea53 --- /dev/null +++ b/assets/js/045fa4ba.6fc5d885.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5517],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var a=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var l=a.createContext({}),c=function(e){var n=a.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},p=function(e){var n=c(e.components);return a.createElement(l.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,o=e.mdxType,r=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=c(t),m=o,f=u["".concat(l,".").concat(m)]||u[m]||d[m]||r;return t?a.createElement(f,i(i({ref:n},p),{},{components:t})):a.createElement(f,i({ref:n},p))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var r=t.length,i=new Array(r);i[0]=u;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var c=2;c{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>r,metadata:()=>s,toc:()=>c});var a=t(87462),o=(t(67294),t(3905));const r={},i="Workspace",s={unversionedId:"concepts/workspace",id:"version-v0.10/concepts/workspace",title:"Workspace",description:"Definition",source:"@site/docs_versioned_docs/version-v0.10/3-concepts/4-workspace.md",sourceDirName:"3-concepts",slug:"/concepts/workspace",permalink:"/docs/v0.10/concepts/workspace",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/3-concepts/4-workspace.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:4,frontMatter:{},sidebar:"kusion",previous:{title:"Kusion Module",permalink:"/docs/v0.10/concepts/kusion-module"},next:{title:"AppConfiguration",permalink:"/docs/v0.10/concepts/app-configuration"}},l={},c=[{value:"Definition",id:"definition",level:2},{value:"Structure",id:"structure",level:2},{value:"Workflow",id:"workflow",level:2}],p={toc:c};function d(e){let{components:n,...r}=e;return(0,o.kt)("wrapper",(0,a.Z)({},p,r,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"workspace"},"Workspace"),(0,o.kt)("h2",{id:"definition"},"Definition"),(0,o.kt)("p",null,"A workspace is a logical concept that represents a target environment for deploying a stack. It contains platform configurations, including a set of configurations, Kubeconfig, and provider authentication information, all of which can be reused by multiple stacks. We recommend organizing workspaces by SDLC (Software Development Life Cycle) phases or by cloud vendors. For example, workspaces could be named ",(0,o.kt)("inlineCode",{parentName:"p"},"dev"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"staging"),", and ",(0,o.kt)("inlineCode",{parentName:"p"},"prod"),", or according to cloud vendors such as ",(0,o.kt)("inlineCode",{parentName:"p"},"AWS"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"Azure"),", and ",(0,o.kt)("inlineCode",{parentName:"p"},"Alibaba Cloud"),"."),(0,o.kt)("p",null,"For clarity, workspace data is categorized into two types: configuration and secret. The configuration data is non-sensitive and is stored locally in YAML files, including module inputs, runtime configurations, and backend configurations. The secret data is sensitive and should be stored as workspace variables. For example, when using AWS, users must set the correct workspace variables for ",(0,o.kt)("inlineCode",{parentName:"p"},"AWS_ACCESS_KEY_ID")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"AWS_SECRET_ACCESS_KEY"),"."),(0,o.kt)("p",null,"If a set of data items serves the same target and contains one or more sensitive data items, then the entire set should be managed using environment variables. This approach ensures a consistent and seamless user experience."),(0,o.kt)("p",null,"Each stack must be associated with a single workspace, and ",(0,o.kt)("strong",{parentName:"p"},"the stack's name must be the same as the workspace it will be deployed to"),"."),(0,o.kt)("p",null,(0,o.kt)("img",{alt:"workspace-project-stack",src:t(27137).Z,width:"587",height:"362"})),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"In product design, Kusion does not support deploying to multiple clouds or multiple regions within a single workspace. While users can technically define a module that provisions resources across multiple clouds or regions, Kusion does not recommend this practice and will not provide technical support for such configurations. If a platform team needs to manage resources across multiple clouds or regions, they should create separate workspaces.")),(0,o.kt)("h2",{id:"structure"},"Structure"),(0,o.kt)("p",null,"The configuration of a workspace is stored in a single YAML file, which consists of three components: ",(0,o.kt)("inlineCode",{parentName:"p"},"modules"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"runtimes"),", and ",(0,o.kt)("inlineCode",{parentName:"p"},"backends"),"."),(0,o.kt)("p",null,"A ",(0,o.kt)("inlineCode",{parentName:"p"},"module")," configuration comprises default configs and several patchers, where the name of each patcher must not be ",(0,o.kt)("strong",{parentName:"p"},"default"),". Configurations in the ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," block will be applied to all applications in this workspace and configurations in the patcher block will only be applied to projects in the ",(0,o.kt)("inlineCode",{parentName:"p"},"projectSelector"),". Values in patchers will override default configs with the same field name.\nFor the default configuration or a specific patcher, field keys must be the same as module input field names defined by the module. Module configurations can be found in the ",(0,o.kt)("a",{parentName:"p",href:"../reference/modules"},"Kusion Modules")),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"runtime")," configuration currently supports Kubernetes and Terraform, where the former includes the field ",(0,o.kt)("inlineCode",{parentName:"p"},"kubeConfig")," to specify the path of Kube Config, and the latter contains data for Terraform providers, which vary across different providers. For Terraform providers, sensitive data should be stored in environment variables."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"backend")," configuration currently supports local, oss, s3, database, and http. This defines the backend for state, intent, and other Kusion data that may require storage in the future. This format requires that all Kusion data share the same backend. As with sensitive data in the runtime configuration, these details should also be stored in environment variables. Backend configurations can be found in the ",(0,o.kt)("a",{parentName:"p",href:"backend-configuration"},"Backend Configuration")),(0,o.kt)("p",null,"An example is shown as below:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-yaml"},"# Module input, each with the format standard\uff1a\n# # :\n# # default: # default configurations, applied to all projects\n# # : \n# # : \n# # ...\n# # : #patcher configurations, applied to the projects assigned in projectSelector\n# # : \n# # ...\n# # projectSelector:\n# # - \n# # ...\nmodules:\n database:\n default:\n provider: aws\n size: 20\n instanceClass: db.t3.micro\n securityIPs:\n - 10.0.0.0/18\n smallClass:\n size: 50\n instanceClass: db.t3.small\n projectSelector:\n - foo\n - bar\n largeClass:\n instanceClass: db.t3.large\n projectSelector:\n - baz\n \n# A set of runtime configs, each with the format standard:\n# # :\n# # : \n# # : \n# # ...\nruntimes:\n kubernetes:\n kubeConfig: /etc/kubeconfig.yaml\n terraform:\n aws:\n version: 1.0.4\n source: hashicorp/aws\n region: us-east-1\n \n# A set of backend configs, each with the following format standard:\n# # :\n# # : \n# # : \n# # ...\nbackends:\n s3: \n bucket: kusion\n region: us-east-1\n")),(0,o.kt)("h2",{id:"workflow"},"Workflow"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"Write the ",(0,o.kt)("inlineCode",{parentName:"li"},"workspace.yaml")," with the format shown above and fulfill all necessary fields."),(0,o.kt)("li",{parentName:"ol"},"Create a workspace with ",(0,o.kt)("inlineCode",{parentName:"li"},"kusion worksapce create -f "),"\nA new workspace configuration file named ",(0,o.kt)("inlineCode",{parentName:"li"},".yaml")," will be created under the path ",(0,o.kt)("inlineCode",{parentName:"li"},"$KUSION_PATH/.workspace"),", and the validation will be done before the creation."),(0,o.kt)("li",{parentName:"ol"},"Update a workspace with ",(0,o.kt)("inlineCode",{parentName:"li"},"kusion worksapce update -f "),"\nThe workspace will be updated with the latest values."),(0,o.kt)("li",{parentName:"ol"},"Delete a workspace with ",(0,o.kt)("inlineCode",{parentName:"li"},"kusion workspace delete ")," if you don't need it anymore.")),(0,o.kt)("p",null,"More workspace commands can be found in the ",(0,o.kt)("a",{parentName:"p",href:"../reference/commands/kusion-workspace"},"reference"),"."))}d.isMDXComponent=!0},27137:(e,n,t)=>{t.d(n,{Z:()=>a});const a=t.p+"assets/images/workspace-project-stack-35aa4e25ab80fe4a1a6bbfbbe024e127.png"}}]); \ No newline at end of file diff --git a/assets/js/05e2121e.009d4753.js b/assets/js/05e2121e.009d4753.js new file mode 100644 index 00000000000..788633c43da --- /dev/null +++ b/assets/js/05e2121e.009d4753.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1750],{3905:(e,n,t)=>{t.d(n,{Zo:()=>l,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),p=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},l=function(e){var n=p(e.components);return r.createElement(c.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),f=p(t),m=o,d=f["".concat(c,".").concat(m)]||f[m]||u[m]||i;return t?r.createElement(d,a(a({ref:n},l),{},{components:t})):r.createElement(d,a({ref:n},l))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=f;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var p=2;p{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>p});var r=t(87462),o=(t(67294),t(3905));const i={},a="kusion version",s={unversionedId:"reference/commands/kusion-version",id:"reference/commands/kusion-version",title:"kusion version",description:"Print the Kusion version information for the current context",source:"@site/docs/kusion/6-reference/1-commands/kusion-version.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-version",permalink:"/docs/next/reference/commands/kusion-version",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-version.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion stack",permalink:"/docs/next/reference/commands/kusion-stack"},next:{title:"kusion workspace create",permalink:"/docs/next/reference/commands/kusion-workspace-create"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},l,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-version"},"kusion version"),(0,o.kt)("p",null,"Print the Kusion version information for the current context"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Print the Kusion version information for the current context"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion version [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Print the Kusion version\n kusion version\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for version\n -o, --output string Output format. Only json format is supported for now\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/05e2121e.4e566dd6.js b/assets/js/05e2121e.4e566dd6.js deleted file mode 100644 index f4cad6d3231..00000000000 --- a/assets/js/05e2121e.4e566dd6.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1750],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},l=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),f=p(n),m=o,d=f["".concat(c,".").concat(m)]||f[m]||u[m]||i;return n?r.createElement(d,a(a({ref:t},l),{},{components:n})):r.createElement(d,a({ref:t},l))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=f;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>p});var r=n(87462),o=(n(67294),n(3905));const i={},a="kusion version",s={unversionedId:"reference/commands/kusion-version",id:"reference/commands/kusion-version",title:"kusion version",description:"Print the Kusion version information for the current context",source:"@site/docs/kusion/6-reference/1-commands/kusion-version.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-version",permalink:"/docs/next/reference/commands/kusion-version",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-version.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion stack",permalink:"/docs/next/reference/commands/kusion-stack"},next:{title:"kusion workspace create",permalink:"/docs/next/reference/commands/kusion-workspace-create"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-version"},"kusion version"),(0,o.kt)("p",null,"Print the Kusion version information for the current context"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Print the Kusion version information for the current context"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion version [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Print the Kusion version\n kusion version\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for version\n -o, --output string Output format. Only json format is supported for now\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/064aa373.70aaf374.js b/assets/js/064aa373.70aaf374.js deleted file mode 100644 index 1572d40548c..00000000000 --- a/assets/js/064aa373.70aaf374.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4867],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),d=s(n),m=a,f=d["".concat(p,".").concat(m)]||d[m]||u[m]||o;return n?r.createElement(f,l(l({ref:t},c),{},{components:n})):r.createElement(f,l({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=d;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>s});var r=n(87462),a=(n(67294),n(3905));const o={},l="appconfiguration",i={unversionedId:"reference/modules/developer-schemas/app-configuration",id:"version-v0.11/reference/modules/developer-schemas/app-configuration",title:"appconfiguration",description:"Schema AppConfiguration",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/app-configuration.md",sourceDirName:"6-reference/2-modules/1-developer-schemas",slug:"/reference/modules/developer-schemas/app-configuration",permalink:"/docs/reference/modules/developer-schemas/app-configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/app-configuration.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Kusion Modules",permalink:"/docs/reference/modules/"},next:{title:"mysql",permalink:"/docs/reference/modules/developer-schemas/database/mysql"}},p={},s=[{value:"Schema AppConfiguration",id:"schema-appconfiguration",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],c={toc:s};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"appconfiguration"},"appconfiguration"),(0,a.kt)("h2",{id:"schema-appconfiguration"},"Schema AppConfiguration"),(0,a.kt)("p",null,"AppConfiguration is a developer-centric definition that describes how to run an Application.",(0,a.kt)("br",null),"This application model builds upon a decade of experience at AntGroup running super large scale",(0,a.kt)("br",null),"internal developer platform, combined with best-of-breed ideas and practices from the community."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"accessories")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:any}"),(0,a.kt)("td",{parentName:"tr",align:null},"Accessories defines a collection of accessories that will be attached to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{}")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Annotations are key/value pairs that attach arbitrary non-identifying metadata to resources."),(0,a.kt)("td",{parentName:"tr",align:null},"{}")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Labels can be used to attach arbitrary metadata as key-value pairs to resources."),(0,a.kt)("td",{parentName:"tr",align:null},"{}")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"workload")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"workload/service#schema-service"},"wl.Service")," ","|"," ",(0,a.kt)("a",{parentName:"td",href:"workload/job#schema-job"},"wl.Job")),(0,a.kt)("td",{parentName:"tr",align:null},"Workload defines how to run your application code. Currently supported workload profile",(0,a.kt)("br",null),"includes Service and Job."),(0,a.kt)("td",{parentName:"tr",align:null},"N/A")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'# Instantiate an App with a long-running service and its image is "nginx:v1"\n\nimport kam as ac\nimport kam.workload as wl\nimport kam.workload.container as c\n\nhelloworld : ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "nginx": c.Container {\n image: "nginx:v1"\n }\n }\n }\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/064aa373.b5b64da4.js b/assets/js/064aa373.b5b64da4.js new file mode 100644 index 00000000000..8eedbf548d1 --- /dev/null +++ b/assets/js/064aa373.b5b64da4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4867],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),d=s(n),m=a,f=d["".concat(p,".").concat(m)]||d[m]||u[m]||o;return n?r.createElement(f,l(l({ref:t},c),{},{components:n})):r.createElement(f,l({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=d;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>s});var r=n(87462),a=(n(67294),n(3905));const o={},l="appconfiguration",i={unversionedId:"reference/modules/developer-schemas/app-configuration",id:"version-v0.11/reference/modules/developer-schemas/app-configuration",title:"appconfiguration",description:"Schema AppConfiguration",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/app-configuration.md",sourceDirName:"6-reference/2-modules/1-developer-schemas",slug:"/reference/modules/developer-schemas/app-configuration",permalink:"/docs/reference/modules/developer-schemas/app-configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/app-configuration.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Kusion Modules",permalink:"/docs/reference/modules/"},next:{title:"mysql",permalink:"/docs/reference/modules/developer-schemas/database/mysql"}},p={},s=[{value:"Schema AppConfiguration",id:"schema-appconfiguration",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],c={toc:s};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"appconfiguration"},"appconfiguration"),(0,a.kt)("h2",{id:"schema-appconfiguration"},"Schema AppConfiguration"),(0,a.kt)("p",null,"AppConfiguration is a developer-centric definition that describes how to run an Application.",(0,a.kt)("br",null),"This application model builds upon a decade of experience at AntGroup running super large scale",(0,a.kt)("br",null),"internal developer platform, combined with best-of-breed ideas and practices from the community."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"accessories")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:any}"),(0,a.kt)("td",{parentName:"tr",align:null},"Accessories defines a collection of accessories that will be attached to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{}")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Annotations are key/value pairs that attach arbitrary non-identifying metadata to resources."),(0,a.kt)("td",{parentName:"tr",align:null},"{}")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Labels can be used to attach arbitrary metadata as key-value pairs to resources."),(0,a.kt)("td",{parentName:"tr",align:null},"{}")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"workload")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"workload/service#schema-service"},"wl.Service")," ","|"," ",(0,a.kt)("a",{parentName:"td",href:"workload/job#schema-job"},"wl.Job")),(0,a.kt)("td",{parentName:"tr",align:null},"Workload defines how to run your application code. Currently supported workload profile",(0,a.kt)("br",null),"includes Service and Job."),(0,a.kt)("td",{parentName:"tr",align:null},"N/A")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'# Instantiate an App with a long-running service and its image is "nginx:v1"\n\nimport kam as ac\nimport kam.workload as wl\nimport kam.workload.container as c\n\nhelloworld : ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "nginx": c.Container {\n image: "nginx:v1"\n }\n }\n }\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/082d3c28.2643487a.js b/assets/js/082d3c28.2643487a.js new file mode 100644 index 00000000000..a5e46491ad6 --- /dev/null +++ b/assets/js/082d3c28.2643487a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8245],{3905:(e,t,a)=>{a.d(t,{Zo:()=>m,kt:()=>u});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},m=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),c=s(a),u=r,k=c["".concat(p,".").concat(u)]||c[u]||d[u]||l;return a?n.createElement(k,i(i({ref:t},m),{},{components:a})):n.createElement(k,i({ref:t},m))}));function u(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,i=new Array(l);i[0]=c;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var s=2;s{a.r(t),a.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>d,frontMatter:()=>l,metadata:()=>o,toc:()=>s});var n=a(87462),r=(a(67294),a(3905));const l={},i="service",o={unversionedId:"reference/modules/developer-schemas/workload/service",id:"reference/modules/developer-schemas/workload/service",title:"service",description:"Schemas",source:"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/workload/service.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/workload",slug:"/reference/modules/developer-schemas/workload/service",permalink:"/docs/next/reference/modules/developer-schemas/workload/service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/1-developer-schemas/workload/service.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"job",permalink:"/docs/next/reference/modules/developer-schemas/workload/job"},next:{title:"mysql",permalink:"/docs/next/reference/modules/workspace-configs/database/mysql"}},p={},s=[{value:"Schemas",id:"schemas",level:2},{value:"Schema Service",id:"schema-service",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Base Schema",id:"base-schema",level:3},{value:"Schema Container",id:"schema-container",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3},{value:"Schema FileSpec",id:"schema-filespec",level:2},{value:"Attributes",id:"attributes-2",level:3},{value:"Examples",id:"examples-2",level:3},{value:"Schema Lifecycle",id:"schema-lifecycle",level:3},{value:"Attributes",id:"attributes-3",level:4},{value:"Examples",id:"examples-3",level:4},{value:"Schema Exec",id:"schema-exec",level:3},{value:"Attributes",id:"attributes-4",level:4},{value:"Examples",id:"examples-4",level:4},{value:"Schema Http",id:"schema-http",level:3},{value:"Attributes",id:"attributes-5",level:4},{value:"Examples",id:"examples-5",level:4},{value:"Schema Probe",id:"schema-probe",level:3},{value:"Attributes",id:"attributes-6",level:4},{value:"Examples",id:"examples-6",level:4},{value:"Schema Tcp",id:"schema-tcp",level:3},{value:"Attributes",id:"attributes-7",level:4},{value:"Examples",id:"examples-7",level:4},{value:"Schema Secret",id:"schema-secret",level:2},{value:"Attributes",id:"attributes-8",level:3},{value:"Examples",id:"examples-8",level:3}],m={toc:s};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},m,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"service"},"service"),(0,r.kt)("h2",{id:"schemas"},"Schemas"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-service"},"Service"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-container"},"Container"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-filespec"},"Filespec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-lifecycle"},"LifeCycle")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-probe"},"Probe"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-exec"},"Exec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-http"},"Http")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-tcp"},"Tcp")))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-secret"},"Secret"))))),(0,r.kt)("h2",{id:"schema-service"},"Schema Service"),(0,r.kt)("p",null,"Service is a kind of workload profile that describes how to run your application code. This",(0,r.kt)("br",null),'is typically used for long-running web applications that should "never" go down, and handle',(0,r.kt)("br",null),"short-lived latency-sensitive web requests, or events."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"annotations")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"containers")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:}"),(0,r.kt)("td",{parentName:"tr",align:null},"Containers defines the templates of containers to be ran.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers"},"https://kubernetes.io/docs/concepts/containers")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"labels")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Labels are key/value pairs that are attached to the workload."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"replicas")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Number of container replicas based on this configuration that should be ran."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"secrets")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:",(0,r.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/secret/#schema-secret"},"Secret"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Secrets can be used to store small amount of sensitive data e.g. password, token."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'# Instantiate a long-running service and its image is "nginx:v1"\n\nimport kam.workload as wl\nimport kam.workload.container as c\n\nnginxSvc : wl.Service {\n containers: {\n "nginx": c.Container {\n image: "nginx:v1"\n }\n }\n}\n')),(0,r.kt)("h3",{id:"base-schema"},"Base Schema"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../internal/common#schema-workloadbase"},"WorkloadBase")),(0,r.kt)("h2",{id:"schema-container"},"Schema Container"),(0,r.kt)("p",null,"Container describes how the Application's tasks are expected to be run. Depending on",(0,r.kt)("br",null),"the replicas parameter 1 or more containers can be created from each template."),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"args")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Arguments to the entrypoint.",(0,r.kt)("br",null),"Args will overwrite the CMD value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's CMD is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Entrypoint array. Not executed within a shell.",(0,r.kt)("br",null),"Command will overwrite the ENTRYPOINT value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's ENTRYPOINT is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"dirs")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of volumes mount into the container's filesystem.",(0,r.kt)("br",null),"The dirs parameter is a dict with the key being the folder name in the container and the value",(0,r.kt)("br",null),"being the referenced volume."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"env")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"List of environment variables to set in the container.",(0,r.kt)("br",null),"The value of the environment variable may be static text or a value from a secret."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"files")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:",(0,r.kt)("a",{parentName:"td",href:"#filespec"},"FileSpec"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"List of files to create in the container.",(0,r.kt)("br",null),"The files parameter is a dict with the key being the file name in the container and the value",(0,r.kt)("br",null),"being the target file specification."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"image")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Image refers to the Docker image name to run for this container.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/images"},"https://kubernetes.io/docs/concepts/containers/images")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/container/lifecycle/#schema-lifecycle"},"lc.Lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},"Lifecycle refers to actions that the management system should take in response to container lifecycle events."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"livenessProbe")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"LivenessProbe indicates if a running process is healthy.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"readinessProbe")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"ReadinessProbe indicates whether an application is available to handle requests."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"resources")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Map of resource requirements the container should run with.",(0,r.kt)("br",null),"The resources parameter is a dict with the key being the resource name and the value being",(0,r.kt)("br",null),"the resource value."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"startupProbe")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"StartupProbe indicates that the container has started for the first time.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"workingDir")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The working directory of the running process defined in entrypoint.",(0,r.kt)("br",null),"Default container runtime will be used if this is not specified."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container as c\n\nweb = c.Container {\n image: "nginx:latest"\n command: ["/bin/sh", "-c", "echo hi"]\n env: {\n "name": "value"\n }\n resources: {\n "cpu": "2"\n "memory": "4Gi"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-filespec"},"Schema FileSpec"),(0,r.kt)("p",null,"FileSpec defines the target file in a Container."),(0,r.kt)("h3",{id:"attributes-2"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"content")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"File content in plain text."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"contentFrom")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Source for the file content, reference to a secret of configmap value."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"mode")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Mode bits used to set permissions on this file, must be an octal value",(0,r.kt)("br",null),"between 0000 and 0777 or a decimal value between 0 and 511"),(0,r.kt)("td",{parentName:"tr",align:null},'"0644"')))),(0,r.kt)("h3",{id:"examples-2"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container as c\n\ntmpFile = c.FileSpec {\n content: "some file contents"\n mode: "0777"\n}\n')),(0,r.kt)("h3",{id:"schema-lifecycle"},"Schema Lifecycle"),(0,r.kt)("p",null,"Lifecycle describes actions that the management system should take in response to container lifecycle events."),(0,r.kt)("h4",{id:"attributes-3"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"postStart")),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null},"The action to be taken after a container is created.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"preStop")),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null},"The action to be taken before a container is terminated due to an API request or",(0,r.kt)("br",null),"management event such as liveness/startup probe failure, preemption, resource contention, etc.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"))))),(0,r.kt)("h4",{id:"examples-3"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\nimport kam.workload.container.lifecycle as lc\n\nlifecycleHook = lc.Lifecycle {\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n postStart: p.Http {\n url: "http://localhost:80"\n }\n}\n')),(0,r.kt)("h3",{id:"schema-exec"},"Schema Exec"),(0,r.kt)("p",null,'Exec describes a "run in container" action.'),(0,r.kt)("h4",{id:"attributes-4"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"The command line to execute inside the container."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-4"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\nexecProbe = p.Exec {\n command: ["probe.sh"]\n}\n')),(0,r.kt)("h3",{id:"schema-http"},"Schema Http"),(0,r.kt)("p",null,"Http describes an action based on HTTP Get requests."),(0,r.kt)("h4",{id:"attributes-5"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"headers")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of custom headers to set in the request"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The full qualified url to send HTTP requests."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-5"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\nhttpProbe = p.Http {\n url: "http://localhost:80"\n headers: {\n "X-HEADER": "VALUE"\n }\n}\n')),(0,r.kt)("h3",{id:"schema-probe"},"Schema Probe"),(0,r.kt)("p",null,"Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic. There are three probe types: readiness, liveness, and startup."),(0,r.kt)("h4",{id:"attributes-6"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"failureThreshold")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimum consecutive failures for the probe to be considered failed after having succeeded."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"initialDelaySeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"The number of seconds before health checking is activated.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"periodSeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"How often (in seconds) to perform the probe."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"probeHandler")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#exec"},"Exec")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#http"},"Http")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#tcp"},"Tcp"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"successThreshold")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimum consecutive successes for the probe to be considered successful after having failed."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"terminationGracePeriod")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Duration in seconds before terminate gracefully upon probe failure."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"timeoutSeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"The number of seconds after which the probe times out.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-6"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\nprobe = p.Probe {\n probeHandler: p.Http {\n path: "/healthz"\n }\n initialDelaySeconds: 10\n}\n')),(0,r.kt)("h3",{id:"schema-tcp"},"Schema Tcp"),(0,r.kt)("p",null,"Tcp describes an action based on opening a socket."),(0,r.kt)("h4",{id:"attributes-7"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The full qualified url to open a socket."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-7"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\ntcpProbe = p.Tcp {\n url: "tcp://localhost:1234"\n}\n')),(0,r.kt)("h2",{id:"schema-secret"},"Schema Secret"),(0,r.kt)("p",null,"Secret can be used to store sensitive data."),(0,r.kt)("h3",{id:"attributes-8"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"data")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Data contains the non-binary secret data in string form."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"immutable")),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"Immutable, if set to true, ensures that data stored in the Secret cannot be updated."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"params")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of parameters used to facilitate programmatic handling of secret data."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},'"basic"'),(0,r.kt)("td",{parentName:"tr",align:null},'"token"'),(0,r.kt)("td",{parentName:"tr",align:null},'"opaque"')))),(0,r.kt)("h3",{id:"examples-8"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.secret as sec\n\nbasicAuth = sec.Secret {\n type: "basic"\n data: {\n "username": ""\n "password": ""\n }\n}\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/082d3c28.c33a4fee.js b/assets/js/082d3c28.c33a4fee.js deleted file mode 100644 index 3820faaa0a6..00000000000 --- a/assets/js/082d3c28.c33a4fee.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8245],{3905:(e,t,a)=>{a.d(t,{Zo:()=>m,kt:()=>u});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},m=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),c=s(a),u=r,k=c["".concat(p,".").concat(u)]||c[u]||d[u]||l;return a?n.createElement(k,i(i({ref:t},m),{},{components:a})):n.createElement(k,i({ref:t},m))}));function u(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,i=new Array(l);i[0]=c;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var s=2;s{a.r(t),a.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>d,frontMatter:()=>l,metadata:()=>o,toc:()=>s});var n=a(87462),r=(a(67294),a(3905));const l={},i="service",o={unversionedId:"reference/modules/developer-schemas/workload/service",id:"reference/modules/developer-schemas/workload/service",title:"service",description:"Schemas",source:"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/workload/service.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/workload",slug:"/reference/modules/developer-schemas/workload/service",permalink:"/docs/next/reference/modules/developer-schemas/workload/service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/1-developer-schemas/workload/service.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"job",permalink:"/docs/next/reference/modules/developer-schemas/workload/job"},next:{title:"mysql",permalink:"/docs/next/reference/modules/workspace-configs/database/mysql"}},p={},s=[{value:"Schemas",id:"schemas",level:2},{value:"Schema Service",id:"schema-service",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Base Schema",id:"base-schema",level:3},{value:"Schema Container",id:"schema-container",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3},{value:"Schema FileSpec",id:"schema-filespec",level:2},{value:"Attributes",id:"attributes-2",level:3},{value:"Examples",id:"examples-2",level:3},{value:"Schema Lifecycle",id:"schema-lifecycle",level:3},{value:"Attributes",id:"attributes-3",level:4},{value:"Examples",id:"examples-3",level:4},{value:"Schema Exec",id:"schema-exec",level:3},{value:"Attributes",id:"attributes-4",level:4},{value:"Examples",id:"examples-4",level:4},{value:"Schema Http",id:"schema-http",level:3},{value:"Attributes",id:"attributes-5",level:4},{value:"Examples",id:"examples-5",level:4},{value:"Schema Probe",id:"schema-probe",level:3},{value:"Attributes",id:"attributes-6",level:4},{value:"Examples",id:"examples-6",level:4},{value:"Schema Tcp",id:"schema-tcp",level:3},{value:"Attributes",id:"attributes-7",level:4},{value:"Examples",id:"examples-7",level:4},{value:"Schema Secret",id:"schema-secret",level:2},{value:"Attributes",id:"attributes-8",level:3},{value:"Examples",id:"examples-8",level:3}],m={toc:s};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},m,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"service"},"service"),(0,r.kt)("h2",{id:"schemas"},"Schemas"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-service"},"Service"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-container"},"Container"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-filespec"},"Filespec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-lifecycle"},"LifeCycle")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-probe"},"Probe"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-exec"},"Exec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-http"},"Http")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-tcp"},"Tcp")))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-secret"},"Secret"))))),(0,r.kt)("h2",{id:"schema-service"},"Schema Service"),(0,r.kt)("p",null,"Service is a kind of workload profile that describes how to run your application code. This",(0,r.kt)("br",null),'is typically used for long-running web applications that should "never" go down, and handle',(0,r.kt)("br",null),"short-lived latency-sensitive web requests, or events."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"annotations")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"containers")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:}"),(0,r.kt)("td",{parentName:"tr",align:null},"Containers defines the templates of containers to be ran.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers"},"https://kubernetes.io/docs/concepts/containers")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"labels")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Labels are key/value pairs that are attached to the workload."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"replicas")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Number of container replicas based on this configuration that should be ran."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"secrets")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:",(0,r.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/secret/#schema-secret"},"Secret"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Secrets can be used to store small amount of sensitive data e.g. password, token."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'# Instantiate a long-running service and its image is "nginx:v1"\n\nimport kam.workload as wl\nimport kam.workload.container as c\n\nnginxSvc : wl.Service {\n containers: {\n "nginx": c.Container {\n image: "nginx:v1"\n }\n }\n}\n')),(0,r.kt)("h3",{id:"base-schema"},"Base Schema"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../internal/common#schema-workloadbase"},"WorkloadBase")),(0,r.kt)("h2",{id:"schema-container"},"Schema Container"),(0,r.kt)("p",null,"Container describes how the Application's tasks are expected to be run. Depending on",(0,r.kt)("br",null),"the replicas parameter 1 or more containers can be created from each template."),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"args")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Arguments to the entrypoint.",(0,r.kt)("br",null),"Args will overwrite the CMD value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's CMD is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Entrypoint array. Not executed within a shell.",(0,r.kt)("br",null),"Command will overwrite the ENTRYPOINT value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's ENTRYPOINT is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"dirs")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of volumes mount into the container's filesystem.",(0,r.kt)("br",null),"The dirs parameter is a dict with the key being the folder name in the container and the value",(0,r.kt)("br",null),"being the referenced volume."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"env")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"List of environment variables to set in the container.",(0,r.kt)("br",null),"The value of the environment variable may be static text or a value from a secret."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"files")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:",(0,r.kt)("a",{parentName:"td",href:"#filespec"},"FileSpec"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"List of files to create in the container.",(0,r.kt)("br",null),"The files parameter is a dict with the key being the file name in the container and the value",(0,r.kt)("br",null),"being the target file specification."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"image")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Image refers to the Docker image name to run for this container.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/images"},"https://kubernetes.io/docs/concepts/containers/images")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/container/lifecycle/#schema-lifecycle"},"lc.Lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},"Lifecycle refers to actions that the management system should take in response to container lifecycle events."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"livenessProbe")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"LivenessProbe indicates if a running process is healthy.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"readinessProbe")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"ReadinessProbe indicates whether an application is available to handle requests."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"resources")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Map of resource requirements the container should run with.",(0,r.kt)("br",null),"The resources parameter is a dict with the key being the resource name and the value being",(0,r.kt)("br",null),"the resource value."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"startupProbe")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"StartupProbe indicates that the container has started for the first time.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"workingDir")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The working directory of the running process defined in entrypoint.",(0,r.kt)("br",null),"Default container runtime will be used if this is not specified."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container as c\n\nweb = c.Container {\n image: "nginx:latest"\n command: ["/bin/sh", "-c", "echo hi"]\n env: {\n "name": "value"\n }\n resources: {\n "cpu": "2"\n "memory": "4Gi"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-filespec"},"Schema FileSpec"),(0,r.kt)("p",null,"FileSpec defines the target file in a Container."),(0,r.kt)("h3",{id:"attributes-2"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"content")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"File content in plain text."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"contentFrom")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Source for the file content, reference to a secret of configmap value."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"mode")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Mode bits used to set permissions on this file, must be an octal value",(0,r.kt)("br",null),"between 0000 and 0777 or a decimal value between 0 and 511"),(0,r.kt)("td",{parentName:"tr",align:null},'"0644"')))),(0,r.kt)("h3",{id:"examples-2"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container as c\n\ntmpFile = c.FileSpec {\n content: "some file contents"\n mode: "0777"\n}\n')),(0,r.kt)("h3",{id:"schema-lifecycle"},"Schema Lifecycle"),(0,r.kt)("p",null,"Lifecycle describes actions that the management system should take in response to container lifecycle events."),(0,r.kt)("h4",{id:"attributes-3"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"postStart")),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null},"The action to be taken after a container is created.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"preStop")),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null},"The action to be taken before a container is terminated due to an API request or",(0,r.kt)("br",null),"management event such as liveness/startup probe failure, preemption, resource contention, etc.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"))))),(0,r.kt)("h4",{id:"examples-3"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\nimport kam.workload.container.lifecycle as lc\n\nlifecycleHook = lc.Lifecycle {\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n postStart: p.Http {\n url: "http://localhost:80"\n }\n}\n')),(0,r.kt)("h3",{id:"schema-exec"},"Schema Exec"),(0,r.kt)("p",null,'Exec describes a "run in container" action.'),(0,r.kt)("h4",{id:"attributes-4"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"The command line to execute inside the container."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-4"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\nexecProbe = p.Exec {\n command: ["probe.sh"]\n}\n')),(0,r.kt)("h3",{id:"schema-http"},"Schema Http"),(0,r.kt)("p",null,"Http describes an action based on HTTP Get requests."),(0,r.kt)("h4",{id:"attributes-5"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"headers")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of custom headers to set in the request"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The full qualified url to send HTTP requests."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-5"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\nhttpProbe = p.Http {\n url: "http://localhost:80"\n headers: {\n "X-HEADER": "VALUE"\n }\n}\n')),(0,r.kt)("h3",{id:"schema-probe"},"Schema Probe"),(0,r.kt)("p",null,"Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic. There are three probe types: readiness, liveness, and startup."),(0,r.kt)("h4",{id:"attributes-6"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"failureThreshold")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimum consecutive failures for the probe to be considered failed after having succeeded."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"initialDelaySeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"The number of seconds before health checking is activated.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"periodSeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"How often (in seconds) to perform the probe."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"probeHandler")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#exec"},"Exec")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#http"},"Http")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#tcp"},"Tcp"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"successThreshold")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimum consecutive successes for the probe to be considered successful after having failed."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"terminationGracePeriod")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Duration in seconds before terminate gracefully upon probe failure."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"timeoutSeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"The number of seconds after which the probe times out.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-6"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\nprobe = p.Probe {\n probeHandler: p.Http {\n path: "/healthz"\n }\n initialDelaySeconds: 10\n}\n')),(0,r.kt)("h3",{id:"schema-tcp"},"Schema Tcp"),(0,r.kt)("p",null,"Tcp describes an action based on opening a socket."),(0,r.kt)("h4",{id:"attributes-7"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The full qualified url to open a socket."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-7"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\ntcpProbe = p.Tcp {\n url: "tcp://localhost:1234"\n}\n')),(0,r.kt)("h2",{id:"schema-secret"},"Schema Secret"),(0,r.kt)("p",null,"Secret can be used to store sensitive data."),(0,r.kt)("h3",{id:"attributes-8"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"data")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Data contains the non-binary secret data in string form."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"immutable")),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"Immutable, if set to true, ensures that data stored in the Secret cannot be updated."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"params")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of parameters used to facilitate programmatic handling of secret data."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},'"basic"'),(0,r.kt)("td",{parentName:"tr",align:null},'"token"'),(0,r.kt)("td",{parentName:"tr",align:null},'"opaque"')))),(0,r.kt)("h3",{id:"examples-8"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.secret as sec\n\nbasicAuth = sec.Secret {\n type: "basic"\n data: {\n "username": ""\n "password": ""\n }\n}\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/091a426a.21792e07.js b/assets/js/091a426a.21792e07.js new file mode 100644 index 00000000000..fe1d2f74405 --- /dev/null +++ b/assets/js/091a426a.21792e07.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3334],{3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function s(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var i=n.createContext({}),c=function(e){var t=n.useContext(i),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},u=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},p=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),p=c(a),m=r,k=p["".concat(i,".").concat(m)]||p[m]||d[m]||o;return a?n.createElement(k,s(s({ref:t},u),{},{components:a})):n.createElement(k,s({ref:t},u))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=p;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,s[1]=l;for(var c=2;c{a.d(t,{Z:()=>s});var n=a(67294),r=a(86010);const o="tabItem_Ymn6";function s(e){let{children:t,hidden:a,className:s}=e;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(o,s),hidden:a},t)}},74866:(e,t,a)=>{a.d(t,{Z:()=>N});var n=a(87462),r=a(67294),o=a(86010),s=a(12466),l=a(76775),i=a(91980),c=a(67392),u=a(50012);function d(e){return function(e){var t;return(null==(t=r.Children.map(e,(e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})))?void 0:t.filter(Boolean))??[]}(e).map((e=>{let{props:{value:t,label:a,attributes:n,default:r}}=e;return{value:t,label:a,attributes:n,default:r}}))}function p(e){const{values:t,children:a}=e;return(0,r.useMemo)((()=>{const e=t??d(a);return function(e){const t=(0,c.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,a])}function m(e){let{value:t,tabValues:a}=e;return a.some((e=>e.value===t))}function k(e){let{queryString:t=!1,groupId:a}=e;const n=(0,l.k6)(),o=function(e){let{queryString:t=!1,groupId:a}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!a)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return a??null}({queryString:t,groupId:a});return[(0,i._X)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(n.location.search);t.set(o,e),n.replace({...n.location,search:t.toString()})}),[o,n])]}function h(e){const{defaultValue:t,queryString:a=!1,groupId:n}=e,o=p(e),[s,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:a}=e;if(0===a.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:a}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${a.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const n=a.find((e=>e.default))??a[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:o}))),[i,c]=k({queryString:a,groupId:n}),[d,h]=function(e){let{groupId:t}=e;const a=function(e){return e?`docusaurus.tab.${e}`:null}(t),[n,o]=(0,u.Nk)(a);return[n,(0,r.useCallback)((e=>{a&&o.set(e)}),[a,o])]}({groupId:n}),f=(()=>{const e=i??d;return m({value:e,tabValues:o})?e:null})();(0,r.useLayoutEffect)((()=>{f&&l(f)}),[f]);return{selectedValue:s,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),c(e),h(e)}),[c,h,o]),tabValues:o}}var f=a(72389);const w="tabList__CuJ",g="tabItem_LNqP";function b(e){let{className:t,block:a,selectedValue:l,selectValue:i,tabValues:c}=e;const u=[],{blockElementScrollPositionUntilNextRender:d}=(0,s.o5)(),p=e=>{const t=e.currentTarget,a=u.indexOf(t),n=c[a].value;n!==l&&(d(t),i(n))},m=e=>{var t;let a=null;switch(e.key){case"Enter":p(e);break;case"ArrowRight":{const t=u.indexOf(e.currentTarget)+1;a=u[t]??u[0];break}case"ArrowLeft":{const t=u.indexOf(e.currentTarget)-1;a=u[t]??u[u.length-1];break}}null==(t=a)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":a},t)},c.map((e=>{let{value:t,label:a,attributes:s}=e;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:l===t?0:-1,"aria-selected":l===t,key:t,ref:e=>u.push(e),onKeyDown:m,onClick:p},s,{className:(0,o.Z)("tabs__item",g,null==s?void 0:s.className,{"tabs__item--active":l===t})}),a??t)})))}function y(e){let{lazy:t,children:a,selectedValue:n}=e;const o=(Array.isArray(a)?a:[a]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===n));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==n}))))}function v(e){const t=h(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",w)},r.createElement(b,(0,n.Z)({},e,t)),r.createElement(y,(0,n.Z)({},e,t)))}function N(e){const t=(0,f.Z)();return r.createElement(v,(0,n.Z)({key:String(t)},e))}},45413:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>c,toc:()=>d});var n=a(87462),r=(a(67294),a(3905)),o=a(74866),s=a(85162);const l={id:"database"},i="Deliver the WordPress Application with Cloud RDS",c={unversionedId:"user-guides/cloud-resources/database",id:"user-guides/cloud-resources/database",title:"Deliver the WordPress Application with Cloud RDS",description:"This tutorial will demonstrate how to deploy a WordPress application with Kusion, which relies on both Kubernetes and IaaS resources provided by cloud vendors. We can learn how to declare the Relational Database Service (RDS) to provide a cloud-based database solution with Kusion for our application from this article.",source:"@site/docs/kusion/5-user-guides/1-cloud-resources/1-database.md",sourceDirName:"5-user-guides/1-cloud-resources",slug:"/user-guides/cloud-resources/database",permalink:"/docs/next/user-guides/cloud-resources/database",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/5-user-guides/1-cloud-resources/1-database.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"database"},sidebar:"kusion",previous:{title:"Operational Rules",permalink:"/docs/next/configuration-walkthrough/operational-rules"},next:{title:"Expose Application Service Deployed on CSP Kubernetes",permalink:"/docs/next/user-guides/cloud-resources/expose-service"}},u={},d=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Init Workspace",id:"init-workspace",level:2},{value:"Create Project And Stack",id:"create-project-and-stack",level:2},{value:"Update And Review Configuration Codes",id:"update-and-review-configuration-codes",level:3},{value:"Application Delivery",id:"application-delivery",level:2},{value:"Verify WordPress Application",id:"verify-wordpress-application",level:2},{value:"Delete WordPress Application",id:"delete-wordpress-application",level:2}],p={toc:d};function m(e){let{components:t,...l}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,l,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"deliver-the-wordpress-application-with-cloud-rds"},"Deliver the WordPress Application with Cloud RDS"),(0,r.kt)("p",null,"This tutorial will demonstrate how to deploy a WordPress application with Kusion, which relies on both Kubernetes and IaaS resources provided by cloud vendors. We can learn how to declare the Relational Database Service (RDS) to provide a cloud-based database solution with Kusion for our application from this article. "),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"/docs/next/getting-started/install-kusion"},"Kusion"),". "),(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/tasks/tools/#kubectl"},"kubectl CLI")," and run a ",(0,r.kt)("a",{parentName:"li",href:"https://kubernetes.io/"},"Kubernetes")," or ",(0,r.kt)("a",{parentName:"li",href:"https://docs.k3s.io/quick-start"},"k3s")," or ",(0,r.kt)("a",{parentName:"li",href:"https://k3d.io/v5.4.4/#installation"},"k3d")," or ",(0,r.kt)("a",{parentName:"li",href:"https://minikube.sigs.k8s.io/docs/tutorials/multi_node"},"MiniKube")," cluster. "),(0,r.kt)("li",{parentName:"ul"},"Prepare a cloud service account and create a user with at least ",(0,r.kt)("strong",{parentName:"li"},"VPCFullAccess")," and ",(0,r.kt)("strong",{parentName:"li"},"RDSFullAccess")," related permissions to use the Relational Database Service (RDS). This kind of user can be created and managed in the Identity and Access Management (IAM) console of the cloud vendor. "),(0,r.kt)("li",{parentName:"ul"},"The environment that executes ",(0,r.kt)("inlineCode",{parentName:"li"},"kusion")," needs to have connectivity to terraform registry to download the terraform providers. ")),(0,r.kt)("p",null,"Additionally, we also need to configure the obtained AccessKey and SecretKey as well as the cloud resource region as environment variables for specific cloud provider: "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'export AWS_ACCESS_KEY_ID="AKIAQZDxxxx" # replace it with your AccessKey\nexport AWS_SECRET_ACCESS_KEY="oE/xxxx" # replace it with your SecretKey\nexport AWS_REGION=us-east-1 # replace it with your region\n')),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"aws iam account",src:a(24838).Z,width:"2874",height:"1398"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'export ALICLOUD_ACCESS_KEY="LTAI5txxx" # replace it with your AccessKey\nexport ALICLOUD_SECRET_KEY="nxuowIxxx" # replace it with your SecretKey\nexport ALICLOUD_REGION=cn-hangzhou # replace it with your region\n')),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"alicloud iam account",src:a(73725).Z,width:"1500",height:"629"})))),(0,r.kt)("h2",{id:"init-workspace"},"Init Workspace"),(0,r.kt)("p",null,"To deploy the WordPress application with cloud rds, we first need to initiate a ",(0,r.kt)("inlineCode",{parentName:"p"},"Workspace")," for the targeted stack (here we are using ",(0,r.kt)("inlineCode",{parentName:"p"},"dev"),"). Please copy the following example YAML file to your local ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),". "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'# MySQL configurations for AWS RDS\nmodules: \n kusionstack/mysql@0.1.0: \n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n privateRouting: false\n databaseName: "wordpress-mysql"\n'))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'# MySQL configurations for Alicloud RDS\nmodules: \n kusionstack/mysql@0.1.0: \n default: \n cloud: alicloud\n size: 20\n instanceType: mysql.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n databaseName: "wordpress-mysql"\n')))),(0,r.kt)("p",null,"If you would like to try creating the ",(0,r.kt)("inlineCode",{parentName:"p"},"Alicloud")," RDS instance, you should replace the ",(0,r.kt)("inlineCode",{parentName:"p"},"[your-subnet-id]")," of ",(0,r.kt)("inlineCode",{parentName:"p"},"modules.kusionstack/mysql@0.1.0.default.subnetID")," field with the Alicloud ",(0,r.kt)("inlineCode",{parentName:"p"},"vSwitchID")," to which the database will be provisioned in. After that, you can execute the following command line to initiate the configuration for ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace create dev -f workspace.yaml\n")),(0,r.kt)("p",null,"Since Kusion by default use the ",(0,r.kt)("inlineCode",{parentName:"p"},"default")," workspace, we can switch to the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace with the following cmd: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace switch dev\n")),(0,r.kt)("p",null,"If you have already created and used the configuration of ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace, you can append the MySQL module configs to your workspace YAML file and use the following command line to update the workspace configuration. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace update dev -f workspace.yaml\n")),(0,r.kt)("p",null,"We can use the following command lines to show the current workspace configurations for ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace show\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," is a sample configuration file for workspace management, including ",(0,r.kt)("inlineCode",{parentName:"p"},"MySQL")," module configs. Workspace configurations are usually declared by ",(0,r.kt)("strong",{parentName:"p"},"Platform Engineers")," and will take effect through the corresponding stack. "),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about the configuration of Workspace can be found in ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/concepts/workspace"},"Concepts of Workspace"),". ")),(0,r.kt)("h2",{id:"create-project-and-stack"},"Create Project And Stack"),(0,r.kt)("p",null,"We can create a new project named ",(0,r.kt)("inlineCode",{parentName:"p"},"wordpress-rds-cloud")," with the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion project create")," command. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"# Create a new directory and navigate into it. \nmkdir wordpress-rds-cloud && cd wordpress-rds-cloud\n\n# Create a new project with the name of the current directory. \nkusion project create\n")),(0,r.kt)("p",null,"After creating the new project, we can create a new stack named ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," with the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion stack create")," command. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"# Create a new stack with the specified name under current project directory. \nkusion stack create dev\n")),(0,r.kt)("p",null,"The created project and stack structure looks like below: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"tree\n.\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n\n2 directories, 4 files\n")),(0,r.kt)("h3",{id:"update-and-review-configuration-codes"},"Update And Review Configuration Codes"),(0,r.kt)("p",null,"The configuration codes in the created stack are basically empty, thus we should replace the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/kcl.mod")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/main.k")," with the below codes: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},'# dev/kcl.mod\n[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\nmysql = { oci = "oci://ghcr.io/kusionstack/mysql", tag = "0.1.0" }\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'# dev/main.k \nimport kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\nimport mysql\n\n# main.k declares customized configurations for dev stacks.\nwordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n wordpress: c.Container {\n image: "wordpress:6.3"\n env: {\n "WORDPRESS_DB_HOST": "$(KUSION_DB_HOST_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_NAME": "mysql"\n }\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n "mysql": mysql.MySQL {\n type: "cloud"\n version: "8.0"\n }\n }\n}\n')),(0,r.kt)("h2",{id:"application-delivery"},"Application Delivery"),(0,r.kt)("p",null,"You can complete the delivery of the WordPress application in the folder of ",(0,r.kt)("inlineCode",{parentName:"p"},"wordpress-cloud-rds/dev")," using the following command line. Kusion will enable the watching of the application resource creation and automatic port-forwarding of the specified port (80) from local to the Kubernetes Service. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"cd dev && kusion apply --watch\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"During the first apply, the models and modules as well as the Terraform CLI (if not exists) that the application depends on will be downloaded, so it may take some time (usually within two minutes). You can take a break and have a cup of coffee. ")),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply the wordpress application with aws rds",src:a(5721).Z,width:"2874",height:"802"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply the wordpress application with alicloud rds",src:a(91609).Z,width:"2876",height:"858"})))),(0,r.kt)("p",null,"After all the resources reconciled, we can port-forward our local port (e.g. 12345) to the WordPress frontend service port (80) in the cluster:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kubectl port-forward -n wordpress-cloud-rds svc/wordpress-cloud-rds-dev-wordpress-private 12345:80\n")),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kubectl port-forward for wordpress",src:a(76831).Z,width:"2874",height:"150"})),(0,r.kt)("h2",{id:"verify-wordpress-application"},"Verify WordPress Application"),(0,r.kt)("p",null,"Next, we will verify the WordPress site service we just delivered, along with the creation of the RDS instance it depends on. We can start using the WordPress site by accessing the link of local-forwarded port ",(0,r.kt)("a",{parentName:"p",href:"http://localhost:12345"},"(http://localhost:12345)")," we just configured in the browser. "),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"wordpress site page",src:a(85773).Z,width:"1500",height:"803"})),(0,r.kt)("p",null,"In addition, we can also log in to the cloud service console page to view the RDS instance we just created."),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"aws rds instance",src:a(42229).Z,width:"2298",height:"706"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"alicloud rds instance",src:a(99782).Z,width:"2870",height:"616"})))),(0,r.kt)("h2",{id:"delete-wordpress-application"},"Delete WordPress Application"),(0,r.kt)("p",null,"You can delete the WordPress application and related RDS resources using the following command line. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion destroy --yes\n")),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kusion destroy wordpress with aws rds",src:a(74068).Z,width:"2874",height:"788"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kusion destroy wordpress with alicloud rds",src:a(72557).Z,width:"2874",height:"820"})))))}m.isMDXComponent=!0},91609:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/apply-wordpress-cloud-rds-alicloud-14224502ce1c4d077fa1ed3777b1add9.png"},5721:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/apply-wordpress-cloud-rds-aws-9c72f8fd79000427958c5376085a65b8.png"},24838:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/aws-iam-account-2216105e7fa18fb2f7bf4be7e19f98bd.png"},99782:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/cloud-rds-instance-alicloud-e2062c7a477d445b3decf429105ab3d6.png"},42229:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/cloud-rds-instance-aws-64d6371851d55e05fb05353bbd9a19b1.png"},72557:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/destroy-wordpress-cloud-rds-alicloud-9c5da68051d92f6a8b3a11db9dd49273.png"},74068:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/destroy-wordpress-cloud-rds-aws-04a2cf44dbce1bcac488f8ce3dcdae81.png"},73725:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/set-rds-access-9347ae09377aeb94d9f6d1e5d8688ab5.png"},76831:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/wordpress-cloud-rds-port-forward-611c4f17d055d9ee941b9ff87a0727f5.png"},85773:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/wordpress-site-page-ef650e640399209d1eec5e6dfe88c454.png"}}]); \ No newline at end of file diff --git a/assets/js/091a426a.2c44207b.js b/assets/js/091a426a.2c44207b.js deleted file mode 100644 index 3b98be7f3e9..00000000000 --- a/assets/js/091a426a.2c44207b.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3334],{3905:(e,t,a)=>{a.d(t,{Zo:()=>u,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function s(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var i=n.createContext({}),c=function(e){var t=n.useContext(i),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},u=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},p=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),p=c(a),m=r,k=p["".concat(i,".").concat(m)]||p[m]||d[m]||o;return a?n.createElement(k,s(s({ref:t},u),{},{components:a})):n.createElement(k,s({ref:t},u))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=p;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,s[1]=l;for(var c=2;c{a.d(t,{Z:()=>s});var n=a(67294),r=a(86010);const o="tabItem_Ymn6";function s(e){let{children:t,hidden:a,className:s}=e;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(o,s),hidden:a},t)}},74866:(e,t,a)=>{a.d(t,{Z:()=>N});var n=a(87462),r=a(67294),o=a(86010),s=a(12466),l=a(76775),i=a(91980),c=a(67392),u=a(50012);function d(e){return function(e){var t;return(null==(t=r.Children.map(e,(e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})))?void 0:t.filter(Boolean))??[]}(e).map((e=>{let{props:{value:t,label:a,attributes:n,default:r}}=e;return{value:t,label:a,attributes:n,default:r}}))}function p(e){const{values:t,children:a}=e;return(0,r.useMemo)((()=>{const e=t??d(a);return function(e){const t=(0,c.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,a])}function m(e){let{value:t,tabValues:a}=e;return a.some((e=>e.value===t))}function k(e){let{queryString:t=!1,groupId:a}=e;const n=(0,l.k6)(),o=function(e){let{queryString:t=!1,groupId:a}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!a)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return a??null}({queryString:t,groupId:a});return[(0,i._X)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(n.location.search);t.set(o,e),n.replace({...n.location,search:t.toString()})}),[o,n])]}function h(e){const{defaultValue:t,queryString:a=!1,groupId:n}=e,o=p(e),[s,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:a}=e;if(0===a.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:a}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${a.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const n=a.find((e=>e.default))??a[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:o}))),[i,c]=k({queryString:a,groupId:n}),[d,h]=function(e){let{groupId:t}=e;const a=function(e){return e?`docusaurus.tab.${e}`:null}(t),[n,o]=(0,u.Nk)(a);return[n,(0,r.useCallback)((e=>{a&&o.set(e)}),[a,o])]}({groupId:n}),f=(()=>{const e=i??d;return m({value:e,tabValues:o})?e:null})();(0,r.useLayoutEffect)((()=>{f&&l(f)}),[f]);return{selectedValue:s,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),c(e),h(e)}),[c,h,o]),tabValues:o}}var f=a(72389);const w="tabList__CuJ",g="tabItem_LNqP";function b(e){let{className:t,block:a,selectedValue:l,selectValue:i,tabValues:c}=e;const u=[],{blockElementScrollPositionUntilNextRender:d}=(0,s.o5)(),p=e=>{const t=e.currentTarget,a=u.indexOf(t),n=c[a].value;n!==l&&(d(t),i(n))},m=e=>{var t;let a=null;switch(e.key){case"Enter":p(e);break;case"ArrowRight":{const t=u.indexOf(e.currentTarget)+1;a=u[t]??u[0];break}case"ArrowLeft":{const t=u.indexOf(e.currentTarget)-1;a=u[t]??u[u.length-1];break}}null==(t=a)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":a},t)},c.map((e=>{let{value:t,label:a,attributes:s}=e;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:l===t?0:-1,"aria-selected":l===t,key:t,ref:e=>u.push(e),onKeyDown:m,onClick:p},s,{className:(0,o.Z)("tabs__item",g,null==s?void 0:s.className,{"tabs__item--active":l===t})}),a??t)})))}function y(e){let{lazy:t,children:a,selectedValue:n}=e;const o=(Array.isArray(a)?a:[a]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===n));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==n}))))}function v(e){const t=h(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",w)},r.createElement(b,(0,n.Z)({},e,t)),r.createElement(y,(0,n.Z)({},e,t)))}function N(e){const t=(0,f.Z)();return r.createElement(v,(0,n.Z)({key:String(t)},e))}},45413:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>c,toc:()=>d});var n=a(87462),r=(a(67294),a(3905)),o=a(74866),s=a(85162);const l={id:"database"},i="Deliver the WordPress Application with Cloud RDS",c={unversionedId:"user-guides/cloud-resources/database",id:"user-guides/cloud-resources/database",title:"Deliver the WordPress Application with Cloud RDS",description:"This tutorial will demonstrate how to deploy a WordPress application with Kusion, which relies on both Kubernetes and IaaS resources provided by cloud vendors. We can learn how to declare the Relational Database Service (RDS) to provide a cloud-based database solution with Kusion for our application from this article.",source:"@site/docs/kusion/5-user-guides/1-cloud-resources/1-database.md",sourceDirName:"5-user-guides/1-cloud-resources",slug:"/user-guides/cloud-resources/database",permalink:"/docs/next/user-guides/cloud-resources/database",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/5-user-guides/1-cloud-resources/1-database.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"database"},sidebar:"kusion",previous:{title:"Operational Rules",permalink:"/docs/next/configuration-walkthrough/operational-rules"},next:{title:"Expose Application Service Deployed on CSP Kubernetes",permalink:"/docs/next/user-guides/cloud-resources/expose-service"}},u={},d=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Init Workspace",id:"init-workspace",level:2},{value:"Create Project And Stack",id:"create-project-and-stack",level:2},{value:"Update And Review Configuration Codes",id:"update-and-review-configuration-codes",level:3},{value:"Application Delivery",id:"application-delivery",level:2},{value:"Verify WordPress Application",id:"verify-wordpress-application",level:2},{value:"Delete WordPress Application",id:"delete-wordpress-application",level:2}],p={toc:d};function m(e){let{components:t,...l}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,l,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"deliver-the-wordpress-application-with-cloud-rds"},"Deliver the WordPress Application with Cloud RDS"),(0,r.kt)("p",null,"This tutorial will demonstrate how to deploy a WordPress application with Kusion, which relies on both Kubernetes and IaaS resources provided by cloud vendors. We can learn how to declare the Relational Database Service (RDS) to provide a cloud-based database solution with Kusion for our application from this article. "),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"/docs/next/getting-started/install-kusion"},"Kusion"),". "),(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/tasks/tools/#kubectl"},"kubectl CLI")," and run a ",(0,r.kt)("a",{parentName:"li",href:"https://kubernetes.io/"},"Kubernetes")," or ",(0,r.kt)("a",{parentName:"li",href:"https://docs.k3s.io/quick-start"},"k3s")," or ",(0,r.kt)("a",{parentName:"li",href:"https://k3d.io/v5.4.4/#installation"},"k3d")," or ",(0,r.kt)("a",{parentName:"li",href:"https://minikube.sigs.k8s.io/docs/tutorials/multi_node"},"MiniKube")," cluster. "),(0,r.kt)("li",{parentName:"ul"},"Prepare a cloud service account and create a user with at least ",(0,r.kt)("strong",{parentName:"li"},"VPCFullAccess")," and ",(0,r.kt)("strong",{parentName:"li"},"RDSFullAccess")," related permissions to use the Relational Database Service (RDS). This kind of user can be created and managed in the Identity and Access Management (IAM) console of the cloud vendor. "),(0,r.kt)("li",{parentName:"ul"},"The environment that executes ",(0,r.kt)("inlineCode",{parentName:"li"},"kusion")," needs to have connectivity to terraform registry to download the terraform providers. ")),(0,r.kt)("p",null,"Additionally, we also need to configure the obtained AccessKey and SecretKey as well as the cloud resource region as environment variables for specific cloud provider: "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'export AWS_ACCESS_KEY_ID="AKIAQZDxxxx" # replace it with your AccessKey\nexport AWS_SECRET_ACCESS_KEY="oE/xxxx" # replace it with your SecretKey\nexport AWS_REGION=us-east-1 # replace it with your region\n')),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"aws iam account",src:a(24838).Z,width:"2874",height:"1398"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'export ALICLOUD_ACCESS_KEY="LTAI5txxx" # replace it with your AccessKey\nexport ALICLOUD_SECRET_KEY="nxuowIxxx" # replace it with your SecretKey\nexport ALICLOUD_REGION=cn-hangzhou # replace it with your region\n')),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"alicloud iam account",src:a(73725).Z,width:"1500",height:"629"})))),(0,r.kt)("h2",{id:"init-workspace"},"Init Workspace"),(0,r.kt)("p",null,"To deploy the WordPress application with cloud rds, we first need to initiate a ",(0,r.kt)("inlineCode",{parentName:"p"},"Workspace")," for the targeted stack (here we are using ",(0,r.kt)("inlineCode",{parentName:"p"},"dev"),"). Please copy the following example YAML file to your local ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),". "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'# MySQL configurations for AWS RDS\nmodules: \n kusionstack/mysql@0.1.0: \n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n privateRouting: false\n databaseName: "wordpress-mysql"\n'))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'# MySQL configurations for Alicloud RDS\nmodules: \n kusionstack/mysql@0.1.0: \n default: \n cloud: alicloud\n size: 20\n instanceType: mysql.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n databaseName: "wordpress-mysql"\n')))),(0,r.kt)("p",null,"If you would like to try creating the ",(0,r.kt)("inlineCode",{parentName:"p"},"Alicloud")," RDS instance, you should replace the ",(0,r.kt)("inlineCode",{parentName:"p"},"[your-subnet-id]")," of ",(0,r.kt)("inlineCode",{parentName:"p"},"modules.kusionstack/mysql@0.1.0.default.subnetID")," field with the Alicloud ",(0,r.kt)("inlineCode",{parentName:"p"},"vSwitchID")," to which the database will be provisioned in. After that, you can execute the following command line to initiate the configuration for ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace create dev -f workspace.yaml\n")),(0,r.kt)("p",null,"Since Kusion by default use the ",(0,r.kt)("inlineCode",{parentName:"p"},"default")," workspace, we can switch to the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace with the following cmd: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace switch dev\n")),(0,r.kt)("p",null,"If you have already created and used the configuration of ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace, you can append the MySQL module configs to your workspace YAML file and use the following command line to update the workspace configuration. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace update dev -f workspace.yaml\n")),(0,r.kt)("p",null,"We can use the following command lines to show the current workspace configurations for ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace show\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," is a sample configuration file for workspace management, including ",(0,r.kt)("inlineCode",{parentName:"p"},"MySQL")," module configs. Workspace configurations are usually declared by ",(0,r.kt)("strong",{parentName:"p"},"Platform Engineers")," and will take effect through the corresponding stack. "),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about the configuration of Workspace can be found in ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/concepts/workspace"},"Concepts of Workspace"),". ")),(0,r.kt)("h2",{id:"create-project-and-stack"},"Create Project And Stack"),(0,r.kt)("p",null,"We can create a new project named ",(0,r.kt)("inlineCode",{parentName:"p"},"wordpress-rds-cloud")," with the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion project create")," command. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"# Create a new directory and navigate into it. \nmkdir wordpress-rds-cloud && cd wordpress-rds-cloud\n\n# Create a new project with the name of the current directory. \nkusion project create\n")),(0,r.kt)("p",null,"After creating the new project, we can create a new stack named ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," with the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion stack create")," command. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"# Create a new stack with the specified name under current project directory. \nkusion stack create dev\n")),(0,r.kt)("p",null,"The created project and stack structure looks like below: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"tree\n.\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n\n2 directories, 4 files\n")),(0,r.kt)("h3",{id:"update-and-review-configuration-codes"},"Update And Review Configuration Codes"),(0,r.kt)("p",null,"The configuration codes in the created stack are basically empty, thus we should replace the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/kcl.mod")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/main.k")," with the below codes: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},'# dev/kcl.mod\n[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\nmysql = { oci = "oci://ghcr.io/kusionstack/mysql", tag = "0.1.0" }\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'# dev/main.k \nimport kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\nimport mysql\n\n# main.k declares customized configurations for dev stacks.\nwordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n wordpress: c.Container {\n image: "wordpress:6.3"\n env: {\n "WORDPRESS_DB_HOST": "$(KUSION_DB_HOST_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_NAME": "mysql"\n }\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n "mysql": mysql.MySQL {\n type: "cloud"\n version: "8.0"\n }\n }\n}\n')),(0,r.kt)("h2",{id:"application-delivery"},"Application Delivery"),(0,r.kt)("p",null,"You can complete the delivery of the WordPress application in the folder of ",(0,r.kt)("inlineCode",{parentName:"p"},"wordpress-cloud-rds/dev")," using the following command line. Kusion will enable the watching of the application resource creation and automatic port-forwarding of the specified port (80) from local to the Kubernetes Service. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"cd dev && kusion apply --watch\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"During the first apply, the models and modules as well as the Terraform CLI (if not exists) that the application depends on will be downloaded, so it may take some time (usually within two minutes). You can take a break and have a cup of coffee. ")),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply the wordpress application with aws rds",src:a(5721).Z,width:"2874",height:"802"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply the wordpress application with alicloud rds",src:a(91609).Z,width:"2876",height:"858"})))),(0,r.kt)("p",null,"After all the resources reconciled, we can port-forward our local port (e.g. 12345) to the WordPress frontend service port (80) in the cluster:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kubectl port-forward -n wordpress-cloud-rds svc/wordpress-cloud-rds-dev-wordpress-private 12345:80\n")),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kubectl port-forward for wordpress",src:a(76831).Z,width:"2874",height:"150"})),(0,r.kt)("h2",{id:"verify-wordpress-application"},"Verify WordPress Application"),(0,r.kt)("p",null,"Next, we will verify the WordPress site service we just delivered, along with the creation of the RDS instance it depends on. We can start using the WordPress site by accessing the link of local-forwarded port ",(0,r.kt)("a",{parentName:"p",href:"http://localhost:12345"},"(http://localhost:12345)")," we just configured in the browser. "),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"wordpress site page",src:a(85773).Z,width:"1500",height:"803"})),(0,r.kt)("p",null,"In addition, we can also log in to the cloud service console page to view the RDS instance we just created."),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"aws rds instance",src:a(42229).Z,width:"2298",height:"706"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"alicloud rds instance",src:a(99782).Z,width:"2870",height:"616"})))),(0,r.kt)("h2",{id:"delete-wordpress-application"},"Delete WordPress Application"),(0,r.kt)("p",null,"You can delete the WordPress application and related RDS resources using the following command line. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion destroy --yes\n")),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kusion destroy wordpress with aws rds",src:a(74068).Z,width:"2874",height:"788"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kusion destroy wordpress with alicloud rds",src:a(72557).Z,width:"2874",height:"820"})))))}m.isMDXComponent=!0},91609:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/apply-wordpress-cloud-rds-alicloud-14224502ce1c4d077fa1ed3777b1add9.png"},5721:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/apply-wordpress-cloud-rds-aws-9c72f8fd79000427958c5376085a65b8.png"},24838:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/aws-iam-account-2216105e7fa18fb2f7bf4be7e19f98bd.png"},99782:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/cloud-rds-instance-alicloud-e2062c7a477d445b3decf429105ab3d6.png"},42229:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/cloud-rds-instance-aws-64d6371851d55e05fb05353bbd9a19b1.png"},72557:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/destroy-wordpress-cloud-rds-alicloud-9c5da68051d92f6a8b3a11db9dd49273.png"},74068:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/destroy-wordpress-cloud-rds-aws-04a2cf44dbce1bcac488f8ce3dcdae81.png"},73725:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/set-rds-access-9347ae09377aeb94d9f6d1e5d8688ab5.png"},76831:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/wordpress-cloud-rds-port-forward-611c4f17d055d9ee941b9ff87a0727f5.png"},85773:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/wordpress-site-page-ef650e640399209d1eec5e6dfe88c454.png"}}]); \ No newline at end of file diff --git a/assets/js/0a185701.ad3fea43.js b/assets/js/0a185701.ad3fea43.js new file mode 100644 index 00000000000..ce5aea7c1f4 --- /dev/null +++ b/assets/js/0a185701.ad3fea43.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[535],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>u});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=a.createContext({}),c=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=c(e.components);return a.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},k=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,l=e.parentName,p=r(e,["components","mdxType","originalType","parentName"]),k=c(n),u=i,m=k["".concat(l,".").concat(u)]||k[u]||d[u]||o;return n?a.createElement(m,s(s({ref:t},p),{},{components:n})):a.createElement(m,s({ref:t},p))}));function u(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,s=new Array(o);s[0]=k;var r={};for(var l in t)hasOwnProperty.call(t,l)&&(r[l]=t[l]);r.originalType=e,r.mdxType="string"==typeof e?e:i,s[1]=r;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>o,metadata:()=>r,toc:()=>c});var a=n(87462),i=(n(67294),n(3905));const o={id:"backend",sidebar_label:"Backend"},s="Backend",r={unversionedId:"concepts/backend",id:"concepts/backend",title:"Backend",description:"Backend is Kusion's storage, which defines the place to store Workspace, Spec and State. By default, Kusion uses the local type of backend to store the state on the local disk. While in the scenario of team collaboration, the Workspace, Spec and State can be stored on a remote backend, such as mysql, oss and s3, to allow multiple users' access.",source:"@site/docs/kusion/3-concepts/7-backend.md",sourceDirName:"3-concepts",slug:"/concepts/backend",permalink:"/docs/next/concepts/backend",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/3-concepts/7-backend.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:7,frontMatter:{id:"backend",sidebar_label:"Backend"},sidebar:"kusion",previous:{title:"Spec",permalink:"/docs/next/concepts/spec"},next:{title:"Configuration",permalink:"/docs/next/concepts/configuration"}},l={},c=[{value:"Available Backend Types",id:"available-backend-types",level:2},{value:"local",id:"local",level:3},{value:"mysql",id:"mysql",level:3},{value:"oss",id:"oss",level:3},{value:"s3",id:"s3",level:3},{value:"Setting a Backend",id:"setting-a-backend",level:2},{value:"Setting a Whole Backend",id:"setting-a-whole-backend",level:3},{value:"Setting a Backend Type",id:"setting-a-backend-type",level:3},{value:"Setting a Whole Set of Backend Config Items",id:"setting-a-whole-set-of-backend-config-items",level:3},{value:"Setting a Backend Config Item",id:"setting-a-backend-config-item",level:3},{value:"Unsetting a Backend",id:"unsetting-a-backend",level:2},{value:"Setting the Current Backend",id:"setting-the-current-backend",level:2},{value:"Getting Backend Configuration",id:"getting-backend-configuration",level:2},{value:"Using Backend",id:"using-backend",level:2}],p={toc:c};function d(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"backend"},"Backend"),(0,i.kt)("p",null,"Backend is Kusion's storage, which defines the place to store Workspace, Spec and State. By default, Kusion uses the ",(0,i.kt)("inlineCode",{parentName:"p"},"local")," type of backend to store the state on the local disk. While in the scenario of team collaboration, the Workspace, Spec and State can be stored on a remote backend, such as ",(0,i.kt)("inlineCode",{parentName:"p"},"mysql"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"oss")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"s3"),", to allow multiple users' access. "),(0,i.kt)("p",null,"The command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config")," is used to configure the backend configuration. Configuring a whole backend or an individual config item are both supported. For the sensitive data, the environment variables are supported, and with higher priority."),(0,i.kt)("p",null,"Furthermore, Kusion provides the operation of setting current backend. Thus, the trouble of specifying backend can be saved when executing operation commands and managing ",(0,i.kt)("inlineCode",{parentName:"p"},"workspace"),". "),(0,i.kt)("h2",{id:"available-backend-types"},"Available Backend Types"),(0,i.kt)("p",null,"There are four available backend types: ",(0,i.kt)("inlineCode",{parentName:"p"},"local"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"mysql"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"oss"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"s3"),"."),(0,i.kt)("h3",{id:"local"},"local"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"local")," type backend uses local file system as storage, which is suitable for local operations, but not ideal for multi-user collaboration. The supported config items are as below."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"path"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"optional"),", specify the directory to store the Workspace, Spec, and State files. The subdirectories ",(0,i.kt)("inlineCode",{parentName:"li"},"workspaces"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"specs")," and ",(0,i.kt)("inlineCode",{parentName:"li"},"states")," are used to store the corresponding files separately. It's recommended to use an empty or a Kusion exclusive directory as the local backend path. If not set, the default path ",(0,i.kt)("inlineCode",{parentName:"li"},"${KUSION_HOME}")," is in use.")),(0,i.kt)("p",null,"The whole local type backend configuration is as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},'{\n "type": "local",\n "configs": {\n "path": "${local_path}" # type string, optional, the directory to store files.\n }\n}\n')),(0,i.kt)("h3",{id:"mysql"},"mysql"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"mysql")," type backend uses mysql database as storage. The supported config items are as below."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"dbName"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", the name of the database."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"user"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", the username of the database. "),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"password"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"optional"),", the password of the database, support declaring by environment variable ",(0,i.kt)("inlineCode",{parentName:"li"},"KUSION_BACKEND_MYSQL_PASSWORD"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"host")," - ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", the access address for the database."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"port")," - ",(0,i.kt)("inlineCode",{parentName:"li"},"type int"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"optional"),", the port of the database. If not set, the default value ",(0,i.kt)("inlineCode",{parentName:"li"},"3306")," will be used.")),(0,i.kt)("p",null,"Please be attention, mysql type are not supported to store Spec for now. For Workspace and State, the table ",(0,i.kt)("inlineCode",{parentName:"p"},"worksapce")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"state")," are used to store the corresponding content separately, whose structures are determinate. The table structures are shown below. "),(0,i.kt)("p",null,"Noted that there are not fields ",(0,i.kt)("inlineCode",{parentName:"p"},"id"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"gmt_create(created_at)"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"gmt_modified(updated_at)"),", etc., which are usually automatically controlled by the database. Kusion does not use these fields, while the existence of them does not affect the normal operation of Kusion. And the length of the varchar can be changed according to the real scenario."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sql"},"-- table workspace\nCREATE TABLE `workspace` (\n `workspace` varchar(127) NOT NULL COMMENT 'workspace name',\n `content` longtext NOT NULL COMMENT 'workspace content, in JSON format',\n `is_current` tinyint(1) DEFAULT NULL COMMENT 'specify is current workspace or not',\n UNIQUE KEY `uk_workspace` (`name`),\n KEY `idx_is_current` (`is_current`)\n);\n\n-- table state\nCREATE TABLE `state` (\n `project` varchar(127) NOT NULL COMMENT 'project name',\n `stack` varchar(127) NOT NULL COMMENT 'stack name',\n `workspace` varchar(127) NOT NULL COMMENT 'workspace name',\n `content` longtext NOT NULL COMMENT 'state content, in JSON format',\n UNIQUE KEY `uk_state` (`project`, `stack`, `worksapce`)\n);\n")),(0,i.kt)("p",null,"The whole mysql type backend configuration is as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},'{\n "type": "mysql",\n "configs": {\n "dbName": "${mysql_db_name}", # type string, required, the database name.\n "user": "${mysql_user}", # type string, required, the database user.\n "password": "${mysql_password}", # type string, optional, the database password.\n "host": "${mysql_host}", # type string, required, the database host.\n "port": "${mysql_port}" # type string, optional, the database port. If not set, use the default port 3306.\n }\n}\n')),(0,i.kt)("p",null,"The supported environment variable is as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},'export KUSION_BACKEND_MYSQL_PASSWORD="${mysql_password}" # configure password\n')),(0,i.kt)("h3",{id:"oss"},"oss"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"oss")," type backend uses the Alicloud Object Storage Service (OSS) as storage. The supported config items are as below."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"endpoint"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the access endpoint for alicloud oss bucket. "),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"accessKeyID"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the alicloud account accessKeyID, support declaring by environment variable ",(0,i.kt)("inlineCode",{parentName:"li"},"OSS_ACCESS_KEY_ID"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"accessKeySecret"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the alicloud account accessKeySecret, support declaring by environment variable ",(0,i.kt)("inlineCode",{parentName:"li"},"OSS_ACCESS_KEY_SECRET"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"bucket"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the name of the alicloud oss bucket."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"prefix"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"optional"),", constitute the prefix to store the Workspace, Spec, and State files, whose prefixes are ",(0,i.kt)("inlineCode",{parentName:"li"},"${prefix}/workspaces"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"${prefix}/specs")," and ",(0,i.kt)("inlineCode",{parentName:"li"},"${prefix}/states"),' respectively. Using prefix can create a "dedicated space" for the Kusion data, which is beneficial for the management and reuse of the bucket. If not set, there is no prefix, the files are stored in the root path of the bucket if analogy to a file system.')),(0,i.kt)("p",null,"Noted that ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeyID")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeySecret")," are required for the whole configuration combined by the configuration managed by the command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config")," and the environment variables. For the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config")," alone, they are not obligatory. And for the safety reason, using environment variables is the recommended way."),(0,i.kt)("p",null,"The whole oss type backend configuration is as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},'{\n "type": "oss",\n "configs": {\n "endpoint": "${oss_endpoint}", # type string, required, the oss endpoint.\n "accessKeyID": "${oss_access_key_id}", # type string, ooptional for the command "kusion config", the oss access key id.\n "accessKeySecret": "${oss_access_key_secret}", # type string, optional for the command "kusion config", the oss access key secret.\n "bucket": "${oss_bucket}", # type string, required, the oss bucket.\n "prefix": "${oss_prefix}" # type string, optional, the prefix to store the files.\n }\n}\n')),(0,i.kt)("p",null,"The supported environment variables are as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},'export OSS_ACCESS_KEY_ID="${oss-access-key-id}" # configure accessKeyID\nexport OSS_ACCESS_KEY_SECRET="${oss-access-key-secret}" # configure accessKeySecret\n')),(0,i.kt)("h3",{id:"s3"},"s3"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"s3")," type backend uses the AWS Simple Storage Service (S3) as storage. The supported config items are as below."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"region"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the region of aws s3 bucket, support declaring by environment variable ",(0,i.kt)("inlineCode",{parentName:"li"},"AWS_DEFAULT_REGION")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"AWS_REGION"),", where the latter has higher priority."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"endpoint"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"optional"),", specify the access endpoint for aws s3 bucket."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"accessKeyID"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the aws account accessKeyID, support declaring by environment variable ",(0,i.kt)("inlineCode",{parentName:"li"},"AWS_ACCESS_KEY_ID"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"accessKeySecret"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the aws account.accessKeySecret, support declaring by environment variable ",(0,i.kt)("inlineCode",{parentName:"li"},"AWS_SECRET_ACCESS_KEY"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"bucket"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the name of the aws s3 bucket."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"prefix"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"optional"),", constitute the prefix to store the Workspace, Spec, and State files, whose prefixes are ",(0,i.kt)("inlineCode",{parentName:"li"},"${prefix}/workspaces"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"${prefix}/specs")," and ",(0,i.kt)("inlineCode",{parentName:"li"},"${prefix}/states")," respectively.")),(0,i.kt)("p",null,"Noted that ",(0,i.kt)("inlineCode",{parentName:"p"},"region"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeyID")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeySecret")," are optional for the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config")," command."),(0,i.kt)("p",null,"The whole s3 type backend configuration is as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},'{\n "type": "s3",\n "configs": {\n "region": "${s3_region}", # type string, optional for the command "kusion config", the aws region.\n "endpoint": "${s3_endpoint}", # type string, optional, the aws endpoint. \n "accessKeyID": "${s3_access_key_id}", # type string, optional for the command "kusion config", the aws access key id.\n "accessKeySecret": "${s3_access_key_secret}", # type string, optional for the command "kusion config", the aws access key secret.\n "bucket": "${s3_bucket}", # type string, required, the s3 bucket.\n "prefix": "${s3_prefix}" # type string, optional, the prefix to store the files.\n }\n}\n')),(0,i.kt)("p",null,"The supported environment variables are as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},'export AWS_DEFAULT_REGION="${s3_region}" # configure region, lower priority than AWS_REGION\nexport AWS_REGION="${s3_region}" # configure region, higher priority than AWS_DEFAULT_REGION\nexport AWS_ACCESS_KEY_ID="${s3_access_key_id}" # configure accessKeyID\nexport AWS_SECRET_ACCESS_KEY="${s3_access_key_secret}" # configure accessKeySecret\n')),(0,i.kt)("h2",{id:"setting-a-backend"},"Setting a Backend"),(0,i.kt)("p",null,"When there is a new backend or the backend configuration needs to update, use the command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config set ${key} ${value}")," to set a backend. A backend is identified by a unique name, and its whole configuration is made up of the backend type and its corresponding config items. "),(0,i.kt)("p",null,"Be attention, do not confuse backend with backend type. For example, a backend named ",(0,i.kt)("inlineCode",{parentName:"p"},"s3_prod")," uses ",(0,i.kt)("inlineCode",{parentName:"p"},"s3")," as its storage, the ",(0,i.kt)("inlineCode",{parentName:"p"},"s3_prod")," is the backend, while the ",(0,i.kt)("inlineCode",{parentName:"p"},"s3")," is the backend type."),(0,i.kt)("p",null,"There are four configuration modes:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"setting a whole backend"),(0,i.kt)("li",{parentName:"ul"},"setting a backend type "),(0,i.kt)("li",{parentName:"ul"},"setting a whole set of backend config items"),(0,i.kt)("li",{parentName:"ul"},"setting a backend config item")),(0,i.kt)("p",null,"A unique backend name is required to do the configuration. Take ",(0,i.kt)("inlineCode",{parentName:"p"},"s3")," type backend with name ",(0,i.kt)("inlineCode",{parentName:"p"},"s3_prod")," for an example to explain how these modes work."),(0,i.kt)("h3",{id:"setting-a-whole-backend"},"Setting a Whole Backend"),(0,i.kt)("p",null,"The key to configure a whole backend is ",(0,i.kt)("inlineCode",{parentName:"p"},"backends.${name}"),", whose value must be the JSON marshal result in a specified format, which is determined by the backend type. Enclosing the value in single quotation marks is a good choice, which can keep the format correct. "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},'# set a whole backend\nkusion config set backends.s3_prod \'{"type":"s3","configs":{"bucket":"kusion"}}\'\n')),(0,i.kt)("h3",{id:"setting-a-backend-type"},"Setting a Backend Type"),(0,i.kt)("p",null,"The key to set a backend type is ",(0,i.kt)("inlineCode",{parentName:"p"},"backends.${name}.type"),", whose value must be ",(0,i.kt)("inlineCode",{parentName:"p"},"local"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"mysql"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"oss")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"s3"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"# set a backend type\nkusion config set backends.s3_prod.type s3\n")),(0,i.kt)("h3",{id:"setting-a-whole-set-of-backend-config-items"},"Setting a Whole Set of Backend Config Items"),(0,i.kt)("p",null,"The key to set a whole set of backend config items is ",(0,i.kt)("inlineCode",{parentName:"p"},"backends.${name}.configs"),", whose value must be the JSON marshal result in a specified format, which is determined by the backend type. The backend config must be set after the backend type, and corresponds to the backend type."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},'# set a whole backend config\nkusion config set backends.s3_prod.configs \'{"bucket":"kusion"}\'\n')),(0,i.kt)("h3",{id:"setting-a-backend-config-item"},"Setting a Backend Config Item"),(0,i.kt)("p",null,"The key to set a backend config item is ",(0,i.kt)("inlineCode",{parentName:"p"},"backends.${name}.configs.${item}"),". The item name and value type both depend on the backend type. Like the whole backend config, the config item must be valid and set after the backend type."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"# set a backend config item\nkusion config set backends.s3_prod.configs.bucket kusion\n")),(0,i.kt)("p",null,"When executing ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config set"),", the configuration will be stored in a local file. For security reason, the environment variables are supported to configure some config items, such as ",(0,i.kt)("inlineCode",{parentName:"p"},"password"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeyID"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeySecret"),". Using environment variables rather than ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config")," set to set sensitive data is the best practice. If both configured, the environment variables have higher priority. For details about the supported environment variables, please see above."),(0,i.kt)("p",null,"Kusion has a default backend with ",(0,i.kt)("inlineCode",{parentName:"p"},"local")," type and the path is ",(0,i.kt)("inlineCode",{parentName:"p"},"$KUSION_HOME"),", whose name is exactly ",(0,i.kt)("inlineCode",{parentName:"p"},"default"),". The ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," backend is forbidden to modification, that is setting or unsetting the default backend is not allowed. Besides, the keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"current")," is also used by Kusion itself, please do not use it as the backend name."),(0,i.kt)("h2",{id:"unsetting-a-backend"},"Unsetting a Backend"),(0,i.kt)("p",null,"When a backend is not in use, or the configuration is out of date, use the command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config unset ${key}")," to unset a backend or a specified config item. Same as the setting, there are also four modes of unsetting."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"unsetting a whole backend"),(0,i.kt)("li",{parentName:"ul"},"unsetting a backend type"),(0,i.kt)("li",{parentName:"ul"},"unsetting a whole set of backend config items"),(0,i.kt)("li",{parentName:"ul"},"unsetting a backend config item")),(0,i.kt)("p",null,"When unsetting a whole backend, the backend must not be the current backend. When unsetting the backend type, the config items must be empty and the backend not be the current."),(0,i.kt)("p",null,"Unsetting the ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," backend is forbidden."),(0,i.kt)("h2",{id:"setting-the-current-backend"},"Setting the Current Backend"),(0,i.kt)("p",null,"In order not to specify backend for every operation command. Kusion provides the mechanism of setting current backend, then the current workspace will be use by default. This is very useful when you execute a series of Kusion operation commands, for they usually use the same backend."),(0,i.kt)("p",null,"Use the command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config set backends.current ${name}")," to set the current backend, where the ",(0,i.kt)("inlineCode",{parentName:"p"},"name")," must be the already set backend."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"# set the current workspace\nkusion config set backends.current s3_prod\n")),(0,i.kt)("p",null,"Setting the current backend to ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," is legal. Actually, if there is no backend related configuration, the current backend is the ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," backend."),(0,i.kt)("h2",{id:"getting-backend-configuration"},"Getting Backend Configuration"),(0,i.kt)("p",null,"Use the command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config get ${key}")," to get a whole backend configuration or a specified backend config item. The ",(0,i.kt)("inlineCode",{parentName:"p"},"key")," is same as setting and unsetting operation, the whole list can be found in the ",(0,i.kt)("a",{parentName:"p",href:"configuration"},"Configuration"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"# get a whole backend\nkusion config get backends.s3_prod\n\n# get a specified config item\nkusion config get backends.s3_prod.configs.bucekt\n")),(0,i.kt)("p",null,"Besides, the command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config list")," can also be used, which returns the whole kusion configuration, while the backend configuration is included."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"# get the whole Kusion configuration \nkusion config list\n")),(0,i.kt)("h2",{id:"using-backend"},"Using Backend"),(0,i.kt)("p",null,"The backend is used to store Workspace, Spec, and State. Thus, the following commands use the backend, shown as below."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"subcommands of ",(0,i.kt)("inlineCode",{parentName:"li"},"kusion workspace"),": use to store the Workspace;"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"kusion generate"),": use to store the Spec;"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"kusion preview"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"kusion apply"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"kusion destroy"),": use to store the State;")),(0,i.kt)("p",null,"For all the commands above, the flag ",(0,i.kt)("inlineCode",{parentName:"p"},"--backend")," is provided to specify the backend, or using the current backend. When using backend, you usually need to specify the sensitive data by environment variables. The example is shown below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},'# set environment variables of sensitive and other necessary data\nexport AWS_REGION="${s3_region}"\nexport AWS_ACCESS_KEY_ID="${s3_access_key_id}"\nexport AWS_SECRET_ACCESS_KEY="${s3_access_key_secret}"\n\n# use current backend\nkusion apply\n\n# use a specified backend\nkusion apply --backend s3_prod\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0a185701.dda5c0ee.js b/assets/js/0a185701.dda5c0ee.js deleted file mode 100644 index 7d7f9c7afbc..00000000000 --- a/assets/js/0a185701.dda5c0ee.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[535],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>u});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=a.createContext({}),c=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=c(e.components);return a.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},k=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,l=e.parentName,p=r(e,["components","mdxType","originalType","parentName"]),k=c(n),u=i,m=k["".concat(l,".").concat(u)]||k[u]||d[u]||o;return n?a.createElement(m,s(s({ref:t},p),{},{components:n})):a.createElement(m,s({ref:t},p))}));function u(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,s=new Array(o);s[0]=k;var r={};for(var l in t)hasOwnProperty.call(t,l)&&(r[l]=t[l]);r.originalType=e,r.mdxType="string"==typeof e?e:i,s[1]=r;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>o,metadata:()=>r,toc:()=>c});var a=n(87462),i=(n(67294),n(3905));const o={id:"backend",sidebar_label:"Backend"},s="Backend",r={unversionedId:"concepts/backend",id:"concepts/backend",title:"Backend",description:"Backend is Kusion's storage, which defines the place to store Workspace, Spec and State. By default, Kusion uses the local type of backend to store the state on the local disk. While in the scenario of team collaboration, the Workspace, Spec and State can be stored on a remote backend, such as mysql, oss and s3, to allow multiple users' access.",source:"@site/docs/kusion/3-concepts/7-backend.md",sourceDirName:"3-concepts",slug:"/concepts/backend",permalink:"/docs/next/concepts/backend",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/3-concepts/7-backend.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:7,frontMatter:{id:"backend",sidebar_label:"Backend"},sidebar:"kusion",previous:{title:"Spec",permalink:"/docs/next/concepts/spec"},next:{title:"Configuration",permalink:"/docs/next/concepts/configuration"}},l={},c=[{value:"Available Backend Types",id:"available-backend-types",level:2},{value:"local",id:"local",level:3},{value:"mysql",id:"mysql",level:3},{value:"oss",id:"oss",level:3},{value:"s3",id:"s3",level:3},{value:"Setting a Backend",id:"setting-a-backend",level:2},{value:"Setting a Whole Backend",id:"setting-a-whole-backend",level:3},{value:"Setting a Backend Type",id:"setting-a-backend-type",level:3},{value:"Setting a Whole Set of Backend Config Items",id:"setting-a-whole-set-of-backend-config-items",level:3},{value:"Setting a Backend Config Item",id:"setting-a-backend-config-item",level:3},{value:"Unsetting a Backend",id:"unsetting-a-backend",level:2},{value:"Setting the Current Backend",id:"setting-the-current-backend",level:2},{value:"Getting Backend Configuration",id:"getting-backend-configuration",level:2},{value:"Using Backend",id:"using-backend",level:2}],p={toc:c};function d(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"backend"},"Backend"),(0,i.kt)("p",null,"Backend is Kusion's storage, which defines the place to store Workspace, Spec and State. By default, Kusion uses the ",(0,i.kt)("inlineCode",{parentName:"p"},"local")," type of backend to store the state on the local disk. While in the scenario of team collaboration, the Workspace, Spec and State can be stored on a remote backend, such as ",(0,i.kt)("inlineCode",{parentName:"p"},"mysql"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"oss")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"s3"),", to allow multiple users' access. "),(0,i.kt)("p",null,"The command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config")," is used to configure the backend configuration. Configuring a whole backend or an individual config item are both supported. For the sensitive data, the environment variables are supported, and with higher priority."),(0,i.kt)("p",null,"Furthermore, Kusion provides the operation of setting current backend. Thus, the trouble of specifying backend can be saved when executing operation commands and managing ",(0,i.kt)("inlineCode",{parentName:"p"},"workspace"),". "),(0,i.kt)("h2",{id:"available-backend-types"},"Available Backend Types"),(0,i.kt)("p",null,"There are four available backend types: ",(0,i.kt)("inlineCode",{parentName:"p"},"local"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"mysql"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"oss"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"s3"),"."),(0,i.kt)("h3",{id:"local"},"local"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"local")," type backend uses local file system as storage, which is suitable for local operations, but not ideal for multi-user collaboration. The supported config items are as below."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"path"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"optional"),", specify the directory to store the Workspace, Spec, and State files. The subdirectories ",(0,i.kt)("inlineCode",{parentName:"li"},"workspaces"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"specs")," and ",(0,i.kt)("inlineCode",{parentName:"li"},"states")," are used to store the corresponding files separately. It's recommended to use an empty or a Kusion exclusive directory as the local backend path. If not set, the default path ",(0,i.kt)("inlineCode",{parentName:"li"},"${KUSION_HOME}")," is in use.")),(0,i.kt)("p",null,"The whole local type backend configuration is as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},'{\n "type": "local",\n "configs": {\n "path": "${local_path}" # type string, optional, the directory to store files.\n }\n}\n')),(0,i.kt)("h3",{id:"mysql"},"mysql"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"mysql")," type backend uses mysql database as storage. The supported config items are as below."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"dbName"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", the name of the database."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"user"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", the username of the database. "),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"password"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"optional"),", the password of the database, support declaring by environment variable ",(0,i.kt)("inlineCode",{parentName:"li"},"KUSION_BACKEND_MYSQL_PASSWORD"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"host")," - ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", the access address for the database."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"port")," - ",(0,i.kt)("inlineCode",{parentName:"li"},"type int"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"optional"),", the port of the database. If not set, the default value ",(0,i.kt)("inlineCode",{parentName:"li"},"3306")," will be used.")),(0,i.kt)("p",null,"Please be attention, mysql type are not supported to store Spec for now. For Workspace and State, the table ",(0,i.kt)("inlineCode",{parentName:"p"},"worksapce")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"state")," are used to store the corresponding content separately, whose structures are determinate. The table structures are shown below. "),(0,i.kt)("p",null,"Noted that there are not fields ",(0,i.kt)("inlineCode",{parentName:"p"},"id"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"gmt_create(created_at)"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"gmt_modified(updated_at)"),", etc., which are usually automatically controlled by the database. Kusion does not use these fields, while the existence of them does not affect the normal operation of Kusion. And the length of the varchar can be changed according to the real scenario."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sql"},"-- table workspace\nCREATE TABLE `workspace` (\n `workspace` varchar(127) NOT NULL COMMENT 'workspace name',\n `content` longtext NOT NULL COMMENT 'workspace content, in JSON format',\n `is_current` tinyint(1) DEFAULT NULL COMMENT 'specify is current workspace or not',\n UNIQUE KEY `uk_workspace` (`name`),\n KEY `idx_is_current` (`is_current`)\n);\n\n-- table state\nCREATE TABLE `state` (\n `project` varchar(127) NOT NULL COMMENT 'project name',\n `stack` varchar(127) NOT NULL COMMENT 'stack name',\n `workspace` varchar(127) NOT NULL COMMENT 'workspace name',\n `content` longtext NOT NULL COMMENT 'state content, in JSON format',\n UNIQUE KEY `uk_state` (`project`, `stack`, `worksapce`)\n);\n")),(0,i.kt)("p",null,"The whole mysql type backend configuration is as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},'{\n "type": "mysql",\n "configs": {\n "dbName": "${mysql_db_name}", # type string, required, the database name.\n "user": "${mysql_user}", # type string, required, the database user.\n "password": "${mysql_password}", # type string, optional, the database password.\n "host": "${mysql_host}", # type string, required, the database host.\n "port": "${mysql_port}" # type string, optional, the database port. If not set, use the default port 3306.\n }\n}\n')),(0,i.kt)("p",null,"The supported environment variable is as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},'export KUSION_BACKEND_MYSQL_PASSWORD="${mysql_password}" # configure password\n')),(0,i.kt)("h3",{id:"oss"},"oss"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"oss")," type backend uses the Alicloud Object Storage Service (OSS) as storage. The supported config items are as below."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"endpoint"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the access endpoint for alicloud oss bucket. "),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"accessKeyID"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the alicloud account accessKeyID, support declaring by environment variable ",(0,i.kt)("inlineCode",{parentName:"li"},"OSS_ACCESS_KEY_ID"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"accessKeySecret"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the alicloud account accessKeySecret, support declaring by environment variable ",(0,i.kt)("inlineCode",{parentName:"li"},"OSS_ACCESS_KEY_SECRET"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"bucket"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the name of the alicloud oss bucket."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"prefix"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"optional"),", constitute the prefix to store the Workspace, Spec, and State files, whose prefixes are ",(0,i.kt)("inlineCode",{parentName:"li"},"${prefix}/workspaces"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"${prefix}/specs")," and ",(0,i.kt)("inlineCode",{parentName:"li"},"${prefix}/states"),' respectively. Using prefix can create a "dedicated space" for the Kusion data, which is beneficial for the management and reuse of the bucket. If not set, there is no prefix, the files are stored in the root path of the bucket if analogy to a file system.')),(0,i.kt)("p",null,"Noted that ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeyID")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeySecret")," are required for the whole configuration combined by the configuration managed by the command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config")," and the environment variables. For the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config")," alone, they are not obligatory. And for the safety reason, using environment variables is the recommended way."),(0,i.kt)("p",null,"The whole oss type backend configuration is as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},'{\n "type": "oss",\n "configs": {\n "endpoint": "${oss_endpoint}", # type string, required, the oss endpoint.\n "accessKeyID": "${oss_access_key_id}", # type string, ooptional for the command "kusion config", the oss access key id.\n "accessKeySecret": "${oss_access_key_secret}", # type string, optional for the command "kusion config", the oss access key secret.\n "bucket": "${oss_bucket}", # type string, required, the oss bucket.\n "prefix": "${oss_prefix}" # type string, optional, the prefix to store the files.\n }\n}\n')),(0,i.kt)("p",null,"The supported environment variables are as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},'export OSS_ACCESS_KEY_ID="${oss-access-key-id}" # configure accessKeyID\nexport OSS_ACCESS_KEY_SECRET="${oss-access-key-secret}" # configure accessKeySecret\n')),(0,i.kt)("h3",{id:"s3"},"s3"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"s3")," type backend uses the AWS Simple Storage Service (S3) as storage. The supported config items are as below."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"region"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the region of aws s3 bucket, support declaring by environment variable ",(0,i.kt)("inlineCode",{parentName:"li"},"AWS_DEFAULT_REGION")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"AWS_REGION"),", where the latter has higher priority."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"endpoint"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"optional"),", specify the access endpoint for aws s3 bucket."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"accessKeyID"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the aws account accessKeyID, support declaring by environment variable ",(0,i.kt)("inlineCode",{parentName:"li"},"AWS_ACCESS_KEY_ID"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"accessKeySecret"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the aws account.accessKeySecret, support declaring by environment variable ",(0,i.kt)("inlineCode",{parentName:"li"},"AWS_SECRET_ACCESS_KEY"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"bucket"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the name of the aws s3 bucket."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"prefix"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"optional"),", constitute the prefix to store the Workspace, Spec, and State files, whose prefixes are ",(0,i.kt)("inlineCode",{parentName:"li"},"${prefix}/workspaces"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"${prefix}/specs")," and ",(0,i.kt)("inlineCode",{parentName:"li"},"${prefix}/states")," respectively.")),(0,i.kt)("p",null,"Noted that ",(0,i.kt)("inlineCode",{parentName:"p"},"region"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeyID")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeySecret")," are optional for the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config")," command."),(0,i.kt)("p",null,"The whole s3 type backend configuration is as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},'{\n "type": "s3",\n "configs": {\n "region": "${s3_region}", # type string, optional for the command "kusion config", the aws region.\n "endpoint": "${s3_endpoint}", # type string, optional, the aws endpoint. \n "accessKeyID": "${s3_access_key_id}", # type string, optional for the command "kusion config", the aws access key id.\n "accessKeySecret": "${s3_access_key_secret}", # type string, optional for the command "kusion config", the aws access key secret.\n "bucket": "${s3_bucket}", # type string, required, the s3 bucket.\n "prefix": "${s3_prefix}" # type string, optional, the prefix to store the files.\n }\n}\n')),(0,i.kt)("p",null,"The supported environment variables are as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},'export AWS_DEFAULT_REGION="${s3_region}" # configure region, lower priority than AWS_REGION\nexport AWS_REGION="${s3_region}" # configure region, higher priority than AWS_DEFAULT_REGION\nexport AWS_ACCESS_KEY_ID="${s3_access_key_id}" # configure accessKeyID\nexport AWS_SECRET_ACCESS_KEY="${s3_access_key_secret}" # configure accessKeySecret\n')),(0,i.kt)("h2",{id:"setting-a-backend"},"Setting a Backend"),(0,i.kt)("p",null,"When there is a new backend or the backend configuration needs to update, use the command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config set ${key} ${value}")," to set a backend. A backend is identified by a unique name, and its whole configuration is made up of the backend type and its corresponding config items. "),(0,i.kt)("p",null,"Be attention, do not confuse backend with backend type. For example, a backend named ",(0,i.kt)("inlineCode",{parentName:"p"},"s3_prod")," uses ",(0,i.kt)("inlineCode",{parentName:"p"},"s3")," as its storage, the ",(0,i.kt)("inlineCode",{parentName:"p"},"s3_prod")," is the backend, while the ",(0,i.kt)("inlineCode",{parentName:"p"},"s3")," is the backend type."),(0,i.kt)("p",null,"There are four configuration modes:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"setting a whole backend"),(0,i.kt)("li",{parentName:"ul"},"setting a backend type "),(0,i.kt)("li",{parentName:"ul"},"setting a whole set of backend config items"),(0,i.kt)("li",{parentName:"ul"},"setting a backend config item")),(0,i.kt)("p",null,"A unique backend name is required to do the configuration. Take ",(0,i.kt)("inlineCode",{parentName:"p"},"s3")," type backend with name ",(0,i.kt)("inlineCode",{parentName:"p"},"s3_prod")," for an example to explain how these modes work."),(0,i.kt)("h3",{id:"setting-a-whole-backend"},"Setting a Whole Backend"),(0,i.kt)("p",null,"The key to configure a whole backend is ",(0,i.kt)("inlineCode",{parentName:"p"},"backends.${name}"),", whose value must be the JSON marshal result in a specified format, which is determined by the backend type. Enclosing the value in single quotation marks is a good choice, which can keep the format correct. "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},'# set a whole backend\nkusion config set backends.s3_prod \'{"type":"s3","configs":{"bucket":"kusion"}}\'\n')),(0,i.kt)("h3",{id:"setting-a-backend-type"},"Setting a Backend Type"),(0,i.kt)("p",null,"The key to set a backend type is ",(0,i.kt)("inlineCode",{parentName:"p"},"backends.${name}.type"),", whose value must be ",(0,i.kt)("inlineCode",{parentName:"p"},"local"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"mysql"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"oss")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"s3"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"# set a backend type\nkusion config set backends.s3_prod.type s3\n")),(0,i.kt)("h3",{id:"setting-a-whole-set-of-backend-config-items"},"Setting a Whole Set of Backend Config Items"),(0,i.kt)("p",null,"The key to set a whole set of backend config items is ",(0,i.kt)("inlineCode",{parentName:"p"},"backends.${name}.configs"),", whose value must be the JSON marshal result in a specified format, which is determined by the backend type. The backend config must be set after the backend type, and corresponds to the backend type."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},'# set a whole backend config\nkusion config set backends.s3_prod.configs \'{"bucket":"kusion"}\'\n')),(0,i.kt)("h3",{id:"setting-a-backend-config-item"},"Setting a Backend Config Item"),(0,i.kt)("p",null,"The key to set a backend config item is ",(0,i.kt)("inlineCode",{parentName:"p"},"backends.${name}.configs.${item}"),". The item name and value type both depend on the backend type. Like the whole backend config, the config item must be valid and set after the backend type."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"# set a backend config item\nkusion config set backends.s3_prod.configs.bucket kusion\n")),(0,i.kt)("p",null,"When executing ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config set"),", the configuration will be stored in a local file. For security reason, the environment variables are supported to configure some config items, such as ",(0,i.kt)("inlineCode",{parentName:"p"},"password"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeyID"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeySecret"),". Using environment variables rather than ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config")," set to set sensitive data is the best practice. If both configured, the environment variables have higher priority. For details about the supported environment variables, please see above."),(0,i.kt)("p",null,"Kusion has a default backend with ",(0,i.kt)("inlineCode",{parentName:"p"},"local")," type and the path is ",(0,i.kt)("inlineCode",{parentName:"p"},"$KUSION_HOME"),", whose name is exactly ",(0,i.kt)("inlineCode",{parentName:"p"},"default"),". The ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," backend is forbidden to modification, that is setting or unsetting the default backend is not allowed. Besides, the keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"current")," is also used by Kusion itself, please do not use it as the backend name."),(0,i.kt)("h2",{id:"unsetting-a-backend"},"Unsetting a Backend"),(0,i.kt)("p",null,"When a backend is not in use, or the configuration is out of date, use the command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config unset ${key}")," to unset a backend or a specified config item. Same as the setting, there are also four modes of unsetting."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"unsetting a whole backend"),(0,i.kt)("li",{parentName:"ul"},"unsetting a backend type"),(0,i.kt)("li",{parentName:"ul"},"unsetting a whole set of backend config items"),(0,i.kt)("li",{parentName:"ul"},"unsetting a backend config item")),(0,i.kt)("p",null,"When unsetting a whole backend, the backend must not be the current backend. When unsetting the backend type, the config items must be empty and the backend not be the current."),(0,i.kt)("p",null,"Unsetting the ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," backend is forbidden."),(0,i.kt)("h2",{id:"setting-the-current-backend"},"Setting the Current Backend"),(0,i.kt)("p",null,"In order not to specify backend for every operation command. Kusion provides the mechanism of setting current backend, then the current workspace will be use by default. This is very useful when you execute a series of Kusion operation commands, for they usually use the same backend."),(0,i.kt)("p",null,"Use the command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config set backends.current ${name}")," to set the current backend, where the ",(0,i.kt)("inlineCode",{parentName:"p"},"name")," must be the already set backend."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"# set the current workspace\nkusion config set backends.current s3_prod\n")),(0,i.kt)("p",null,"Setting the current backend to ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," is legal. Actually, if there is no backend related configuration, the current backend is the ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," backend."),(0,i.kt)("h2",{id:"getting-backend-configuration"},"Getting Backend Configuration"),(0,i.kt)("p",null,"Use the command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config get ${key}")," to get a whole backend configuration or a specified backend config item. The ",(0,i.kt)("inlineCode",{parentName:"p"},"key")," is same as setting and unsetting operation, the whole list can be found in the ",(0,i.kt)("a",{parentName:"p",href:"configuration"},"Configuration"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"# get a whole backend\nkusion config get backends.s3_prod\n\n# get a specified config item\nkusion config get backends.s3_prod.configs.bucekt\n")),(0,i.kt)("p",null,"Besides, the command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config list")," can also be used, which returns the whole kusion configuration, while the backend configuration is included."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"# get the whole Kusion configuration \nkusion config list\n")),(0,i.kt)("h2",{id:"using-backend"},"Using Backend"),(0,i.kt)("p",null,"The backend is used to store Workspace, Spec, and State. Thus, the following commands use the backend, shown as below."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"subcommands of ",(0,i.kt)("inlineCode",{parentName:"li"},"kusion workspace"),": use to store the Workspace;"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"kusion generate"),": use to store the Spec;"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"kusion preview"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"kusion apply"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"kusion destroy"),": use to store the State;")),(0,i.kt)("p",null,"For all the commands above, the flag ",(0,i.kt)("inlineCode",{parentName:"p"},"--backend")," is provided to specify the backend, or using the current backend. When using backend, you usually need to specify the sensitive data by environment variables. The example is shown below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},'# set environment variables of sensitive and other necessary data\nexport AWS_REGION="${s3_region}"\nexport AWS_ACCESS_KEY_ID="${s3_access_key_id}"\nexport AWS_SECRET_ACCESS_KEY="${s3_access_key_secret}"\n\n# use current backend\nkusion apply\n\n# use a specified backend\nkusion apply --backend s3_prod\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0a57f7df.51538d2f.js b/assets/js/0a57f7df.51538d2f.js new file mode 100644 index 00000000000..798d997408a --- /dev/null +++ b/assets/js/0a57f7df.51538d2f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1369],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=a.createContext({}),p=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},c=function(e){var n=p(e.components);return a.createElement(s.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,o=e.mdxType,r=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(t),m=o,k=u["".concat(s,".").concat(m)]||u[m]||d[m]||r;return t?a.createElement(k,i(i({ref:n},c),{},{components:t})):a.createElement(k,i({ref:n},c))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var r=t.length,i=new Array(r);i[0]=u;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var p=2;p{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>r,metadata:()=>l,toc:()=>p});var a=t(87462),o=(t(67294),t(3905));const r={},i="Application Developer User Guide",l={unversionedId:"concepts/kusion-module/app-dev-guide",id:"version-v0.11/concepts/kusion-module/app-dev-guide",title:"Application Developer User Guide",description:"Choose modules you need",source:"@site/docs_versioned_docs/version-v0.11/3-concepts/3-kusion-module/3-app-dev-guide.md",sourceDirName:"3-concepts/3-kusion-module",slug:"/concepts/kusion-module/app-dev-guide",permalink:"/docs/concepts/kusion-module/app-dev-guide",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/3-concepts/3-kusion-module/3-app-dev-guide.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{},sidebar:"kusion",previous:{title:"Platform Engineer Develop Guide",permalink:"/docs/concepts/kusion-module/develop-guide"},next:{title:"Workspace",permalink:"/docs/concepts/workspace"}},s={},p=[{value:"Choose modules you need",id:"choose-modules-you-need",level:2},{value:"Import and initialize modules",id:"import-and-initialize-modules",level:2},{value:"Add dependencies",id:"add-dependencies",level:3},{value:"Initialize modules",id:"initialize-modules",level:3},{value:"Preview the result",id:"preview-the-result",level:2}],c={toc:p};function d(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"application-developer-user-guide"},"Application Developer User Guide"),(0,o.kt)("h2",{id:"choose-modules-you-need"},"Choose modules you need"),(0,o.kt)("p",null,"For all KusionStack built-in modules, you can find all available versions and documents in the ",(0,o.kt)("a",{parentName:"p",href:"/docs/reference/modules/"},"reference")),(0,o.kt)("h2",{id:"import-and-initialize-modules"},"Import and initialize modules"),(0,o.kt)("h3",{id:"add-dependencies"},"Add dependencies"),(0,o.kt)("p",null,"Taking ",(0,o.kt)("inlineCode",{parentName:"p"},"kawesome")," as an example, the directory structure is shown below:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"example\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 example_workspace.yaml\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n")),(0,o.kt)("p",null,"Before importing modules in your AppConfiguration, you should add them to the dependencies part of the ",(0,o.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "example"\n\n[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nkawesome = { oci = "oci://ghcr.io/kusionstack/kawesome", tag = "0.1.0" }\n\n[profile]\nentries = ["main.k"]\n')),(0,o.kt)("p",null,"The kam dependency represents the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kam.git"},"Kusion Application Module")," which contains the AppConfiguration and other basic modules. The ",(0,o.kt)("inlineCode",{parentName:"p"},"kawesome")," is the Kusion module we are going to use in the AppConfiguration."),(0,o.kt)("h3",{id:"initialize-modules"},"Initialize modules"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport kawesome.kawesome as ks\n\nkawesome: ac.AppConfiguration {\n # Declare the workload configurations. \n workload: wl.Service {\n containers: {\n kawesome: c.Container {\n image: "hashicorp/http-echo"\n }\n }\n }\n # Declare the kawesome module configurations. \n accessories: {\n "kawesome": ks.Kawesome {\n service: ks.Service{\n port: 5678\n }\n }\n }\n}\n')),(0,o.kt)("p",null,"Initialize the ",(0,o.kt)("inlineCode",{parentName:"p"},"kawesome")," module in the ",(0,o.kt)("inlineCode",{parentName:"p"},"accessories")," block of the AppConfiguration. The key of the ",(0,o.kt)("inlineCode",{parentName:"p"},"accessories")," item represents the module name and the value represents the actual module you required."),(0,o.kt)("h2",{id:"preview-the-result"},"Preview the result"),(0,o.kt)("p",null,"Execute the preview command to validate the result."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"kusion preview\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"}," \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev \nID Action\nhashicorp:random:random_password:example-dev-kawesome Create\nv1:Namespace:example Create\nv1:Service:example:example-dev-kawesome Create\napps.kusionstack.io/v1alpha1:PodTransitionRule:example:example-dev-kawesome Create\napps.kusionstack.io/v1alpha1:CollaSet:example:example-dev-kawesome Create\n\n\n? Which diff detail do you want to see? [Use arrows to move, type to filter]\n> all\n hashicorp:random:random_password:example-dev-kawesome Create\n v1:Namespace:example Create\n v1:Service:example:example-dev-kawesome Create\n apps.kusionstack.io/v1alpha1:PodTransitionRule:example:example-dev-kawesome Create\n apps.kusionstack.io/v1alpha1:CollaSet:example:example-dev-kawesome Create\n cancel\n\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0a57f7df.b7aed711.js b/assets/js/0a57f7df.b7aed711.js deleted file mode 100644 index 4eb82f0cf32..00000000000 --- a/assets/js/0a57f7df.b7aed711.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1369],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=a.createContext({}),p=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},c=function(e){var n=p(e.components);return a.createElement(s.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,o=e.mdxType,r=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(t),m=o,k=u["".concat(s,".").concat(m)]||u[m]||d[m]||r;return t?a.createElement(k,i(i({ref:n},c),{},{components:t})):a.createElement(k,i({ref:n},c))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var r=t.length,i=new Array(r);i[0]=u;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var p=2;p{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>r,metadata:()=>l,toc:()=>p});var a=t(87462),o=(t(67294),t(3905));const r={},i="Application Developer User Guide",l={unversionedId:"concepts/kusion-module/app-dev-guide",id:"version-v0.11/concepts/kusion-module/app-dev-guide",title:"Application Developer User Guide",description:"Choose modules you need",source:"@site/docs_versioned_docs/version-v0.11/3-concepts/3-kusion-module/3-app-dev-guide.md",sourceDirName:"3-concepts/3-kusion-module",slug:"/concepts/kusion-module/app-dev-guide",permalink:"/docs/concepts/kusion-module/app-dev-guide",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/3-concepts/3-kusion-module/3-app-dev-guide.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{},sidebar:"kusion",previous:{title:"Platform Engineer Develop Guide",permalink:"/docs/concepts/kusion-module/develop-guide"},next:{title:"Workspace",permalink:"/docs/concepts/workspace"}},s={},p=[{value:"Choose modules you need",id:"choose-modules-you-need",level:2},{value:"Import and initialize modules",id:"import-and-initialize-modules",level:2},{value:"Add dependencies",id:"add-dependencies",level:3},{value:"Initialize modules",id:"initialize-modules",level:3},{value:"Preview the result",id:"preview-the-result",level:2}],c={toc:p};function d(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"application-developer-user-guide"},"Application Developer User Guide"),(0,o.kt)("h2",{id:"choose-modules-you-need"},"Choose modules you need"),(0,o.kt)("p",null,"For all KusionStack built-in modules, you can find all available versions and documents in the ",(0,o.kt)("a",{parentName:"p",href:"/docs/reference/modules/"},"reference")),(0,o.kt)("h2",{id:"import-and-initialize-modules"},"Import and initialize modules"),(0,o.kt)("h3",{id:"add-dependencies"},"Add dependencies"),(0,o.kt)("p",null,"Taking ",(0,o.kt)("inlineCode",{parentName:"p"},"kawesome")," as an example, the directory structure is shown below:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"example\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 example_workspace.yaml\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n")),(0,o.kt)("p",null,"Before importing modules in your AppConfiguration, you should add them to the dependencies part of the ",(0,o.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "example"\n\n[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nkawesome = { oci = "oci://ghcr.io/kusionstack/kawesome", tag = "0.1.0" }\n\n[profile]\nentries = ["main.k"]\n')),(0,o.kt)("p",null,"The kam dependency represents the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kam.git"},"Kusion Application Module")," which contains the AppConfiguration and other basic modules. The ",(0,o.kt)("inlineCode",{parentName:"p"},"kawesome")," is the Kusion module we are going to use in the AppConfiguration."),(0,o.kt)("h3",{id:"initialize-modules"},"Initialize modules"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport kawesome.kawesome as ks\n\nkawesome: ac.AppConfiguration {\n # Declare the workload configurations. \n workload: wl.Service {\n containers: {\n kawesome: c.Container {\n image: "hashicorp/http-echo"\n }\n }\n }\n # Declare the kawesome module configurations. \n accessories: {\n "kawesome": ks.Kawesome {\n service: ks.Service{\n port: 5678\n }\n }\n }\n}\n')),(0,o.kt)("p",null,"Initialize the ",(0,o.kt)("inlineCode",{parentName:"p"},"kawesome")," module in the ",(0,o.kt)("inlineCode",{parentName:"p"},"accessories")," block of the AppConfiguration. The key of the ",(0,o.kt)("inlineCode",{parentName:"p"},"accessories")," item represents the module name and the value represents the actual module you required."),(0,o.kt)("h2",{id:"preview-the-result"},"Preview the result"),(0,o.kt)("p",null,"Execute the preview command to validate the result."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"kusion preview\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"}," \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev \nID Action\nhashicorp:random:random_password:example-dev-kawesome Create\nv1:Namespace:example Create\nv1:Service:example:example-dev-kawesome Create\napps.kusionstack.io/v1alpha1:PodTransitionRule:example:example-dev-kawesome Create\napps.kusionstack.io/v1alpha1:CollaSet:example:example-dev-kawesome Create\n\n\n? Which diff detail do you want to see? [Use arrows to move, type to filter]\n> all\n hashicorp:random:random_password:example-dev-kawesome Create\n v1:Namespace:example Create\n v1:Service:example:example-dev-kawesome Create\n apps.kusionstack.io/v1alpha1:PodTransitionRule:example:example-dev-kawesome Create\n apps.kusionstack.io/v1alpha1:CollaSet:example:example-dev-kawesome Create\n cancel\n\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0a8d339f.8241bef2.js b/assets/js/0a8d339f.a6d34ab0.js similarity index 55% rename from assets/js/0a8d339f.8241bef2.js rename to assets/js/0a8d339f.a6d34ab0.js index c9f4896219d..bf047e450a3 100644 --- a/assets/js/0a8d339f.8241bef2.js +++ b/assets/js/0a8d339f.a6d34ab0.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5163],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=p(r),m=o,k=d["".concat(c,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(k,s(s({ref:t},l),{},{components:r})):n.createElement(k,s({ref:t},l))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion workspace list",i={unversionedId:"reference/commands/kusion-workspace-list",id:"version-v0.11/reference/commands/kusion-workspace-list",title:"kusion workspace list",description:"List all workspace names",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-list.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-list",permalink:"/docs/reference/commands/kusion-workspace-list",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-list.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace delete",permalink:"/docs/reference/commands/kusion-workspace-delete"},next:{title:"kusion workspace show",permalink:"/docs/reference/commands/kusion-workspace-show"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-list"},"kusion workspace list"),(0,o.kt)("p",null,"List all workspace names"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command list the names of all workspaces."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace list\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # List all workspace names\n kusion workspace list\n \n # List all workspace names in a specified backend\n kusion workspace list --backend oss-prod\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string the backend name\n -h, --help help for list\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5163],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=p(r),m=o,k=d["".concat(c,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(k,s(s({ref:t},l),{},{components:r})):n.createElement(k,s({ref:t},l))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion workspace list",i={unversionedId:"reference/commands/kusion-workspace-list",id:"version-v0.11/reference/commands/kusion-workspace-list",title:"kusion workspace list",description:"List all workspace names",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-list.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-list",permalink:"/docs/reference/commands/kusion-workspace-list",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-list.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace delete",permalink:"/docs/reference/commands/kusion-workspace-delete"},next:{title:"kusion workspace show",permalink:"/docs/reference/commands/kusion-workspace-show"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-list"},"kusion workspace list"),(0,o.kt)("p",null,"List all workspace names"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command list the names of all workspaces."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace list\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # List all workspace names\n kusion workspace list\n \n # List all workspace names in a specified backend\n kusion workspace list --backend oss-prod\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string the backend name\n -h, --help help for list\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0a99afe0.573bd0fb.js b/assets/js/0a99afe0.eeb4b30f.js similarity index 50% rename from assets/js/0a99afe0.573bd0fb.js rename to assets/js/0a99afe0.eeb4b30f.js index 1c6b76ea625..e3f33ff4119 100644 --- a/assets/js/0a99afe0.573bd0fb.js +++ b/assets/js/0a99afe0.eeb4b30f.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2261],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,s=e.parentName,c=a(e,["components","mdxType","originalType","parentName"]),u=p(r),m=o,b=u["".concat(s,".").concat(m)]||u[m]||d[m]||i;return r?n.createElement(b,l(l({ref:t},c),{},{components:r})):n.createElement(b,l({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,l=new Array(i);l[0]=u;var a={};for(var s in t)hasOwnProperty.call(t,s)&&(a[s]=t[s]);a.originalType=e,a.mdxType="string"==typeof e?e:o,l[1]=a;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>d,frontMatter:()=>i,metadata:()=>a,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const i={sidebar_position:1},l="Installation",a={unversionedId:"support/install-error",id:"version-v0.9/support/install-error",title:"Installation",description:"1. Could not find libintl.dylib",source:"@site/docs_versioned_docs/version-v0.9/support/install-error.md",sourceDirName:"support",slug:"/support/install-error",permalink:"/docs/v0.9/support/install-error",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/support/install-error.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"kusion",previous:{title:"FAQ",permalink:"/docs/v0.9/support/"},next:{title:"KCL",permalink:"/docs/v0.9/support/kcl"}},s={},p=[{value:"1. Could not find libintl.dylib",id:"1-could-not-find-libintldylib",level:2},{value:"2. macOS system SSL related errors",id:"2-macos-system-ssl-related-errors",level:2}],c={toc:p};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"installation"},"Installation"),(0,o.kt)("h2",{id:"1-could-not-find-libintldylib"},"1. Could not find ",(0,o.kt)("inlineCode",{parentName:"h2"},"libintl.dylib")),(0,o.kt)("p",null,"This problem is that some tools depends on the ",(0,o.kt)("inlineCode",{parentName:"p"},"Gettext")," library, but macOS does not have this library by default. You can try to solve it in the following ways:"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"(Skip this step for non-macOS m1) For macOS m1 operating system, make sure you have a homebrew arm64e-version installed in /opt/homebrew, otherwise install the arm version of brew with the following command")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"\n# add to path\nexport PATH=/opt/homebrew/bin:$PATH\n')),(0,o.kt)("ol",{start:2},(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"brew install gettext")),(0,o.kt)("li",{parentName:"ol"},"Make sure ",(0,o.kt)("inlineCode",{parentName:"li"},"libintl.8.dylib")," exists in ",(0,o.kt)("inlineCode",{parentName:"li"},"/usr/local/opt/gettext/lib")," directory"),(0,o.kt)("li",{parentName:"ol"},"If brew is installed in another directory, the library can be created by copying it to the corresponding directory")),(0,o.kt)("h2",{id:"2-macos-system-ssl-related-errors"},"2. macOS system SSL related errors"),(0,o.kt)("p",null,"Openssl dylib library not found or SSL module is not available problem"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"(Skip this step for non-macOS m1) For macOS m1 operating system, make sure you have a homebrew arm64e-version installed in /opt/homebrew, otherwise install the arm version of brew with the following command")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"\n# add to path\nexport PATH=/opt/homebrew/bin:$PATH\n')),(0,o.kt)("ol",{start:2},(0,o.kt)("li",{parentName:"ol"},"Install openssl (version 1.1) via brew")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"brew install openssl@1.1\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2261],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,s=e.parentName,c=a(e,["components","mdxType","originalType","parentName"]),u=p(r),m=o,b=u["".concat(s,".").concat(m)]||u[m]||d[m]||i;return r?n.createElement(b,l(l({ref:t},c),{},{components:r})):n.createElement(b,l({ref:t},c))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,l=new Array(i);l[0]=u;var a={};for(var s in t)hasOwnProperty.call(t,s)&&(a[s]=t[s]);a.originalType=e,a.mdxType="string"==typeof e?e:o,l[1]=a;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>d,frontMatter:()=>i,metadata:()=>a,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const i={sidebar_position:1},l="Installation",a={unversionedId:"support/install-error",id:"version-v0.9/support/install-error",title:"Installation",description:"1. Could not find libintl.dylib",source:"@site/docs_versioned_docs/version-v0.9/support/install-error.md",sourceDirName:"support",slug:"/support/install-error",permalink:"/docs/v0.9/support/install-error",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/support/install-error.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"kusion",previous:{title:"FAQ",permalink:"/docs/v0.9/support/"},next:{title:"KCL",permalink:"/docs/v0.9/support/kcl"}},s={},p=[{value:"1. Could not find libintl.dylib",id:"1-could-not-find-libintldylib",level:2},{value:"2. macOS system SSL related errors",id:"2-macos-system-ssl-related-errors",level:2}],c={toc:p};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"installation"},"Installation"),(0,o.kt)("h2",{id:"1-could-not-find-libintldylib"},"1. Could not find ",(0,o.kt)("inlineCode",{parentName:"h2"},"libintl.dylib")),(0,o.kt)("p",null,"This problem is that some tools depends on the ",(0,o.kt)("inlineCode",{parentName:"p"},"Gettext")," library, but macOS does not have this library by default. You can try to solve it in the following ways:"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"(Skip this step for non-macOS m1) For macOS m1 operating system, make sure you have a homebrew arm64e-version installed in /opt/homebrew, otherwise install the arm version of brew with the following command")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"\n# add to path\nexport PATH=/opt/homebrew/bin:$PATH\n')),(0,o.kt)("ol",{start:2},(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"brew install gettext")),(0,o.kt)("li",{parentName:"ol"},"Make sure ",(0,o.kt)("inlineCode",{parentName:"li"},"libintl.8.dylib")," exists in ",(0,o.kt)("inlineCode",{parentName:"li"},"/usr/local/opt/gettext/lib")," directory"),(0,o.kt)("li",{parentName:"ol"},"If brew is installed in another directory, the library can be created by copying it to the corresponding directory")),(0,o.kt)("h2",{id:"2-macos-system-ssl-related-errors"},"2. macOS system SSL related errors"),(0,o.kt)("p",null,"Openssl dylib library not found or SSL module is not available problem"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"(Skip this step for non-macOS m1) For macOS m1 operating system, make sure you have a homebrew arm64e-version installed in /opt/homebrew, otherwise install the arm version of brew with the following command")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"\n# add to path\nexport PATH=/opt/homebrew/bin:$PATH\n')),(0,o.kt)("ol",{start:2},(0,o.kt)("li",{parentName:"ol"},"Install openssl (version 1.1) via brew")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"brew install openssl@1.1\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0b745da3.12c94f6f.js b/assets/js/0b745da3.12c94f6f.js deleted file mode 100644 index 407a7fcbc92..00000000000 --- a/assets/js/0b745da3.12c94f6f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5498],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),u=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=u(e.components);return a.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),d=u(n),m=r,f=d["".concat(p,".").concat(m)]||d[m]||c[m]||o;return n?a.createElement(f,i(i({ref:t},s),{},{components:n})):a.createElement(f,i({ref:t},s))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var u=2;u{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>c,frontMatter:()=>o,metadata:()=>l,toc:()=>u});var a=n(87462),r=(n(67294),n(3905));const o={id:"operational-rules"},i="Operational Rules",l={unversionedId:"configuration-walkthrough/operational-rules",id:"configuration-walkthrough/operational-rules",title:"Operational Rules",description:"You could also specify the collection of operational rule requirements for the application. That can be achieved via a opsrule module (or bring-your-own-module) in the accessories field in AppConfiguration to achieve that. Operational rules are used as a preemptive measure to police and stop any unwanted changes.",source:"@site/docs/kusion/4-configuration-walkthrough/9-operational-rules.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/operational-rules",permalink:"/docs/next/configuration-walkthrough/operational-rules",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/4-configuration-walkthrough/9-operational-rules.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:9,frontMatter:{id:"operational-rules"},sidebar:"kusion",previous:{title:"Application Monitoring",permalink:"/docs/next/configuration-walkthrough/monitoring"},next:{title:"Deliver the WordPress Application with Cloud RDS",permalink:"/docs/next/user-guides/cloud-resources/database"}},p={},u=[{value:"Import",id:"import",level:2},{value:"Max Unavailable Replicas",id:"max-unavailable-replicas",level:2}],s={toc:u};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"operational-rules"},"Operational Rules"),(0,r.kt)("p",null,"You could also specify the collection of operational rule requirements for the application. That can be achieved via a ",(0,r.kt)("inlineCode",{parentName:"p"},"opsrule")," module (or bring-your-own-module) in the ",(0,r.kt)("inlineCode",{parentName:"p"},"accessories")," field in ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," to achieve that. Operational rules are used as a preemptive measure to police and stop any unwanted changes."),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"kam")," package and the ",(0,r.kt)("inlineCode",{parentName:"p"},"opsrule")," Kusion Module. For more details on KCL package and module import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport opsrule as o\n")),(0,r.kt)("h2",{id:"max-unavailable-replicas"},"Max Unavailable Replicas"),(0,r.kt)("p",null,"Currently, the ",(0,r.kt)("inlineCode",{parentName:"p"},"opsrule")," module supports setting a ",(0,r.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," parameter, which specifies the maximum number of pods that can be rendered unavailable at any time. It can be either a fraction of the total pods for the current application or a fixed number. This operational rule is particularly helpful against unexpected changes or deletes to the workloads. It can also prevent too many workloads from going down during an application upgrade."),(0,r.kt)("p",null,"More rules will be available in future versions of Kusion."),(0,r.kt)("p",null,"To set ",(0,r.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," to a percentage of pods:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n # ...\n }\n }\n accessories: {\n "opsRule": o.OpsRule {\n maxUnavailable: "30%"\n }\n }\n}\n')),(0,r.kt)("p",null,"To set ",(0,r.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," to a fixed number of pods:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n accessories: {\n "opsRule": o.OpsRule {\n maxUnavailable: 2\n }\n }\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0b745da3.4ad49bdc.js b/assets/js/0b745da3.4ad49bdc.js new file mode 100644 index 00000000000..169c11d2a0d --- /dev/null +++ b/assets/js/0b745da3.4ad49bdc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5498],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),u=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=u(e.components);return a.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),d=u(n),m=r,f=d["".concat(p,".").concat(m)]||d[m]||c[m]||o;return n?a.createElement(f,i(i({ref:t},s),{},{components:n})):a.createElement(f,i({ref:t},s))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var u=2;u{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>c,frontMatter:()=>o,metadata:()=>l,toc:()=>u});var a=n(87462),r=(n(67294),n(3905));const o={id:"operational-rules"},i="Operational Rules",l={unversionedId:"configuration-walkthrough/operational-rules",id:"configuration-walkthrough/operational-rules",title:"Operational Rules",description:"You could also specify the collection of operational rule requirements for the application. That can be achieved via a opsrule module (or bring-your-own-module) in the accessories field in AppConfiguration to achieve that. Operational rules are used as a preemptive measure to police and stop any unwanted changes.",source:"@site/docs/kusion/4-configuration-walkthrough/9-operational-rules.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/operational-rules",permalink:"/docs/next/configuration-walkthrough/operational-rules",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/4-configuration-walkthrough/9-operational-rules.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:9,frontMatter:{id:"operational-rules"},sidebar:"kusion",previous:{title:"Application Monitoring",permalink:"/docs/next/configuration-walkthrough/monitoring"},next:{title:"Deliver the WordPress Application with Cloud RDS",permalink:"/docs/next/user-guides/cloud-resources/database"}},p={},u=[{value:"Import",id:"import",level:2},{value:"Max Unavailable Replicas",id:"max-unavailable-replicas",level:2}],s={toc:u};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"operational-rules"},"Operational Rules"),(0,r.kt)("p",null,"You could also specify the collection of operational rule requirements for the application. That can be achieved via a ",(0,r.kt)("inlineCode",{parentName:"p"},"opsrule")," module (or bring-your-own-module) in the ",(0,r.kt)("inlineCode",{parentName:"p"},"accessories")," field in ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," to achieve that. Operational rules are used as a preemptive measure to police and stop any unwanted changes."),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"kam")," package and the ",(0,r.kt)("inlineCode",{parentName:"p"},"opsrule")," Kusion Module. For more details on KCL package and module import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport opsrule as o\n")),(0,r.kt)("h2",{id:"max-unavailable-replicas"},"Max Unavailable Replicas"),(0,r.kt)("p",null,"Currently, the ",(0,r.kt)("inlineCode",{parentName:"p"},"opsrule")," module supports setting a ",(0,r.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," parameter, which specifies the maximum number of pods that can be rendered unavailable at any time. It can be either a fraction of the total pods for the current application or a fixed number. This operational rule is particularly helpful against unexpected changes or deletes to the workloads. It can also prevent too many workloads from going down during an application upgrade."),(0,r.kt)("p",null,"More rules will be available in future versions of Kusion."),(0,r.kt)("p",null,"To set ",(0,r.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," to a percentage of pods:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n # ...\n }\n }\n accessories: {\n "opsRule": o.OpsRule {\n maxUnavailable: "30%"\n }\n }\n}\n')),(0,r.kt)("p",null,"To set ",(0,r.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," to a fixed number of pods:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n accessories: {\n "opsRule": o.OpsRule {\n maxUnavailable: 2\n }\n }\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0d383345.40a38ff6.js b/assets/js/0d383345.40a38ff6.js new file mode 100644 index 00000000000..b8ddb44cc2a --- /dev/null +++ b/assets/js/0d383345.40a38ff6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1678],{3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function s(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),c=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},d=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},p=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=c(a),m=r,k=p["".concat(l,".").concat(m)]||p[m]||u[m]||o;return a?n.createElement(k,s(s({ref:t},d),{},{components:a})):n.createElement(k,s({ref:t},d))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=p;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var c=2;c{a.d(t,{Z:()=>s});var n=a(67294),r=a(86010);const o="tabItem_Ymn6";function s(e){let{children:t,hidden:a,className:s}=e;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(o,s),hidden:a},t)}},74866:(e,t,a)=>{a.d(t,{Z:()=>N});var n=a(87462),r=a(67294),o=a(86010),s=a(12466),i=a(76775),l=a(91980),c=a(67392),d=a(50012);function u(e){return function(e){var t;return(null==(t=r.Children.map(e,(e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})))?void 0:t.filter(Boolean))??[]}(e).map((e=>{let{props:{value:t,label:a,attributes:n,default:r}}=e;return{value:t,label:a,attributes:n,default:r}}))}function p(e){const{values:t,children:a}=e;return(0,r.useMemo)((()=>{const e=t??u(a);return function(e){const t=(0,c.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,a])}function m(e){let{value:t,tabValues:a}=e;return a.some((e=>e.value===t))}function k(e){let{queryString:t=!1,groupId:a}=e;const n=(0,i.k6)(),o=function(e){let{queryString:t=!1,groupId:a}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!a)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return a??null}({queryString:t,groupId:a});return[(0,l._X)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(n.location.search);t.set(o,e),n.replace({...n.location,search:t.toString()})}),[o,n])]}function h(e){const{defaultValue:t,queryString:a=!1,groupId:n}=e,o=p(e),[s,i]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:a}=e;if(0===a.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:a}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${a.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const n=a.find((e=>e.default))??a[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:o}))),[l,c]=k({queryString:a,groupId:n}),[u,h]=function(e){let{groupId:t}=e;const a=function(e){return e?`docusaurus.tab.${e}`:null}(t),[n,o]=(0,d.Nk)(a);return[n,(0,r.useCallback)((e=>{a&&o.set(e)}),[a,o])]}({groupId:n}),f=(()=>{const e=l??u;return m({value:e,tabValues:o})?e:null})();(0,r.useLayoutEffect)((()=>{f&&i(f)}),[f]);return{selectedValue:s,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);i(e),c(e),h(e)}),[c,h,o]),tabValues:o}}var f=a(72389);const g="tabList__CuJ",w="tabItem_LNqP";function b(e){let{className:t,block:a,selectedValue:i,selectValue:l,tabValues:c}=e;const d=[],{blockElementScrollPositionUntilNextRender:u}=(0,s.o5)(),p=e=>{const t=e.currentTarget,a=d.indexOf(t),n=c[a].value;n!==i&&(u(t),l(n))},m=e=>{var t;let a=null;switch(e.key){case"Enter":p(e);break;case"ArrowRight":{const t=d.indexOf(e.currentTarget)+1;a=d[t]??d[0];break}case"ArrowLeft":{const t=d.indexOf(e.currentTarget)-1;a=d[t]??d[d.length-1];break}}null==(t=a)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":a},t)},c.map((e=>{let{value:t,label:a,attributes:s}=e;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:i===t?0:-1,"aria-selected":i===t,key:t,ref:e=>d.push(e),onKeyDown:m,onClick:p},s,{className:(0,o.Z)("tabs__item",w,null==s?void 0:s.className,{"tabs__item--active":i===t})}),a??t)})))}function v(e){let{lazy:t,children:a,selectedValue:n}=e;const o=(Array.isArray(a)?a:[a]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===n));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==n}))))}function y(e){const t=h(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",g)},r.createElement(b,(0,n.Z)({},e,t)),r.createElement(v,(0,n.Z)({},e,t)))}function N(e){const t=(0,f.Z)();return r.createElement(y,(0,n.Z)({key:String(t)},e))}},17173:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>c,toc:()=>u});var n=a(87462),r=(a(67294),a(3905)),o=a(74866),s=a(85162);const i={},l="Deliver the WordPress Application with Cloud RDS",c={unversionedId:"user-guides/cloud-resources/database",id:"version-v0.10/user-guides/cloud-resources/database",title:"Deliver the WordPress Application with Cloud RDS",description:"This tutorial will demonstrate how to deploy a WordPress application with Kusion, which relies on both Kubernetes and IaaS resources provided by cloud vendors. We can learn how to declare the Relational Database Service (RDS) to provide a cloud-based database solution for our application from this article.",source:"@site/docs_versioned_docs/version-v0.10/5-user-guides/1-cloud-resources/1-database.md",sourceDirName:"5-user-guides/1-cloud-resources",slug:"/user-guides/cloud-resources/database",permalink:"/docs/v0.10/user-guides/cloud-resources/database",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/5-user-guides/1-cloud-resources/1-database.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{},sidebar:"kusion",previous:{title:"Operational Rules",permalink:"/docs/v0.10/configuration-walkthrough/operational-rules"},next:{title:"Expose Application Service Deployed on CSP Kubernetes",permalink:"/docs/v0.10/user-guides/cloud-resources/expose-service"}},d={},u=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Init Workspace",id:"init-workspace",level:2},{value:"Init Project",id:"init-project",level:2},{value:"Review Configuration Files",id:"review-configuration-files",level:3},{value:"Application Delivery",id:"application-delivery",level:2},{value:"Verify WordPress Application",id:"verify-wordpress-application",level:2},{value:"Delete WordPress Application",id:"delete-wordpress-application",level:2}],p={toc:u};function m(e){let{components:t,...i}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,i,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"deliver-the-wordpress-application-with-cloud-rds"},"Deliver the WordPress Application with Cloud RDS"),(0,r.kt)("p",null,"This tutorial will demonstrate how to deploy a WordPress application with Kusion, which relies on both Kubernetes and IaaS resources provided by cloud vendors. We can learn how to declare the Relational Database Service (RDS) to provide a cloud-based database solution for our application from this article. "),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"/docs/v0.10/getting-started/install-kusion"},"Kusion")),(0,r.kt)("li",{parentName:"ul"},"Deploy ",(0,r.kt)("a",{parentName:"li",href:"https://kubernetes.io/"},"Kubernetes")," or ",(0,r.kt)("a",{parentName:"li",href:"https://kind.sigs.k8s.io/"},"Kind")," or ",(0,r.kt)("a",{parentName:"li",href:"https://minikube.sigs.k8s.io/docs/tutorials/multi_node/"},"Minikube")),(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"https://www.terraform.io/"},"Terraform")),(0,r.kt)("li",{parentName:"ul"},"Prepare a cloud service account and create a user with ",(0,r.kt)("inlineCode",{parentName:"li"},"VPCFullAccess")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"RDSFullAccess")," permissions to use the Relational Database Service (RDS). This kind of user can be created and managed in the Identity and Access Management (IAM) console"),(0,r.kt)("li",{parentName:"ul"},"The environment that executes ",(0,r.kt)("inlineCode",{parentName:"li"},"kusion")," need to have connectivity to terraform registry to download the terraform providers")),(0,r.kt)("p",null,"Additionally, we also need to configure the obtained AccessKey and SecretKey as environment variables for specific cloud provider: "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'export AWS_ACCESS_KEY_ID="AKIAQZDxxxx" # replace it with your AccessKey\nexport AWS_SECRET_ACCESS_KEY="oE/xxxx" # replace it with your SecretKey\n')),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"aws iam account",src:a(24838).Z,width:"2874",height:"1398"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'export ALICLOUD_ACCESS_KEY="LTAI5txxx" # replace it with your AccessKey\nexport ALICLOUD_SECRET_KEY="nxuowIxxx" # replace it with your SecretKey\n')),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"alicloud iam account",src:a(73725).Z,width:"1500",height:"629"})))),(0,r.kt)("h2",{id:"init-workspace"},"Init Workspace"),(0,r.kt)("p",null,"To deploy the WordPress application with cloud rds, we first need to initiate a ",(0,r.kt)("inlineCode",{parentName:"p"},"Workspace")," for the targeted stack (here we are using ",(0,r.kt)("inlineCode",{parentName:"p"},"dev"),"). Please copy the following example YAML file to your local ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),". "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n kubernetes:\n kubeConfig: /etc/kubeconfig.yaml # Please replace with your own kubeconfig file path\n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n aws: \n version: 5.0.1\n source: hashicorp/aws\n region: us-east-1\n\n# MySQL configurations for AWS RDS\nmodules: \n mysql: \n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n privateRouting: false\n suffix: "-mysql"\n'))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n kubernetes:\n kubeConfig: /etc/kubeconfig.yaml # Replace with your own kubeconfig file path\n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n alicloud: \n version: 1.209.1\n source: aliyun/alicloud\n region: cn-beijing\n\n# MySQL configurations for Alicloud RDS\nmodules: \n mysql: \n default: \n cloud: alicloud\n size: 20\n instanceType: mysql.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n suffix: "-mysql"\n')))),(0,r.kt)("p",null,"You can replace the ",(0,r.kt)("inlineCode",{parentName:"p"},"runtimes.kubernetes.kubeConfig")," field with your own kubeconfig file path in ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),", and if you would like to try creating the ",(0,r.kt)("inlineCode",{parentName:"p"},"Alicloud")," RDS instance, you should also replace the ",(0,r.kt)("inlineCode",{parentName:"p"},"[your-subnet-id]")," of ",(0,r.kt)("inlineCode",{parentName:"p"},"modules.mysql.default.subnetID")," field with the Alicloud ",(0,r.kt)("inlineCode",{parentName:"p"},"vSwitchID")," to provision the database in. After that, you can execute the following command line to initiate the workspace configuration for ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," stack. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace create dev -f workspace.yaml\n")),(0,r.kt)("p",null,"If you already create the workspace configuration for ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," stack, you can append the Terraform runtime configs and MySQL module configs to your workspace YAML file and use the following command line to update the workspace configuration. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace update dev -f workspace.yaml\n")),(0,r.kt)("p",null,"You can use the following command lines to list and show the workspace configurations for ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," stack. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace list\n\nkusion workspace show dev\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," is a sample configuration file for workspace management, including ",(0,r.kt)("inlineCode",{parentName:"p"},"Kubernetes")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Terraform")," runtime configs and ",(0,r.kt)("inlineCode",{parentName:"p"},"MySQL")," module config. Workspace configurations are usually declared by ",(0,r.kt)("strong",{parentName:"p"},"Platform Engineers")," and will take effect through the corresponding stack. "),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about the configuration of Workspace can be found in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/design/workspace_management/workspace_management.md"},"Workspace Management"),". ")),(0,r.kt)("h2",{id:"init-project"},"Init Project"),(0,r.kt)("p",null,"We can start by initializing this tutorial project with online templates: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion init --online\n")),(0,r.kt)("p",null,"All init templates are listed as follows:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"\u279c kusion_playground kusion init --online\n? Please choose a template: wordpress-cloud-rds A sample wordpress project with cloud rds\nThis command will walk you through creating a new kusion project.\n\nEnter a value or leave blank to accept the (default), and press .\nPress ^C at any time to quit.\n\nProject Config:\n? ProjectName: wordpress-cloud-rds\n? AppName: wordpress\nStack Config: dev\n? Image: wordpress:6.3\nCreated project 'wordpress-cloud-rds'\n")),(0,r.kt)("p",null,"Select ",(0,r.kt)("inlineCode",{parentName:"p"},"wordpress-cloud-rds")," and press ",(0,r.kt)("inlineCode",{parentName:"p"},"Enter"),". After that, we will see hints below and use the default values to config this project and stack."),(0,r.kt)("p",null,(0,r.kt)("img",{src:a(52811).Z,width:"2560",height:"1440"})),(0,r.kt)("p",null,"The directory structure looks like the following:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"cd wordpress-cloud-rds/dev && tree\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"\u279c kusion_playground cd wordpress-cloud-rds/dev && tree\n.\n\u251c\u2500\u2500 kcl.mod\n\u251c\u2500\u2500 main.k\n\u2514\u2500\u2500 stack.yaml\n\n1 directory, 3 files\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about the directory structure can be found in ",(0,r.kt)("a",{parentName:"p",href:"/docs/v0.10/concepts/project/overview"},"Project")," and ",(0,r.kt)("a",{parentName:"p",href:"/docs/v0.10/concepts/stack/overview"},"Stack"),". ")),(0,r.kt)("h3",{id:"review-configuration-files"},"Review Configuration Files"),(0,r.kt)("p",null,"Now let's take a look at the configuration files located in ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/main.k"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.network as n\nimport catalog.models.schema.v1.accessories.mysql\n\n# main.k declares customized configurations for dev stacks.\nwordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n wordpress: c.Container {\n image: "wordpress:6.3"\n env: {\n "WORDPRESS_DB_HOST": "$(KUSION_DB_HOST_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_NAME": "mysql"\n }\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n database: {\n wordpress: mysql.MySQL {\n type: "cloud"\n version: "8.0"\n }\n }\n}\n')),(0,r.kt)("p",null,"The configuration file ",(0,r.kt)("inlineCode",{parentName:"p"},"main.k"),", usually written by the ",(0,r.kt)("strong",{parentName:"p"},"App Developers"),", declares customized configurations for ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," stack, which includes an ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," with the name of ",(0,r.kt)("inlineCode",{parentName:"p"},"wordpress"),". And the ",(0,r.kt)("inlineCode",{parentName:"p"},"wordpress")," application includes a workload of type ",(0,r.kt)("inlineCode",{parentName:"p"},"workload.Service"),", which runs on 1 replica and exposes ",(0,r.kt)("inlineCode",{parentName:"p"},"80")," port to be accessed. Besides, it declares a cloud ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql.MySQL")," as the database accessory with the engine version of ",(0,r.kt)("inlineCode",{parentName:"p"},"8.0")," for the application.\nThe necessary Terraform resources for deploying and using the cloud rds (relational database service) will be generated, and users can get the ",(0,r.kt)("inlineCode",{parentName:"p"},"host"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"username")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"password")," of the database through the ",(0,r.kt)("a",{parentName:"p",href:"/docs/v0.10/reference/modules/catalog-models/database/mysql#credentials-and-connectivity"},"mysql credentials and connectivity")," of Kusion in application containers. "),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about Catalog models can be found in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"Catalog"))),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"The collaboration paradigm between App Developers and Platform Engineers with Kusion can be found in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/design/collaboration/collaboration_paradigm.md"},"Collaboration Paradigm"))),(0,r.kt)("h2",{id:"application-delivery"},"Application Delivery"),(0,r.kt)("p",null,"You can complete the delivery of the WordPress application in the folder of ",(0,r.kt)("inlineCode",{parentName:"p"},"wordpress-cloud-rds/dev")," using the following command line: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion apply --watch\n")),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply the wordpress application with aws rds",src:a(5721).Z,width:"2874",height:"802"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply the wordpress application with alicloud rds",src:a(91609).Z,width:"2876",height:"858"})))),(0,r.kt)("p",null,"After all the resources reconciled, we can port-forward our local port (e.g. 12345) to the WordPress frontend service port (80) in the cluster:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kubectl port-forward -n wordpress-cloud-rds svc/wordpress-cloud-rds-dev-wordpress-private 12345:80\n")),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kubectl port-forward for wordpress",src:a(76831).Z,width:"2874",height:"150"})),(0,r.kt)("h2",{id:"verify-wordpress-application"},"Verify WordPress Application"),(0,r.kt)("p",null,"Next, we will verify the WordPress site service we just delivered, along with the creation of the RDS instance it depends on. We can start using the WordPress site by accessing the link of local-forwarded port ",(0,r.kt)("a",{parentName:"p",href:"http://localhost:12345"},"(http://localhost:12345)")," we just configured in the browser. "),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"wordpress site page",src:a(85773).Z,width:"1500",height:"803"})),(0,r.kt)("p",null,"In addition, we can also log in to the cloud service console page to view the RDS instance we just created."),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"aws rds instance",src:a(42229).Z,width:"2298",height:"706"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"alicloud rds instance",src:a(99782).Z,width:"2870",height:"616"})))),(0,r.kt)("h2",{id:"delete-wordpress-application"},"Delete WordPress Application"),(0,r.kt)("p",null,"You can delete the WordPress application and related RDS resources using the following command line. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion destroy --yes\n")),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kusion destroy wordpress with aws rds",src:a(74068).Z,width:"2874",height:"788"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kusion destroy wordpress with alicloud rds",src:a(72557).Z,width:"2874",height:"820"})))))}m.isMDXComponent=!0},91609:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/apply-wordpress-cloud-rds-alicloud-14224502ce1c4d077fa1ed3777b1add9.png"},5721:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/apply-wordpress-cloud-rds-aws-9c72f8fd79000427958c5376085a65b8.png"},24838:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/aws-iam-account-2216105e7fa18fb2f7bf4be7e19f98bd.png"},99782:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/cloud-rds-instance-alicloud-e2062c7a477d445b3decf429105ab3d6.png"},42229:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/cloud-rds-instance-aws-64d6371851d55e05fb05353bbd9a19b1.png"},72557:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/destroy-wordpress-cloud-rds-alicloud-9c5da68051d92f6a8b3a11db9dd49273.png"},74068:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/destroy-wordpress-cloud-rds-aws-04a2cf44dbce1bcac488f8ce3dcdae81.png"},52811:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/init-wordpress-cloud-rds-ae612c3ca0f69fd417abb132fd8bfb78.gif"},73725:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/set-rds-access-9347ae09377aeb94d9f6d1e5d8688ab5.png"},76831:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/wordpress-cloud-rds-port-forward-611c4f17d055d9ee941b9ff87a0727f5.png"},85773:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/wordpress-site-page-ef650e640399209d1eec5e6dfe88c454.png"}}]); \ No newline at end of file diff --git a/assets/js/0d383345.9d67235e.js b/assets/js/0d383345.9d67235e.js deleted file mode 100644 index f555e9b67be..00000000000 --- a/assets/js/0d383345.9d67235e.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1678],{3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function s(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),c=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},d=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},p=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=c(a),m=r,k=p["".concat(l,".").concat(m)]||p[m]||u[m]||o;return a?n.createElement(k,s(s({ref:t},d),{},{components:a})):n.createElement(k,s({ref:t},d))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=p;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var c=2;c{a.d(t,{Z:()=>s});var n=a(67294),r=a(86010);const o="tabItem_Ymn6";function s(e){let{children:t,hidden:a,className:s}=e;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(o,s),hidden:a},t)}},74866:(e,t,a)=>{a.d(t,{Z:()=>N});var n=a(87462),r=a(67294),o=a(86010),s=a(12466),i=a(76775),l=a(91980),c=a(67392),d=a(50012);function u(e){return function(e){var t;return(null==(t=r.Children.map(e,(e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})))?void 0:t.filter(Boolean))??[]}(e).map((e=>{let{props:{value:t,label:a,attributes:n,default:r}}=e;return{value:t,label:a,attributes:n,default:r}}))}function p(e){const{values:t,children:a}=e;return(0,r.useMemo)((()=>{const e=t??u(a);return function(e){const t=(0,c.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,a])}function m(e){let{value:t,tabValues:a}=e;return a.some((e=>e.value===t))}function k(e){let{queryString:t=!1,groupId:a}=e;const n=(0,i.k6)(),o=function(e){let{queryString:t=!1,groupId:a}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!a)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return a??null}({queryString:t,groupId:a});return[(0,l._X)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(n.location.search);t.set(o,e),n.replace({...n.location,search:t.toString()})}),[o,n])]}function h(e){const{defaultValue:t,queryString:a=!1,groupId:n}=e,o=p(e),[s,i]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:a}=e;if(0===a.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:a}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${a.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const n=a.find((e=>e.default))??a[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:o}))),[l,c]=k({queryString:a,groupId:n}),[u,h]=function(e){let{groupId:t}=e;const a=function(e){return e?`docusaurus.tab.${e}`:null}(t),[n,o]=(0,d.Nk)(a);return[n,(0,r.useCallback)((e=>{a&&o.set(e)}),[a,o])]}({groupId:n}),f=(()=>{const e=l??u;return m({value:e,tabValues:o})?e:null})();(0,r.useLayoutEffect)((()=>{f&&i(f)}),[f]);return{selectedValue:s,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);i(e),c(e),h(e)}),[c,h,o]),tabValues:o}}var f=a(72389);const g="tabList__CuJ",w="tabItem_LNqP";function b(e){let{className:t,block:a,selectedValue:i,selectValue:l,tabValues:c}=e;const d=[],{blockElementScrollPositionUntilNextRender:u}=(0,s.o5)(),p=e=>{const t=e.currentTarget,a=d.indexOf(t),n=c[a].value;n!==i&&(u(t),l(n))},m=e=>{var t;let a=null;switch(e.key){case"Enter":p(e);break;case"ArrowRight":{const t=d.indexOf(e.currentTarget)+1;a=d[t]??d[0];break}case"ArrowLeft":{const t=d.indexOf(e.currentTarget)-1;a=d[t]??d[d.length-1];break}}null==(t=a)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":a},t)},c.map((e=>{let{value:t,label:a,attributes:s}=e;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:i===t?0:-1,"aria-selected":i===t,key:t,ref:e=>d.push(e),onKeyDown:m,onClick:p},s,{className:(0,o.Z)("tabs__item",w,null==s?void 0:s.className,{"tabs__item--active":i===t})}),a??t)})))}function v(e){let{lazy:t,children:a,selectedValue:n}=e;const o=(Array.isArray(a)?a:[a]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===n));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==n}))))}function y(e){const t=h(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",g)},r.createElement(b,(0,n.Z)({},e,t)),r.createElement(v,(0,n.Z)({},e,t)))}function N(e){const t=(0,f.Z)();return r.createElement(y,(0,n.Z)({key:String(t)},e))}},17173:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>c,toc:()=>u});var n=a(87462),r=(a(67294),a(3905)),o=a(74866),s=a(85162);const i={},l="Deliver the WordPress Application with Cloud RDS",c={unversionedId:"user-guides/cloud-resources/database",id:"version-v0.10/user-guides/cloud-resources/database",title:"Deliver the WordPress Application with Cloud RDS",description:"This tutorial will demonstrate how to deploy a WordPress application with Kusion, which relies on both Kubernetes and IaaS resources provided by cloud vendors. We can learn how to declare the Relational Database Service (RDS) to provide a cloud-based database solution for our application from this article.",source:"@site/docs_versioned_docs/version-v0.10/5-user-guides/1-cloud-resources/1-database.md",sourceDirName:"5-user-guides/1-cloud-resources",slug:"/user-guides/cloud-resources/database",permalink:"/docs/v0.10/user-guides/cloud-resources/database",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/5-user-guides/1-cloud-resources/1-database.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{},sidebar:"kusion",previous:{title:"Operational Rules",permalink:"/docs/v0.10/configuration-walkthrough/operational-rules"},next:{title:"Expose Application Service Deployed on CSP Kubernetes",permalink:"/docs/v0.10/user-guides/cloud-resources/expose-service"}},d={},u=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Init Workspace",id:"init-workspace",level:2},{value:"Init Project",id:"init-project",level:2},{value:"Review Configuration Files",id:"review-configuration-files",level:3},{value:"Application Delivery",id:"application-delivery",level:2},{value:"Verify WordPress Application",id:"verify-wordpress-application",level:2},{value:"Delete WordPress Application",id:"delete-wordpress-application",level:2}],p={toc:u};function m(e){let{components:t,...i}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,i,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"deliver-the-wordpress-application-with-cloud-rds"},"Deliver the WordPress Application with Cloud RDS"),(0,r.kt)("p",null,"This tutorial will demonstrate how to deploy a WordPress application with Kusion, which relies on both Kubernetes and IaaS resources provided by cloud vendors. We can learn how to declare the Relational Database Service (RDS) to provide a cloud-based database solution for our application from this article. "),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"/docs/v0.10/getting-started/install-kusion"},"Kusion")),(0,r.kt)("li",{parentName:"ul"},"Deploy ",(0,r.kt)("a",{parentName:"li",href:"https://kubernetes.io/"},"Kubernetes")," or ",(0,r.kt)("a",{parentName:"li",href:"https://kind.sigs.k8s.io/"},"Kind")," or ",(0,r.kt)("a",{parentName:"li",href:"https://minikube.sigs.k8s.io/docs/tutorials/multi_node/"},"Minikube")),(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"https://www.terraform.io/"},"Terraform")),(0,r.kt)("li",{parentName:"ul"},"Prepare a cloud service account and create a user with ",(0,r.kt)("inlineCode",{parentName:"li"},"VPCFullAccess")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"RDSFullAccess")," permissions to use the Relational Database Service (RDS). This kind of user can be created and managed in the Identity and Access Management (IAM) console"),(0,r.kt)("li",{parentName:"ul"},"The environment that executes ",(0,r.kt)("inlineCode",{parentName:"li"},"kusion")," need to have connectivity to terraform registry to download the terraform providers")),(0,r.kt)("p",null,"Additionally, we also need to configure the obtained AccessKey and SecretKey as environment variables for specific cloud provider: "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'export AWS_ACCESS_KEY_ID="AKIAQZDxxxx" # replace it with your AccessKey\nexport AWS_SECRET_ACCESS_KEY="oE/xxxx" # replace it with your SecretKey\n')),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"aws iam account",src:a(24838).Z,width:"2874",height:"1398"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'export ALICLOUD_ACCESS_KEY="LTAI5txxx" # replace it with your AccessKey\nexport ALICLOUD_SECRET_KEY="nxuowIxxx" # replace it with your SecretKey\n')),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"alicloud iam account",src:a(73725).Z,width:"1500",height:"629"})))),(0,r.kt)("h2",{id:"init-workspace"},"Init Workspace"),(0,r.kt)("p",null,"To deploy the WordPress application with cloud rds, we first need to initiate a ",(0,r.kt)("inlineCode",{parentName:"p"},"Workspace")," for the targeted stack (here we are using ",(0,r.kt)("inlineCode",{parentName:"p"},"dev"),"). Please copy the following example YAML file to your local ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),". "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n kubernetes:\n kubeConfig: /etc/kubeconfig.yaml # Please replace with your own kubeconfig file path\n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n aws: \n version: 5.0.1\n source: hashicorp/aws\n region: us-east-1\n\n# MySQL configurations for AWS RDS\nmodules: \n mysql: \n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n privateRouting: false\n suffix: "-mysql"\n'))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n kubernetes:\n kubeConfig: /etc/kubeconfig.yaml # Replace with your own kubeconfig file path\n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n alicloud: \n version: 1.209.1\n source: aliyun/alicloud\n region: cn-beijing\n\n# MySQL configurations for Alicloud RDS\nmodules: \n mysql: \n default: \n cloud: alicloud\n size: 20\n instanceType: mysql.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n suffix: "-mysql"\n')))),(0,r.kt)("p",null,"You can replace the ",(0,r.kt)("inlineCode",{parentName:"p"},"runtimes.kubernetes.kubeConfig")," field with your own kubeconfig file path in ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),", and if you would like to try creating the ",(0,r.kt)("inlineCode",{parentName:"p"},"Alicloud")," RDS instance, you should also replace the ",(0,r.kt)("inlineCode",{parentName:"p"},"[your-subnet-id]")," of ",(0,r.kt)("inlineCode",{parentName:"p"},"modules.mysql.default.subnetID")," field with the Alicloud ",(0,r.kt)("inlineCode",{parentName:"p"},"vSwitchID")," to provision the database in. After that, you can execute the following command line to initiate the workspace configuration for ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," stack. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace create dev -f workspace.yaml\n")),(0,r.kt)("p",null,"If you already create the workspace configuration for ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," stack, you can append the Terraform runtime configs and MySQL module configs to your workspace YAML file and use the following command line to update the workspace configuration. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace update dev -f workspace.yaml\n")),(0,r.kt)("p",null,"You can use the following command lines to list and show the workspace configurations for ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," stack. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace list\n\nkusion workspace show dev\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," is a sample configuration file for workspace management, including ",(0,r.kt)("inlineCode",{parentName:"p"},"Kubernetes")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Terraform")," runtime configs and ",(0,r.kt)("inlineCode",{parentName:"p"},"MySQL")," module config. Workspace configurations are usually declared by ",(0,r.kt)("strong",{parentName:"p"},"Platform Engineers")," and will take effect through the corresponding stack. "),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about the configuration of Workspace can be found in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/design/workspace_management/workspace_management.md"},"Workspace Management"),". ")),(0,r.kt)("h2",{id:"init-project"},"Init Project"),(0,r.kt)("p",null,"We can start by initializing this tutorial project with online templates: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion init --online\n")),(0,r.kt)("p",null,"All init templates are listed as follows:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"\u279c kusion_playground kusion init --online\n? Please choose a template: wordpress-cloud-rds A sample wordpress project with cloud rds\nThis command will walk you through creating a new kusion project.\n\nEnter a value or leave blank to accept the (default), and press .\nPress ^C at any time to quit.\n\nProject Config:\n? ProjectName: wordpress-cloud-rds\n? AppName: wordpress\nStack Config: dev\n? Image: wordpress:6.3\nCreated project 'wordpress-cloud-rds'\n")),(0,r.kt)("p",null,"Select ",(0,r.kt)("inlineCode",{parentName:"p"},"wordpress-cloud-rds")," and press ",(0,r.kt)("inlineCode",{parentName:"p"},"Enter"),". After that, we will see hints below and use the default values to config this project and stack."),(0,r.kt)("p",null,(0,r.kt)("img",{src:a(52811).Z,width:"2560",height:"1440"})),(0,r.kt)("p",null,"The directory structure looks like the following:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"cd wordpress-cloud-rds/dev && tree\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"\u279c kusion_playground cd wordpress-cloud-rds/dev && tree\n.\n\u251c\u2500\u2500 kcl.mod\n\u251c\u2500\u2500 main.k\n\u2514\u2500\u2500 stack.yaml\n\n1 directory, 3 files\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about the directory structure can be found in ",(0,r.kt)("a",{parentName:"p",href:"/docs/v0.10/concepts/project/overview"},"Project")," and ",(0,r.kt)("a",{parentName:"p",href:"/docs/v0.10/concepts/stack/overview"},"Stack"),". ")),(0,r.kt)("h3",{id:"review-configuration-files"},"Review Configuration Files"),(0,r.kt)("p",null,"Now let's take a look at the configuration files located in ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/main.k"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.network as n\nimport catalog.models.schema.v1.accessories.mysql\n\n# main.k declares customized configurations for dev stacks.\nwordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n wordpress: c.Container {\n image: "wordpress:6.3"\n env: {\n "WORDPRESS_DB_HOST": "$(KUSION_DB_HOST_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_NAME": "mysql"\n }\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n database: {\n wordpress: mysql.MySQL {\n type: "cloud"\n version: "8.0"\n }\n }\n}\n')),(0,r.kt)("p",null,"The configuration file ",(0,r.kt)("inlineCode",{parentName:"p"},"main.k"),", usually written by the ",(0,r.kt)("strong",{parentName:"p"},"App Developers"),", declares customized configurations for ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," stack, which includes an ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," with the name of ",(0,r.kt)("inlineCode",{parentName:"p"},"wordpress"),". And the ",(0,r.kt)("inlineCode",{parentName:"p"},"wordpress")," application includes a workload of type ",(0,r.kt)("inlineCode",{parentName:"p"},"workload.Service"),", which runs on 1 replica and exposes ",(0,r.kt)("inlineCode",{parentName:"p"},"80")," port to be accessed. Besides, it declares a cloud ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql.MySQL")," as the database accessory with the engine version of ",(0,r.kt)("inlineCode",{parentName:"p"},"8.0")," for the application.\nThe necessary Terraform resources for deploying and using the cloud rds (relational database service) will be generated, and users can get the ",(0,r.kt)("inlineCode",{parentName:"p"},"host"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"username")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"password")," of the database through the ",(0,r.kt)("a",{parentName:"p",href:"/docs/v0.10/reference/modules/catalog-models/database/mysql#credentials-and-connectivity"},"mysql credentials and connectivity")," of Kusion in application containers. "),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about Catalog models can be found in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"Catalog"))),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"The collaboration paradigm between App Developers and Platform Engineers with Kusion can be found in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/design/collaboration/collaboration_paradigm.md"},"Collaboration Paradigm"))),(0,r.kt)("h2",{id:"application-delivery"},"Application Delivery"),(0,r.kt)("p",null,"You can complete the delivery of the WordPress application in the folder of ",(0,r.kt)("inlineCode",{parentName:"p"},"wordpress-cloud-rds/dev")," using the following command line: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion apply --watch\n")),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply the wordpress application with aws rds",src:a(5721).Z,width:"2874",height:"802"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply the wordpress application with alicloud rds",src:a(91609).Z,width:"2876",height:"858"})))),(0,r.kt)("p",null,"After all the resources reconciled, we can port-forward our local port (e.g. 12345) to the WordPress frontend service port (80) in the cluster:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kubectl port-forward -n wordpress-cloud-rds svc/wordpress-cloud-rds-dev-wordpress-private 12345:80\n")),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kubectl port-forward for wordpress",src:a(76831).Z,width:"2874",height:"150"})),(0,r.kt)("h2",{id:"verify-wordpress-application"},"Verify WordPress Application"),(0,r.kt)("p",null,"Next, we will verify the WordPress site service we just delivered, along with the creation of the RDS instance it depends on. We can start using the WordPress site by accessing the link of local-forwarded port ",(0,r.kt)("a",{parentName:"p",href:"http://localhost:12345"},"(http://localhost:12345)")," we just configured in the browser. "),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"wordpress site page",src:a(85773).Z,width:"1500",height:"803"})),(0,r.kt)("p",null,"In addition, we can also log in to the cloud service console page to view the RDS instance we just created."),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"aws rds instance",src:a(42229).Z,width:"2298",height:"706"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"alicloud rds instance",src:a(99782).Z,width:"2870",height:"616"})))),(0,r.kt)("h2",{id:"delete-wordpress-application"},"Delete WordPress Application"),(0,r.kt)("p",null,"You can delete the WordPress application and related RDS resources using the following command line. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion destroy --yes\n")),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kusion destroy wordpress with aws rds",src:a(74068).Z,width:"2874",height:"788"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kusion destroy wordpress with alicloud rds",src:a(72557).Z,width:"2874",height:"820"})))))}m.isMDXComponent=!0},91609:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/apply-wordpress-cloud-rds-alicloud-14224502ce1c4d077fa1ed3777b1add9.png"},5721:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/apply-wordpress-cloud-rds-aws-9c72f8fd79000427958c5376085a65b8.png"},24838:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/aws-iam-account-2216105e7fa18fb2f7bf4be7e19f98bd.png"},99782:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/cloud-rds-instance-alicloud-e2062c7a477d445b3decf429105ab3d6.png"},42229:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/cloud-rds-instance-aws-64d6371851d55e05fb05353bbd9a19b1.png"},72557:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/destroy-wordpress-cloud-rds-alicloud-9c5da68051d92f6a8b3a11db9dd49273.png"},74068:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/destroy-wordpress-cloud-rds-aws-04a2cf44dbce1bcac488f8ce3dcdae81.png"},52811:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/init-wordpress-cloud-rds-ae612c3ca0f69fd417abb132fd8bfb78.gif"},73725:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/set-rds-access-9347ae09377aeb94d9f6d1e5d8688ab5.png"},76831:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/wordpress-cloud-rds-port-forward-611c4f17d055d9ee941b9ff87a0727f5.png"},85773:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/wordpress-site-page-ef650e640399209d1eec5e6dfe88c454.png"}}]); \ No newline at end of file diff --git a/assets/js/0d662946.2a16f681.js b/assets/js/0d662946.2a16f681.js deleted file mode 100644 index 74471d9e70a..00000000000 --- a/assets/js/0d662946.2a16f681.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9435],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=a.createContext({}),p=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},c=function(e){var n=p(e.components);return a.createElement(s.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,o=e.mdxType,r=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(t),m=o,k=u["".concat(s,".").concat(m)]||u[m]||d[m]||r;return t?a.createElement(k,i(i({ref:n},c),{},{components:t})):a.createElement(k,i({ref:n},c))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var r=t.length,i=new Array(r);i[0]=u;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var p=2;p{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>r,metadata:()=>l,toc:()=>p});var a=t(87462),o=(t(67294),t(3905));const r={},i="Application Developer User Guide",l={unversionedId:"concepts/kusion-module/app-dev-guide",id:"concepts/kusion-module/app-dev-guide",title:"Application Developer User Guide",description:"Choose modules you need",source:"@site/docs/kusion/3-concepts/3-kusion-module/3-app-dev-guide.md",sourceDirName:"3-concepts/3-kusion-module",slug:"/concepts/kusion-module/app-dev-guide",permalink:"/docs/next/concepts/kusion-module/app-dev-guide",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/3-concepts/3-kusion-module/3-app-dev-guide.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{},sidebar:"kusion",previous:{title:"Platform Engineer Develop Guide",permalink:"/docs/next/concepts/kusion-module/develop-guide"},next:{title:"Workspace",permalink:"/docs/next/concepts/workspace"}},s={},p=[{value:"Choose modules you need",id:"choose-modules-you-need",level:2},{value:"Import and initialize modules",id:"import-and-initialize-modules",level:2},{value:"Add dependencies",id:"add-dependencies",level:3},{value:"Initialize modules",id:"initialize-modules",level:3},{value:"Preview the result",id:"preview-the-result",level:2}],c={toc:p};function d(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"application-developer-user-guide"},"Application Developer User Guide"),(0,o.kt)("h2",{id:"choose-modules-you-need"},"Choose modules you need"),(0,o.kt)("p",null,"For all KusionStack built-in modules, you can find all available versions and documents in the ",(0,o.kt)("a",{parentName:"p",href:"/docs/next/reference/modules/"},"reference")),(0,o.kt)("h2",{id:"import-and-initialize-modules"},"Import and initialize modules"),(0,o.kt)("h3",{id:"add-dependencies"},"Add dependencies"),(0,o.kt)("p",null,"Taking ",(0,o.kt)("inlineCode",{parentName:"p"},"kawesome")," as an example, the directory structure is shown below:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"example\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 example_workspace.yaml\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n")),(0,o.kt)("p",null,"Before importing modules in your AppConfiguration, you should add them to the dependencies part of the ",(0,o.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "example"\n\n[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nkawesome = { oci = "oci://ghcr.io/kusionstack/kawesome", tag = "0.1.0" }\n\n[profile]\nentries = ["main.k"]\n')),(0,o.kt)("p",null,"The kam dependency represents the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kam.git"},"Kusion Application Module")," which contains the AppConfiguration and other basic modules. The ",(0,o.kt)("inlineCode",{parentName:"p"},"kawesome")," is the Kusion module we are going to use in the AppConfiguration."),(0,o.kt)("h3",{id:"initialize-modules"},"Initialize modules"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport kawesome.kawesome as ks\n\nkawesome: ac.AppConfiguration {\n # Declare the workload configurations. \n workload: wl.Service {\n containers: {\n kawesome: c.Container {\n image: "hashicorp/http-echo"\n }\n }\n }\n # Declare the kawesome module configurations. \n accessories: {\n "kawesome": ks.Kawesome {\n service: ks.Service{\n port: 5678\n }\n }\n }\n}\n')),(0,o.kt)("p",null,"Initialize the ",(0,o.kt)("inlineCode",{parentName:"p"},"kawesome")," module in the ",(0,o.kt)("inlineCode",{parentName:"p"},"accessories")," block of the AppConfiguration. The key of the ",(0,o.kt)("inlineCode",{parentName:"p"},"accessories")," item represents the module name and the value represents the actual module you required."),(0,o.kt)("h2",{id:"preview-the-result"},"Preview the result"),(0,o.kt)("p",null,"Execute the preview command to validate the result."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"kusion preview\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"}," \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev \nID Action\nhashicorp:random:random_password:example-dev-kawesome Create\nv1:Namespace:example Create\nv1:Service:example:example-dev-kawesome Create\napps.kusionstack.io/v1alpha1:PodTransitionRule:example:example-dev-kawesome Create\napps.kusionstack.io/v1alpha1:CollaSet:example:example-dev-kawesome Create\n\n\n? Which diff detail do you want to see? [Use arrows to move, type to filter]\n> all\n hashicorp:random:random_password:example-dev-kawesome Create\n v1:Namespace:example Create\n v1:Service:example:example-dev-kawesome Create\n apps.kusionstack.io/v1alpha1:PodTransitionRule:example:example-dev-kawesome Create\n apps.kusionstack.io/v1alpha1:CollaSet:example:example-dev-kawesome Create\n cancel\n\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0d662946.7f7d468a.js b/assets/js/0d662946.7f7d468a.js new file mode 100644 index 00000000000..51bbe75a58c --- /dev/null +++ b/assets/js/0d662946.7f7d468a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9435],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=a.createContext({}),p=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},c=function(e){var n=p(e.components);return a.createElement(s.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,o=e.mdxType,r=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(t),m=o,k=u["".concat(s,".").concat(m)]||u[m]||d[m]||r;return t?a.createElement(k,i(i({ref:n},c),{},{components:t})):a.createElement(k,i({ref:n},c))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var r=t.length,i=new Array(r);i[0]=u;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var p=2;p{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>r,metadata:()=>l,toc:()=>p});var a=t(87462),o=(t(67294),t(3905));const r={},i="Application Developer User Guide",l={unversionedId:"concepts/kusion-module/app-dev-guide",id:"concepts/kusion-module/app-dev-guide",title:"Application Developer User Guide",description:"Choose modules you need",source:"@site/docs/kusion/3-concepts/3-kusion-module/3-app-dev-guide.md",sourceDirName:"3-concepts/3-kusion-module",slug:"/concepts/kusion-module/app-dev-guide",permalink:"/docs/next/concepts/kusion-module/app-dev-guide",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/3-concepts/3-kusion-module/3-app-dev-guide.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{},sidebar:"kusion",previous:{title:"Platform Engineer Develop Guide",permalink:"/docs/next/concepts/kusion-module/develop-guide"},next:{title:"Workspace",permalink:"/docs/next/concepts/workspace"}},s={},p=[{value:"Choose modules you need",id:"choose-modules-you-need",level:2},{value:"Import and initialize modules",id:"import-and-initialize-modules",level:2},{value:"Add dependencies",id:"add-dependencies",level:3},{value:"Initialize modules",id:"initialize-modules",level:3},{value:"Preview the result",id:"preview-the-result",level:2}],c={toc:p};function d(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"application-developer-user-guide"},"Application Developer User Guide"),(0,o.kt)("h2",{id:"choose-modules-you-need"},"Choose modules you need"),(0,o.kt)("p",null,"For all KusionStack built-in modules, you can find all available versions and documents in the ",(0,o.kt)("a",{parentName:"p",href:"/docs/next/reference/modules/"},"reference")),(0,o.kt)("h2",{id:"import-and-initialize-modules"},"Import and initialize modules"),(0,o.kt)("h3",{id:"add-dependencies"},"Add dependencies"),(0,o.kt)("p",null,"Taking ",(0,o.kt)("inlineCode",{parentName:"p"},"kawesome")," as an example, the directory structure is shown below:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"example\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 example_workspace.yaml\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n")),(0,o.kt)("p",null,"Before importing modules in your AppConfiguration, you should add them to the dependencies part of the ",(0,o.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-toml"},'[package]\nname = "example"\n\n[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nkawesome = { oci = "oci://ghcr.io/kusionstack/kawesome", tag = "0.1.0" }\n\n[profile]\nentries = ["main.k"]\n')),(0,o.kt)("p",null,"The kam dependency represents the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kam.git"},"Kusion Application Module")," which contains the AppConfiguration and other basic modules. The ",(0,o.kt)("inlineCode",{parentName:"p"},"kawesome")," is the Kusion module we are going to use in the AppConfiguration."),(0,o.kt)("h3",{id:"initialize-modules"},"Initialize modules"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport kawesome.kawesome as ks\n\nkawesome: ac.AppConfiguration {\n # Declare the workload configurations. \n workload: wl.Service {\n containers: {\n kawesome: c.Container {\n image: "hashicorp/http-echo"\n }\n }\n }\n # Declare the kawesome module configurations. \n accessories: {\n "kawesome": ks.Kawesome {\n service: ks.Service{\n port: 5678\n }\n }\n }\n}\n')),(0,o.kt)("p",null,"Initialize the ",(0,o.kt)("inlineCode",{parentName:"p"},"kawesome")," module in the ",(0,o.kt)("inlineCode",{parentName:"p"},"accessories")," block of the AppConfiguration. The key of the ",(0,o.kt)("inlineCode",{parentName:"p"},"accessories")," item represents the module name and the value represents the actual module you required."),(0,o.kt)("h2",{id:"preview-the-result"},"Preview the result"),(0,o.kt)("p",null,"Execute the preview command to validate the result."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"kusion preview\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"}," \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev \nID Action\nhashicorp:random:random_password:example-dev-kawesome Create\nv1:Namespace:example Create\nv1:Service:example:example-dev-kawesome Create\napps.kusionstack.io/v1alpha1:PodTransitionRule:example:example-dev-kawesome Create\napps.kusionstack.io/v1alpha1:CollaSet:example:example-dev-kawesome Create\n\n\n? Which diff detail do you want to see? [Use arrows to move, type to filter]\n> all\n hashicorp:random:random_password:example-dev-kawesome Create\n v1:Namespace:example Create\n v1:Service:example:example-dev-kawesome Create\n apps.kusionstack.io/v1alpha1:PodTransitionRule:example:example-dev-kawesome Create\n apps.kusionstack.io/v1alpha1:CollaSet:example:example-dev-kawesome Create\n cancel\n\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/0ed14211.1e09a987.js b/assets/js/0ed14211.1e09a987.js deleted file mode 100644 index b4aaf8d6723..00000000000 --- a/assets/js/0ed14211.1e09a987.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[53],{3905:(e,t,o)=>{o.d(t,{Zo:()=>u,kt:()=>h});var n=o(67294);function r(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function a(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function i(e){for(var t=1;t=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}var p=n.createContext({}),l=function(e){var t=n.useContext(p),o=t;return e&&(o="function"==typeof e?e(t):i(i({},t),e)),o},u=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var o=e.components,r=e.mdxType,a=e.originalType,p=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),c=l(o),h=r,d=c["".concat(p,".").concat(h)]||c[h]||m[h]||a;return o?n.createElement(d,i(i({ref:t},u),{},{components:o})):n.createElement(d,i({ref:t},u))}));function h(e,t){var o=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=o.length,i=new Array(a);i[0]=c;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var l=2;l{o.r(t),o.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var n=o(87462),r=(o(67294),o(3905));const a={},i="Configure Monitoring Behavior With Prometheus",s={unversionedId:"user-guides/observability/prometheus",id:"version-v0.10/user-guides/observability/prometheus",title:"Configure Monitoring Behavior With Prometheus",description:"This document provides the step-by-step instruction to set up monitoring for your application.",source:"@site/docs_versioned_docs/version-v0.10/5-user-guides/3-observability/1-prometheus.md",sourceDirName:"5-user-guides/3-observability",slug:"/user-guides/observability/prometheus",permalink:"/docs/v0.10/user-guides/observability/prometheus",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/5-user-guides/3-observability/1-prometheus.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{},sidebar:"kusion",previous:{title:"Schedule a Job",permalink:"/docs/v0.10/user-guides/working-with-k8s/job"},next:{title:"Deploy Application Securely and Efficiently via GitHub Actions",permalink:"/docs/v0.10/user-guides/github-actions/deploy-application-via-github-actions"}},p={},l=[{value:"Pre-requisite",id:"pre-requisite",level:2},{value:"Setting up your own Prometheus",id:"setting-up-your-own-prometheus",level:2},{value:"Installing Prometheus operator3.",id:"installing-prometheus-operator3",level:3},{value:"Make sure RBAC is properly set up",id:"make-sure-rbac-is-properly-set-up",level:3},{value:"Configure Prometheus instance via the operator",id:"configure-prometheus-instance-via-the-operator",level:3},{value:"Exposing the Prometheus portal (optional)",id:"exposing-the-prometheus-portal-optional",level:3},{value:"Setting up workspace configs",id:"setting-up-workspace-configs",level:2},{value:"Operator mode",id:"operator-mode",level:3},{value:"Monitor types",id:"monitor-types",level:3},{value:"Overriding with projectSelector",id:"overriding-with-projectselector",level:3},{value:"Updating the workspace config",id:"updating-the-workspace-config",level:2},{value:"Using kusion to deploy your application with monitoring requirements",id:"using-kusion-to-deploy-your-application-with-monitoring-requirements",level:2},{value:"References",id:"references",level:2}],u={toc:l};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"configure-monitoring-behavior-with-prometheus"},"Configure Monitoring Behavior With Prometheus"),(0,r.kt)("p",null,"This document provides the step-by-step instruction to set up monitoring for your application. "),(0,r.kt)("p",null,"As of today, Kusion supports the configuration of Prometheus scraping behaviors for the target application. In the future, we will add more cloud-provider-native solutions, such as AWS CloudWatch, Azure Monitor, etc."),(0,r.kt)("p",null,"The user guide below is composed of the following components:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Namespace"),(0,r.kt)("li",{parentName:"ul"},"Deployment"),(0,r.kt)("li",{parentName:"ul"},"Service"),(0,r.kt)("li",{parentName:"ul"},"ServiceMonitor")),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"This guide requires you to have a basic understanding of Kubernetes and Prometheus.\nIf you are not familiar with the relevant concepts, please refer to the links below:"),(0,r.kt)("ul",{parentName:"admonition"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/tutorials/kubernetes-basics/"},"Learn Kubernetes Basics")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://prometheus.io/docs/introduction/overview/"},"Prometheus Introduction")))),(0,r.kt)("h2",{id:"pre-requisite"},"Pre-requisite"),(0,r.kt)("p",null,"Please refer to the ",(0,r.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,r.kt)("p",null,"The example below also requires you to have ",(0,r.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#initializing"},"initialized the project")," using the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will generate a ",(0,r.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#kclmod"},(0,r.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the project directory."),(0,r.kt)("h2",{id:"setting-up-your-own-prometheus"},"Setting up your own Prometheus"),(0,r.kt)("p",null,"There a quite a few ways to set up Prometheus in your cluster:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Installing a Prometheus operator"),(0,r.kt)("li",{parentName:"ol"},"Installing a standalone Prometheus server"),(0,r.kt)("li",{parentName:"ol"},"Installing a Prometheus agent and connect to a remote Prometheus server")),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator/issues/1547#issuecomment-401092041"},"The advice from the Prometheus team")," is to use the ",(0,r.kt)("inlineCode",{parentName:"p"},"ServiceMonitor")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"PodMonitor")," CRs via the Prometheus operator to manage scrape configs going forward",(0,r.kt)("sup",null,"[2]"),"."),(0,r.kt)("p",null,"In either case, you only have to do this setup once per cluster. This doc will use a minikube cluster and Prometheus operator as an example."),(0,r.kt)("h3",{id:"installing-prometheus-operator3"},"Installing Prometheus operator",(0,r.kt)("sup",null,"[3]"),"."),(0,r.kt)("p",null,"To get the example in this user guide working, all you need is a running Prometheus operator. You can have that installed by running:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"LATEST=$(curl -s https://api.github.com/repos/prometheus-operator/prometheus-operator/releases/latest | jq -cr .tag_name)\ncurl -sL https://github.com/prometheus-operator/prometheus-operator/releases/download/${LATEST}/bundle.yaml | kubectl create -f -\n")),(0,r.kt)("p",null,"This will install all the necessary CRDs and the Prometheus operator itself in the default namespace. Wait a few minutes, you can confirm the operator is up by running: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kubectl wait --for=condition=Ready pods -l app.kubernetes.io/name=prometheus-operator -n default\n")),(0,r.kt)("h3",{id:"make-sure-rbac-is-properly-set-up"},"Make sure RBAC is properly set up"),(0,r.kt)("p",null,"If you have RBAC enabled on the cluster, the following must be created for Prometheus to work properly:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'apiVersion: v1\nkind: ServiceAccount\nmetadata:\n name: prometheus\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n name: prometheus\nrules:\n- apiGroups: [""]\n resources:\n - nodes\n - nodes/metrics\n - services\n - endpoints\n - pods\n verbs: ["get", "list", "watch"]\n- apiGroups: [""]\n resources:\n - configmaps\n verbs: ["get"]\n- apiGroups:\n - networking.k8s.io\n resources:\n - ingresses\n verbs: ["get", "list", "watch"]\n- nonResourceURLs: ["/metrics"]\n verbs: ["get"]\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n name: prometheus\nroleRef:\n apiGroup: rbac.authorization.k8s.io\n kind: ClusterRole\n name: prometheus\nsubjects:\n- kind: ServiceAccount\n name: prometheus\n namespace: default\n')),(0,r.kt)("h3",{id:"configure-prometheus-instance-via-the-operator"},"Configure Prometheus instance via the operator"),(0,r.kt)("p",null,"Once all of the above is set up, you can then configure the Prometheus instance via the operator:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"apiVersion: monitoring.coreos.com/v1\nkind: Prometheus\nmetadata:\n name: prometheus\nspec:\n serviceAccountName: prometheus\n serviceMonitorNamespaceSelector: {}\n serviceMonitorSelector: {}\n podMonitorNamespaceSelector: {}\n podMonitorSelector: {}\n resources:\n requests:\n memory: 400Mi\n")),(0,r.kt)("p",null,"This Prometheus instance above will be cluster-wide, picking up ALL the service monitors and pod monitors across ALL the namespaces.\nYou can adjust the requests and limits accordingly if you have a larger cluster."),(0,r.kt)("h3",{id:"exposing-the-prometheus-portal-optional"},"Exposing the Prometheus portal (optional)"),(0,r.kt)("p",null,"Once you have the managed Prometheus instance created via the Prometheus CR above, you should be able to see a service created called ",(0,r.kt)("inlineCode",{parentName:"p"},"prometheus-operated"),":"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"prometheus-operated",src:o(91512).Z,width:"631",height:"52"})),(0,r.kt)("p",null,"If you are also running on minikube, you can expose it onto your localhost via kubectl:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kubectl port-forward svc/prometheus-operated 9099:9090\n")),(0,r.kt)("p",null,"You should then be able to see the Prometheus portal via ",(0,r.kt)("inlineCode",{parentName:"p"},"localhost:9099")," in your browser:"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"prometheus-portal",src:o(35443).Z,width:"2878",height:"1096"})),(0,r.kt)("p",null,"If you are running a non-local cluster, you can try to expose it via another way, through an ingress controller for example."),(0,r.kt)("h2",{id:"setting-up-workspace-configs"},"Setting up workspace configs"),(0,r.kt)("p",null,"Since v0.10.0, we have introduced the concept of ",(0,r.kt)("a",{parentName:"p",href:"/docs/v0.10/concepts/workspace"},"workspaces"),", whose configurations represent the part of the application behaviors that platform teams are interested in standardizing, or the ones to eliminate from developer's mind to make their lives easier."),(0,r.kt)("p",null,"In the case of setting up Prometheus, there are a few things to set up on the workspace level:"),(0,r.kt)("h3",{id:"operator-mode"},"Operator mode"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," flag indicates to Kusion whether the Prometheus instance installed in the cluster runs as a Kubernetes operator or not. This determines the different kinds of resources Kusion manages."),(0,r.kt)("p",null,"To see more about different ways to run Prometheus in the Kubernetes cluster, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/prometheus.md#prometheus-installation"},"design documentation"),"."),(0,r.kt)("p",null,"Most cloud vendors provide an out-of-the-box monitoring solutions for workloads running in a managed-Kubernetes cluster (EKS, AKS, etc), such as AWS CloudWatch, Azure Monitor, etc. These solutions mostly involve installing an agent (CloudWatch Agent, OMS Agent, etc) in the cluster and collecting the metrics to a centralized monitoring server. In those cases, you don't need to set ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," to ",(0,r.kt)("inlineCode",{parentName:"p"},"True"),". It only needs to be set to ",(0,r.kt)("inlineCode",{parentName:"p"},"True")," when you have an installation of the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator"},"Prometheus operator")," running inside the Kubernetes cluster."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"For differences between ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator"},"Prometheus operator"),", ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/kube-prometheus"},"kube-prometheus")," and the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack"},"community kube-prometheus-stack helm chart"),", the details are documented ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator#prometheus-operator-vs-kube-prometheus-vs-community-helm-chart"},"here"),".")),(0,r.kt)("h3",{id:"monitor-types"},"Monitor types"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"monitorType")," flag indicates the kind of monitor Kusion will create. It only applies when ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," is set to ",(0,r.kt)("inlineCode",{parentName:"p"},"True"),". As of version 0.10.0, Kusion provides options to scrape metrics from either the application pods or its corresponding Kubernetes services. This determines the different kinds of resources Kusion manages when Prometheus runs as an operator in the target cluster."),(0,r.kt)("p",null,"A sample ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," with Prometheus settings:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"modules:\n ...\n monitoring:\n default:\n operatorMode: True\n monitorType: Service\n scheme: http\n interval: 30s\n timeout: 15s\n...\n")),(0,r.kt)("p",null,"To instruct Prometheus to scrape from pod targets instead:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"modules:\n ...\n monitoring:\n default:\n operatorMode: True\n monitorType: Pod\n scheme: http\n interval: 30s\n timeout: 15s\n...\n")),(0,r.kt)("p",null,"If the ",(0,r.kt)("inlineCode",{parentName:"p"},"prometheus")," section is missing from the ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),", Kusion defaults ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," to false."),(0,r.kt)("h3",{id:"overriding-with-projectselector"},"Overriding with projectSelector"),(0,r.kt)("p",null,"Workspace configurations contain a set of default setting group for all projects in the workspace, with means to override them by Projects using a ",(0,r.kt)("inlineCode",{parentName:"p"},"projectSelector")," keyword."),(0,r.kt)("p",null,"Projects with the name matching those in projectSelector will use the values defined in that override group instead of the default. If a key is not present in the override group, the default value will be used."),(0,r.kt)("p",null,"Take a look at the sample ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"modules:\n ...\n monitoring:\n default:\n operatorMode: True\n monitorType: Pod\n scheme: http\n interval: 30s\n timeout: 15s\n low_frequency:\n operatorMode: False\n interval: 2m\n projectSelector:\n - foobar\n high_frequency:\n monitorType: Service\n projectSelector:\n - helloworld\n...\n")),(0,r.kt)("p",null,"In the example above, a project with the name ",(0,r.kt)("inlineCode",{parentName:"p"},"helloworld")," will have the monitoring settings where ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," is set to ",(0,r.kt)("inlineCode",{parentName:"p"},"False"),", a 2 minute scraping interval, 15 seconds timeout (coming from default) and http scheme (coming from default)."),(0,r.kt)("p",null,"You cannot have the same project appear in two projectSelectors."),(0,r.kt)("p",null,"For a full reference of what can be configured in the workspace level, please see the ",(0,r.kt)("a",{parentName:"p",href:"../../reference/modules/workspace-configs/monitoring/prometheus"},"workspace reference"),"."),(0,r.kt)("h2",{id:"updating-the-workspace-config"},"Updating the workspace config"),(0,r.kt)("p",null,"Assuming you now have a ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," that looks like the following:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"modules:\n monitoring:\n default:\n operatorMode: True\n monitorType: Service\n scheme: http\n interval: 30s\n timeout: 15s\n...\n")),(0,r.kt)("p",null,"Update the workspace configuration by running the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kusion workspace update dev -f workspace.yaml\n")),(0,r.kt)("p",null,"Verify the workspace config is properly updated by running the command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kusion workspace show dev\n")),(0,r.kt)("h2",{id:"using-kusion-to-deploy-your-application-with-monitoring-requirements"},"Using kusion to deploy your application with monitoring requirements"),(0,r.kt)("p",null,"At this point we are set up for good! Any new applications you deploy via kusion will now automatically have the monitoring-related resources created, should you declare you want it via the ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," field in the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model."),(0,r.kt)("p",null,"The monitoring in an AppConfiguration is declared in the ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," field. See the example below for a full, deployable AppConfiguration."),(0,r.kt)("p",null,"Please note we are using a new image ",(0,r.kt)("inlineCode",{parentName:"p"},"quay.io/brancz/prometheus-example-app")," since the app itself need to expose metrics for Prometheus to scrape:"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"helloworld/dev/main.k"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.monitoring as m\nimport catalog.models.schema.v1.workload.network as n\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "monitoring-sample-app": c.Container {\n image: "quay.io/brancz/prometheus-example-app:v0.3.0"\n }\n }\n ports: [\n n.Port {\n port: 8080\n }\n ]\n }\n monitoring: m.Prometheus{\n path: "/metrics"\n }\n}\n')),(0,r.kt)("p",null,"The KCL file above represents an application with a service type workload, exposing the port 8080, and would like Prometheus to scrape the ",(0,r.kt)("inlineCode",{parentName:"p"},"/metrics")," endpoint every 2 minutes."),(0,r.kt)("p",null,"Running ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion apply")," would show that kusion will create a ",(0,r.kt)("inlineCode",{parentName:"p"},"Namespace"),", a ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployment"),", a ",(0,r.kt)("inlineCode",{parentName:"p"},"Service")," and a ",(0,r.kt)("inlineCode",{parentName:"p"},"ServiceMonitor"),":\n",(0,r.kt)("img",{alt:"kusion-apply-with-monitor",src:o(448).Z,width:"705",height:"224"})),(0,r.kt)("p",null,"Continue applying all resources:\n",(0,r.kt)("img",{alt:"kusion-apply-success",src:o(56816).Z,width:"1047",height:"564"})),(0,r.kt)("p",null,"If we want to, we can verify the service monitor has been created successfully:\n",(0,r.kt)("img",{alt:"service-monitor",src:o(58232).Z,width:"693",height:"463"})),(0,r.kt)("p",null,"In a few seconds, you should be able to see in the Prometheus portal that the service we just deployed has now been discovered and monitored by Prometheus:\n",(0,r.kt)("img",{alt:"prometheus-targets",src:o(87594).Z,width:"2880",height:"1636"})),(0,r.kt)("p",null,"You can run a few simply queries for the data that Prometheus scraped from your application:\n",(0,r.kt)("img",{alt:"prometheus-simple-query",src:o(87695).Z,width:"2880",height:"1634"})),(0,r.kt)("p",null,"For more info about PromQL, you can find them ",(0,r.kt)("a",{parentName:"p",href:"https://prometheus.io/docs/prometheus/latest/querying/basics/"},"here"),(0,r.kt)("sup",null,"[4]"),"."),(0,r.kt)("h2",{id:"references"},"References"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Prometheus: ",(0,r.kt)("a",{parentName:"li",href:"https://prometheus.io/docs/introduction/overview/"},"https://prometheus.io/docs/introduction/overview/")),(0,r.kt)("li",{parentName:"ol"},"Prometheus team advise: ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/prometheus-operator/prometheus-operator/issues/1547#issuecomment-446691500"},"https://github.com/prometheus-operator/prometheus-operator/issues/1547#issuecomment-446691500")),(0,r.kt)("li",{parentName:"ol"},"Prometheus operator getting started doc: ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md"},"https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md")),(0,r.kt)("li",{parentName:"ol"},"PromQL basics: ",(0,r.kt)("a",{parentName:"li",href:"https://prometheus.io/docs/prometheus/latest/querying/basics/"},"https://prometheus.io/docs/prometheus/latest/querying/basics/"))))}m.isMDXComponent=!0},56816:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/kusion-apply-success-52d04db670fd184959c3ea5c9e54f69d.png"},448:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/kusion-apply-with-monitor-d27cd1443e1a324d514983d52c055b15.png"},91512:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-operated-4cf8308703e4ec9d06a5078bbceb8d5d.png"},35443:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-portal-b60d8654c309e675fc04f1e74c5c127a.png"},87695:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-simple-query-60205589e762105ebc850e70d8ea7b56.png"},87594:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-targets-05964bad58af16f2e02c57cafa8565e7.png"},58232:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/service-monitor-2374625bfd1180a978a2be50ad4648ce.png"}}]); \ No newline at end of file diff --git a/assets/js/0ed14211.1f338424.js b/assets/js/0ed14211.1f338424.js new file mode 100644 index 00000000000..e0020662851 --- /dev/null +++ b/assets/js/0ed14211.1f338424.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[53],{3905:(e,t,o)=>{o.d(t,{Zo:()=>u,kt:()=>h});var n=o(67294);function r(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function a(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function i(e){for(var t=1;t=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}var p=n.createContext({}),l=function(e){var t=n.useContext(p),o=t;return e&&(o="function"==typeof e?e(t):i(i({},t),e)),o},u=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var o=e.components,r=e.mdxType,a=e.originalType,p=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),c=l(o),h=r,d=c["".concat(p,".").concat(h)]||c[h]||m[h]||a;return o?n.createElement(d,i(i({ref:t},u),{},{components:o})):n.createElement(d,i({ref:t},u))}));function h(e,t){var o=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=o.length,i=new Array(a);i[0]=c;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var l=2;l{o.r(t),o.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var n=o(87462),r=(o(67294),o(3905));const a={},i="Configure Monitoring Behavior With Prometheus",s={unversionedId:"user-guides/observability/prometheus",id:"version-v0.10/user-guides/observability/prometheus",title:"Configure Monitoring Behavior With Prometheus",description:"This document provides the step-by-step instruction to set up monitoring for your application.",source:"@site/docs_versioned_docs/version-v0.10/5-user-guides/3-observability/1-prometheus.md",sourceDirName:"5-user-guides/3-observability",slug:"/user-guides/observability/prometheus",permalink:"/docs/v0.10/user-guides/observability/prometheus",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/5-user-guides/3-observability/1-prometheus.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{},sidebar:"kusion",previous:{title:"Schedule a Job",permalink:"/docs/v0.10/user-guides/working-with-k8s/job"},next:{title:"Deploy Application Securely and Efficiently via GitHub Actions",permalink:"/docs/v0.10/user-guides/github-actions/deploy-application-via-github-actions"}},p={},l=[{value:"Pre-requisite",id:"pre-requisite",level:2},{value:"Setting up your own Prometheus",id:"setting-up-your-own-prometheus",level:2},{value:"Installing Prometheus operator3.",id:"installing-prometheus-operator3",level:3},{value:"Make sure RBAC is properly set up",id:"make-sure-rbac-is-properly-set-up",level:3},{value:"Configure Prometheus instance via the operator",id:"configure-prometheus-instance-via-the-operator",level:3},{value:"Exposing the Prometheus portal (optional)",id:"exposing-the-prometheus-portal-optional",level:3},{value:"Setting up workspace configs",id:"setting-up-workspace-configs",level:2},{value:"Operator mode",id:"operator-mode",level:3},{value:"Monitor types",id:"monitor-types",level:3},{value:"Overriding with projectSelector",id:"overriding-with-projectselector",level:3},{value:"Updating the workspace config",id:"updating-the-workspace-config",level:2},{value:"Using kusion to deploy your application with monitoring requirements",id:"using-kusion-to-deploy-your-application-with-monitoring-requirements",level:2},{value:"References",id:"references",level:2}],u={toc:l};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"configure-monitoring-behavior-with-prometheus"},"Configure Monitoring Behavior With Prometheus"),(0,r.kt)("p",null,"This document provides the step-by-step instruction to set up monitoring for your application. "),(0,r.kt)("p",null,"As of today, Kusion supports the configuration of Prometheus scraping behaviors for the target application. In the future, we will add more cloud-provider-native solutions, such as AWS CloudWatch, Azure Monitor, etc."),(0,r.kt)("p",null,"The user guide below is composed of the following components:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Namespace"),(0,r.kt)("li",{parentName:"ul"},"Deployment"),(0,r.kt)("li",{parentName:"ul"},"Service"),(0,r.kt)("li",{parentName:"ul"},"ServiceMonitor")),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"This guide requires you to have a basic understanding of Kubernetes and Prometheus.\nIf you are not familiar with the relevant concepts, please refer to the links below:"),(0,r.kt)("ul",{parentName:"admonition"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/tutorials/kubernetes-basics/"},"Learn Kubernetes Basics")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://prometheus.io/docs/introduction/overview/"},"Prometheus Introduction")))),(0,r.kt)("h2",{id:"pre-requisite"},"Pre-requisite"),(0,r.kt)("p",null,"Please refer to the ",(0,r.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,r.kt)("p",null,"The example below also requires you to have ",(0,r.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#initializing"},"initialized the project")," using the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will generate a ",(0,r.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#kclmod"},(0,r.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the project directory."),(0,r.kt)("h2",{id:"setting-up-your-own-prometheus"},"Setting up your own Prometheus"),(0,r.kt)("p",null,"There a quite a few ways to set up Prometheus in your cluster:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Installing a Prometheus operator"),(0,r.kt)("li",{parentName:"ol"},"Installing a standalone Prometheus server"),(0,r.kt)("li",{parentName:"ol"},"Installing a Prometheus agent and connect to a remote Prometheus server")),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator/issues/1547#issuecomment-401092041"},"The advice from the Prometheus team")," is to use the ",(0,r.kt)("inlineCode",{parentName:"p"},"ServiceMonitor")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"PodMonitor")," CRs via the Prometheus operator to manage scrape configs going forward",(0,r.kt)("sup",null,"[2]"),"."),(0,r.kt)("p",null,"In either case, you only have to do this setup once per cluster. This doc will use a minikube cluster and Prometheus operator as an example."),(0,r.kt)("h3",{id:"installing-prometheus-operator3"},"Installing Prometheus operator",(0,r.kt)("sup",null,"[3]"),"."),(0,r.kt)("p",null,"To get the example in this user guide working, all you need is a running Prometheus operator. You can have that installed by running:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"LATEST=$(curl -s https://api.github.com/repos/prometheus-operator/prometheus-operator/releases/latest | jq -cr .tag_name)\ncurl -sL https://github.com/prometheus-operator/prometheus-operator/releases/download/${LATEST}/bundle.yaml | kubectl create -f -\n")),(0,r.kt)("p",null,"This will install all the necessary CRDs and the Prometheus operator itself in the default namespace. Wait a few minutes, you can confirm the operator is up by running: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kubectl wait --for=condition=Ready pods -l app.kubernetes.io/name=prometheus-operator -n default\n")),(0,r.kt)("h3",{id:"make-sure-rbac-is-properly-set-up"},"Make sure RBAC is properly set up"),(0,r.kt)("p",null,"If you have RBAC enabled on the cluster, the following must be created for Prometheus to work properly:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'apiVersion: v1\nkind: ServiceAccount\nmetadata:\n name: prometheus\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n name: prometheus\nrules:\n- apiGroups: [""]\n resources:\n - nodes\n - nodes/metrics\n - services\n - endpoints\n - pods\n verbs: ["get", "list", "watch"]\n- apiGroups: [""]\n resources:\n - configmaps\n verbs: ["get"]\n- apiGroups:\n - networking.k8s.io\n resources:\n - ingresses\n verbs: ["get", "list", "watch"]\n- nonResourceURLs: ["/metrics"]\n verbs: ["get"]\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n name: prometheus\nroleRef:\n apiGroup: rbac.authorization.k8s.io\n kind: ClusterRole\n name: prometheus\nsubjects:\n- kind: ServiceAccount\n name: prometheus\n namespace: default\n')),(0,r.kt)("h3",{id:"configure-prometheus-instance-via-the-operator"},"Configure Prometheus instance via the operator"),(0,r.kt)("p",null,"Once all of the above is set up, you can then configure the Prometheus instance via the operator:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"apiVersion: monitoring.coreos.com/v1\nkind: Prometheus\nmetadata:\n name: prometheus\nspec:\n serviceAccountName: prometheus\n serviceMonitorNamespaceSelector: {}\n serviceMonitorSelector: {}\n podMonitorNamespaceSelector: {}\n podMonitorSelector: {}\n resources:\n requests:\n memory: 400Mi\n")),(0,r.kt)("p",null,"This Prometheus instance above will be cluster-wide, picking up ALL the service monitors and pod monitors across ALL the namespaces.\nYou can adjust the requests and limits accordingly if you have a larger cluster."),(0,r.kt)("h3",{id:"exposing-the-prometheus-portal-optional"},"Exposing the Prometheus portal (optional)"),(0,r.kt)("p",null,"Once you have the managed Prometheus instance created via the Prometheus CR above, you should be able to see a service created called ",(0,r.kt)("inlineCode",{parentName:"p"},"prometheus-operated"),":"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"prometheus-operated",src:o(91512).Z,width:"631",height:"52"})),(0,r.kt)("p",null,"If you are also running on minikube, you can expose it onto your localhost via kubectl:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kubectl port-forward svc/prometheus-operated 9099:9090\n")),(0,r.kt)("p",null,"You should then be able to see the Prometheus portal via ",(0,r.kt)("inlineCode",{parentName:"p"},"localhost:9099")," in your browser:"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"prometheus-portal",src:o(35443).Z,width:"2878",height:"1096"})),(0,r.kt)("p",null,"If you are running a non-local cluster, you can try to expose it via another way, through an ingress controller for example."),(0,r.kt)("h2",{id:"setting-up-workspace-configs"},"Setting up workspace configs"),(0,r.kt)("p",null,"Since v0.10.0, we have introduced the concept of ",(0,r.kt)("a",{parentName:"p",href:"/docs/v0.10/concepts/workspace"},"workspaces"),", whose configurations represent the part of the application behaviors that platform teams are interested in standardizing, or the ones to eliminate from developer's mind to make their lives easier."),(0,r.kt)("p",null,"In the case of setting up Prometheus, there are a few things to set up on the workspace level:"),(0,r.kt)("h3",{id:"operator-mode"},"Operator mode"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," flag indicates to Kusion whether the Prometheus instance installed in the cluster runs as a Kubernetes operator or not. This determines the different kinds of resources Kusion manages."),(0,r.kt)("p",null,"To see more about different ways to run Prometheus in the Kubernetes cluster, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/prometheus.md#prometheus-installation"},"design documentation"),"."),(0,r.kt)("p",null,"Most cloud vendors provide an out-of-the-box monitoring solutions for workloads running in a managed-Kubernetes cluster (EKS, AKS, etc), such as AWS CloudWatch, Azure Monitor, etc. These solutions mostly involve installing an agent (CloudWatch Agent, OMS Agent, etc) in the cluster and collecting the metrics to a centralized monitoring server. In those cases, you don't need to set ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," to ",(0,r.kt)("inlineCode",{parentName:"p"},"True"),". It only needs to be set to ",(0,r.kt)("inlineCode",{parentName:"p"},"True")," when you have an installation of the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator"},"Prometheus operator")," running inside the Kubernetes cluster."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"For differences between ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator"},"Prometheus operator"),", ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/kube-prometheus"},"kube-prometheus")," and the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack"},"community kube-prometheus-stack helm chart"),", the details are documented ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator#prometheus-operator-vs-kube-prometheus-vs-community-helm-chart"},"here"),".")),(0,r.kt)("h3",{id:"monitor-types"},"Monitor types"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"monitorType")," flag indicates the kind of monitor Kusion will create. It only applies when ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," is set to ",(0,r.kt)("inlineCode",{parentName:"p"},"True"),". As of version 0.10.0, Kusion provides options to scrape metrics from either the application pods or its corresponding Kubernetes services. This determines the different kinds of resources Kusion manages when Prometheus runs as an operator in the target cluster."),(0,r.kt)("p",null,"A sample ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," with Prometheus settings:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"modules:\n ...\n monitoring:\n default:\n operatorMode: True\n monitorType: Service\n scheme: http\n interval: 30s\n timeout: 15s\n...\n")),(0,r.kt)("p",null,"To instruct Prometheus to scrape from pod targets instead:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"modules:\n ...\n monitoring:\n default:\n operatorMode: True\n monitorType: Pod\n scheme: http\n interval: 30s\n timeout: 15s\n...\n")),(0,r.kt)("p",null,"If the ",(0,r.kt)("inlineCode",{parentName:"p"},"prometheus")," section is missing from the ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),", Kusion defaults ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," to false."),(0,r.kt)("h3",{id:"overriding-with-projectselector"},"Overriding with projectSelector"),(0,r.kt)("p",null,"Workspace configurations contain a set of default setting group for all projects in the workspace, with means to override them by Projects using a ",(0,r.kt)("inlineCode",{parentName:"p"},"projectSelector")," keyword."),(0,r.kt)("p",null,"Projects with the name matching those in projectSelector will use the values defined in that override group instead of the default. If a key is not present in the override group, the default value will be used."),(0,r.kt)("p",null,"Take a look at the sample ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"modules:\n ...\n monitoring:\n default:\n operatorMode: True\n monitorType: Pod\n scheme: http\n interval: 30s\n timeout: 15s\n low_frequency:\n operatorMode: False\n interval: 2m\n projectSelector:\n - foobar\n high_frequency:\n monitorType: Service\n projectSelector:\n - helloworld\n...\n")),(0,r.kt)("p",null,"In the example above, a project with the name ",(0,r.kt)("inlineCode",{parentName:"p"},"helloworld")," will have the monitoring settings where ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," is set to ",(0,r.kt)("inlineCode",{parentName:"p"},"False"),", a 2 minute scraping interval, 15 seconds timeout (coming from default) and http scheme (coming from default)."),(0,r.kt)("p",null,"You cannot have the same project appear in two projectSelectors."),(0,r.kt)("p",null,"For a full reference of what can be configured in the workspace level, please see the ",(0,r.kt)("a",{parentName:"p",href:"../../reference/modules/workspace-configs/monitoring/prometheus"},"workspace reference"),"."),(0,r.kt)("h2",{id:"updating-the-workspace-config"},"Updating the workspace config"),(0,r.kt)("p",null,"Assuming you now have a ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," that looks like the following:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"modules:\n monitoring:\n default:\n operatorMode: True\n monitorType: Service\n scheme: http\n interval: 30s\n timeout: 15s\n...\n")),(0,r.kt)("p",null,"Update the workspace configuration by running the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kusion workspace update dev -f workspace.yaml\n")),(0,r.kt)("p",null,"Verify the workspace config is properly updated by running the command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kusion workspace show dev\n")),(0,r.kt)("h2",{id:"using-kusion-to-deploy-your-application-with-monitoring-requirements"},"Using kusion to deploy your application with monitoring requirements"),(0,r.kt)("p",null,"At this point we are set up for good! Any new applications you deploy via kusion will now automatically have the monitoring-related resources created, should you declare you want it via the ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," field in the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model."),(0,r.kt)("p",null,"The monitoring in an AppConfiguration is declared in the ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," field. See the example below for a full, deployable AppConfiguration."),(0,r.kt)("p",null,"Please note we are using a new image ",(0,r.kt)("inlineCode",{parentName:"p"},"quay.io/brancz/prometheus-example-app")," since the app itself need to expose metrics for Prometheus to scrape:"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"helloworld/dev/main.k"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.monitoring as m\nimport catalog.models.schema.v1.workload.network as n\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "monitoring-sample-app": c.Container {\n image: "quay.io/brancz/prometheus-example-app:v0.3.0"\n }\n }\n ports: [\n n.Port {\n port: 8080\n }\n ]\n }\n monitoring: m.Prometheus{\n path: "/metrics"\n }\n}\n')),(0,r.kt)("p",null,"The KCL file above represents an application with a service type workload, exposing the port 8080, and would like Prometheus to scrape the ",(0,r.kt)("inlineCode",{parentName:"p"},"/metrics")," endpoint every 2 minutes."),(0,r.kt)("p",null,"Running ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion apply")," would show that kusion will create a ",(0,r.kt)("inlineCode",{parentName:"p"},"Namespace"),", a ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployment"),", a ",(0,r.kt)("inlineCode",{parentName:"p"},"Service")," and a ",(0,r.kt)("inlineCode",{parentName:"p"},"ServiceMonitor"),":\n",(0,r.kt)("img",{alt:"kusion-apply-with-monitor",src:o(448).Z,width:"705",height:"224"})),(0,r.kt)("p",null,"Continue applying all resources:\n",(0,r.kt)("img",{alt:"kusion-apply-success",src:o(56816).Z,width:"1047",height:"564"})),(0,r.kt)("p",null,"If we want to, we can verify the service monitor has been created successfully:\n",(0,r.kt)("img",{alt:"service-monitor",src:o(58232).Z,width:"693",height:"463"})),(0,r.kt)("p",null,"In a few seconds, you should be able to see in the Prometheus portal that the service we just deployed has now been discovered and monitored by Prometheus:\n",(0,r.kt)("img",{alt:"prometheus-targets",src:o(87594).Z,width:"2880",height:"1636"})),(0,r.kt)("p",null,"You can run a few simply queries for the data that Prometheus scraped from your application:\n",(0,r.kt)("img",{alt:"prometheus-simple-query",src:o(87695).Z,width:"2880",height:"1634"})),(0,r.kt)("p",null,"For more info about PromQL, you can find them ",(0,r.kt)("a",{parentName:"p",href:"https://prometheus.io/docs/prometheus/latest/querying/basics/"},"here"),(0,r.kt)("sup",null,"[4]"),"."),(0,r.kt)("h2",{id:"references"},"References"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Prometheus: ",(0,r.kt)("a",{parentName:"li",href:"https://prometheus.io/docs/introduction/overview/"},"https://prometheus.io/docs/introduction/overview/")),(0,r.kt)("li",{parentName:"ol"},"Prometheus team advise: ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/prometheus-operator/prometheus-operator/issues/1547#issuecomment-446691500"},"https://github.com/prometheus-operator/prometheus-operator/issues/1547#issuecomment-446691500")),(0,r.kt)("li",{parentName:"ol"},"Prometheus operator getting started doc: ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md"},"https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md")),(0,r.kt)("li",{parentName:"ol"},"PromQL basics: ",(0,r.kt)("a",{parentName:"li",href:"https://prometheus.io/docs/prometheus/latest/querying/basics/"},"https://prometheus.io/docs/prometheus/latest/querying/basics/"))))}m.isMDXComponent=!0},56816:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/kusion-apply-success-52d04db670fd184959c3ea5c9e54f69d.png"},448:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/kusion-apply-with-monitor-d27cd1443e1a324d514983d52c055b15.png"},91512:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-operated-4cf8308703e4ec9d06a5078bbceb8d5d.png"},35443:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-portal-b60d8654c309e675fc04f1e74c5c127a.png"},87695:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-simple-query-60205589e762105ebc850e70d8ea7b56.png"},87594:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-targets-05964bad58af16f2e02c57cafa8565e7.png"},58232:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/service-monitor-2374625bfd1180a978a2be50ad4648ce.png"}}]); \ No newline at end of file diff --git a/assets/js/0feba5eb.2e875425.js b/assets/js/0feba5eb.2e875425.js new file mode 100644 index 00000000000..59931ac0cca --- /dev/null +++ b/assets/js/0feba5eb.2e875425.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[927],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>h});var n=a(67294);function i(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function r(e){for(var t=1;t=0||(i[a]=e[a]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(i[a]=e[a])}return i}var c=n.createContext({}),l=function(e){var t=n.useContext(c),a=t;return e&&(a="function"==typeof e?e(t):r(r({},t),e)),a},p=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,i=e.mdxType,o=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=l(a),h=i,m=d["".concat(c,".").concat(h)]||d[h]||u[h]||o;return a?n.createElement(m,r(r({ref:t},p),{},{components:a})):n.createElement(m,r({ref:t},p))}));function h(e,t){var a=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=a.length,r=new Array(o);r[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:i,r[1]=s;for(var l=2;l{a.r(t),a.d(t,{assets:()=>c,contentTitle:()=>r,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>l});var n=a(87462),i=(a(67294),a(3905));const o={sidebar_position:1},r="Deploy Application Securely and Efficiently via GitHub Actions",s={unversionedId:"guides/github-actions/deploy-application-securely-and-efficiently-via-github-actions",id:"version-v0.9/guides/github-actions/deploy-application-securely-and-efficiently-via-github-actions",title:"Deploy Application Securely and Efficiently via GitHub Actions",description:"This document provides the instruction to deploy your application securely and efficiently via GitHub Actions.",source:"@site/docs_versioned_docs/version-v0.9/guides/github-actions/deploy-application-securely-and-efficiently-via-github-actions.md",sourceDirName:"guides/github-actions",slug:"/guides/github-actions/deploy-application-securely-and-efficiently-via-github-actions",permalink:"/docs/v0.9/guides/github-actions/deploy-application-securely-and-efficiently-via-github-actions",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/guides/github-actions/deploy-application-securely-and-efficiently-via-github-actions.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"kusion",previous:{title:"Configure Monitoring Behavior With Prometheus",permalink:"/docs/v0.9/guides/observability/prometheus"},next:{title:"Command Line Tools",permalink:"/docs/v0.9/reference/cli/"}},c={},l=[{value:"GitHub Actions Workflow",id:"github-actions-workflow",level:2},{value:"Get Changed Project and Stack",id:"get-changed-project-and-stack",level:2},{value:"Check Project and Stack Structure",id:"check-project-and-stack-structure",level:2},{value:"Test Code Correctness",id:"test-code-correctness",level:2},{value:"Preview Changed Stack",id:"preview-changed-stack",level:2},{value:"Apply Changed Stack",id:"apply-changed-stack",level:2},{value:"Summary",id:"summary",level:2}],p={toc:l};function u(e){let{components:t,...o}=e;return(0,i.kt)("wrapper",(0,n.Z)({},p,o,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"deploy-application-securely-and-efficiently-via-github-actions"},"Deploy Application Securely and Efficiently via GitHub Actions"),(0,i.kt)("p",null,"This document provides the instruction to deploy your application securely and efficiently via GitHub Actions."),(0,i.kt)("p",null,"Using git repository is a very reliable and common way to manage code, and the same goes for Kusion-managed configuration code. ",(0,i.kt)("a",{parentName:"p",href:"https://docs.github.com/en/actions"},"GitHub Actions")," is a CI/CD platform. By customizing ",(0,i.kt)("a",{parentName:"p",href:"https://docs.github.com/en/actions/using-workflows/about-workflows"},"GitHub Actions workflow"),", the pipeline such as building, testing, and deploying will be executed automatically."),(0,i.kt)("p",null,"Kusion has a commendable integration with Github Actions. You can use Github Actions to test configuration correctness, preview change, and deploy application. This tutorial demonstrates how to deploy and operate an application through GitHub Actions."),(0,i.kt)("h2",{id:"github-actions-workflow"},"GitHub Actions Workflow"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig"},"KusionStack/konfig")," is the official example repository, and provides the GitHub Actions workflow ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/blob/main/.github/workflows/main.yml"},"main.yml"),". The main.yml is triggered by a push or a pull request on the main branch, and includes multiple jobs, which ensures the reliability of configuration code, and deploys the changed application."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"workflow",src:a(74559).Z,width:"2594",height:"1364"})),(0,i.kt)("p",null,"The workflow to deploy an application is shown above, which includes the following jobs:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Get changed project and stack"),(0,i.kt)("li",{parentName:"ul"},"Check project and stack structure"),(0,i.kt)("li",{parentName:"ul"},"Test code correctness"),(0,i.kt)("li",{parentName:"ul"},"Preview changed stack"),(0,i.kt)("li",{parentName:"ul"},"Apply changed stack")),(0,i.kt)("p",null,"These jobs ensure the security and efficiency of the application deployment. Next, this tutorial will introduce the usage and function of these jobs. To show how they work more visually, ",(0,i.kt)("em",{parentName:"p"},(0,i.kt)("a",{parentName:"em",href:"https://github.com/KusionStack/konfig/actions/runs/6325390734"},"updating port configuration of multi-stack"),' (referred to "the example" in the below)')," is given as an example."),(0,i.kt)("h2",{id:"get-changed-project-and-stack"},"Get Changed Project and Stack"),(0,i.kt)("p",null,"As Kusion organizes code by ",(0,i.kt)("strong",{parentName:"p"},"project")," and ",(0,i.kt)("strong",{parentName:"p"},"stack"),", to deploy the affected applications, analyze the changed project and stack is the first step."),(0,i.kt)("p",null,"The jobs, ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/blob/main/.github/workflows/main.yml#L10"},"get-changed-project-stack")," perfectly accomplish the analysis. The main steps are as follows:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Obtain the list of changed files through ",(0,i.kt)("inlineCode",{parentName:"li"},"git diff"),";"),(0,i.kt)("li",{parentName:"ul"},"Based on the changed file list, obtain the changed projects and stacks which are indicated by ",(0,i.kt)("inlineCode",{parentName:"li"},"project.yaml")," and ",(0,i.kt)("inlineCode",{parentName:"li"},"stack.yaml")," respectively.")),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/actions/runs/6325320773/job/17176584497"},"example")," changes the file ",(0,i.kt)("inlineCode",{parentName:"p"},"example/multi-stack/base/base.k"),", where the affected project is ",(0,i.kt)("inlineCode",{parentName:"p"},"example/multi-stack"),", and the stack is ",(0,i.kt)("inlineCode",{parentName:"p"},"example/multi-stack/dev")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"example/multi-stack/prod"),". Delightfully, the result, which is shown below, meets our expectation."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"changed-project-stack",src:a(465).Z,width:"1758",height:"1038"})),(0,i.kt)("h2",{id:"check-project-and-stack-structure"},"Check Project and Stack Structure"),(0,i.kt)("p",null,"The job ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/blob/main/.github/workflows/main.yml#L39"},"check-structure")," guarantees the structure legality of the changed project and stack, so that Kusion CLI tools can be used correctly. The check items are as follows:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"The field ",(0,i.kt)("inlineCode",{parentName:"li"},"name")," is required in project.yaml;"),(0,i.kt)("li",{parentName:"ul"},"The field ",(0,i.kt)("inlineCode",{parentName:"li"},"name")," is required in stack.yaml.")),(0,i.kt)("p",null,"The success of structure-check means the correctness of structure. A ",(0,i.kt)("a",{parentName:"p",href:"https://docs.pytest.org/en/7.3.x/"},"pytest")," report ",(0,i.kt)("inlineCode",{parentName:"p"},"check-structure-report")," is also generated, and you can get it from ",(0,i.kt)("a",{parentName:"p",href:"https://docs.github.com/en/actions/managing-workflow-runs/downloading-workflow-artifacts"},"GithHub Actions Artifacts")," ."),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/actions/runs/6325320773/job/17176592318"},"example")," passes the directory structure verification. It is clear from the report that the changed project and stack have get checked, and the result is passed."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"check-structure",src:a(71020).Z,width:"1452",height:"482"})),(0,i.kt)("h2",{id:"test-code-correctness"},"Test Code Correctness"),(0,i.kt)("p",null,"Besides a rightful structure, the code must have correct syntax and semantics, and the job ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/blob/main/.github/workflows/main.yml#L65"},"test-correctness")," ensures the correctness. ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion compile")," get executed on the changed stacks. If succeeded, there are no syntax errors; or the configuration code is illegal, and the following application deployment will fail."),(0,i.kt)("p",null,"The report whose name is ",(0,i.kt)("inlineCode",{parentName:"p"},"test-correctness-report")," get generated."),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/actions/runs/6325320773/job/17176592034"},"example")," passes the code correctness test. The report shows that the tested stack is ",(0,i.kt)("inlineCode",{parentName:"p"},"example/multi-stack/dev")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"example/multi-stack/prod"),", and the result is passed."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"test-correctness",src:a(48848).Z,width:"1626",height:"404"})),(0,i.kt)("h2",{id:"preview-changed-stack"},"Preview Changed Stack"),(0,i.kt)("p",null,"After passing the above jobs, security of the configuration change is guaranteed, and it's time to deploy your application. Before applying the change to the real infrastructure, it's necessary to get the expected result of the application deployment. The job ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/blob/main/.github/workflows/main.yml#L90"},"preview")," calls ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion preview")," to get the expected change result, the result is uploaded to the artifact ",(0,i.kt)("inlineCode",{parentName:"p"},"preview-report"),". If the result meets your requirement, you can go to the next job and deploy the application."),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/actions/runs/6325320773/job/17176612053"},"example")," changes stack ",(0,i.kt)("inlineCode",{parentName:"p"},"example/multi-stack/dev")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"example/multi-stack/prod"),". The following picture shows the preview result of ",(0,i.kt)("inlineCode",{parentName:"p"},"example/multi-stack/prod"),", where the result is to create a Kubernetes Namespace, Service and Deployment if call ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion apply"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"preview",src:a(72915).Z,width:"1424",height:"264"})),(0,i.kt)("h2",{id:"apply-changed-stack"},"Apply Changed Stack"),(0,i.kt)("p",null,"Finally, the last step is arrived, i.e. deploy application. The job ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/blob/main/.github/workflows/main.yml#L121"},"apply")," calls ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion apply")," to apply the configuration change to the real infrastructure. If the job succeeded, the result will be uploaded to the artifact ",(0,i.kt)("inlineCode",{parentName:"p"},"apply-report"),"."),(0,i.kt)("p",null,"For the stack ",(0,i.kt)("inlineCode",{parentName:"p"},"example/multi-stack/prod")," in the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/actions/runs/6325320773/job/17176645252"},"example"),", a Kubernetes Namespace, Service and Deployment get created, which is consistent with the preview result."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"apply",src:a(32965).Z,width:"1456",height:"554"})),(0,i.kt)("h2",{id:"summary"},"Summary"),(0,i.kt)("p",null,"This tutorial demonstrates how Kusion integrates with GitHub Actions to deploy an application. By structure check, correctness test, preview and apply, Kusion with GitHub Actions enables you deploy application efficiently and securely."))}u.isMDXComponent=!0},32965:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/apply-3197adde2cbda84d3e032918679c17cb.png"},465:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/changed-project-stack-0055bea978f129b99b6e74c5b7c4ab88.png"},71020:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/check-structure-2e3226c0efbdbf41b4d7ae70bd16df28.png"},72915:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/preview-4f2aae42391f5decddfcac6107d53a25.png"},48848:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/test-correctness-a6846c2c32c4129b816b6463927325b8.png"},74559:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/workflow-052aa326816199187357363891109493.png"}}]); \ No newline at end of file diff --git a/assets/js/0feba5eb.34198b40.js b/assets/js/0feba5eb.34198b40.js deleted file mode 100644 index b8281df8dcd..00000000000 --- a/assets/js/0feba5eb.34198b40.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[927],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>d});var n=a(67294);function i(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function r(e){for(var t=1;t=0||(i[a]=e[a]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(i[a]=e[a])}return i}var c=n.createContext({}),l=function(e){var t=n.useContext(c),a=t;return e&&(a="function"==typeof e?e(t):r(r({},t),e)),a},p=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},h=n.forwardRef((function(e,t){var a=e.components,i=e.mdxType,o=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),h=l(a),d=i,m=h["".concat(c,".").concat(d)]||h[d]||u[d]||o;return a?n.createElement(m,r(r({ref:t},p),{},{components:a})):n.createElement(m,r({ref:t},p))}));function d(e,t){var a=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=a.length,r=new Array(o);r[0]=h;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:i,r[1]=s;for(var l=2;l{a.r(t),a.d(t,{assets:()=>c,contentTitle:()=>r,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>l});var n=a(87462),i=(a(67294),a(3905));const o={sidebar_position:1},r="Deploy Application Securely and Efficiently via GitHub Actions",s={unversionedId:"guides/github-actions/deploy-application-securely-and-efficiently-via-github-actions",id:"version-v0.9/guides/github-actions/deploy-application-securely-and-efficiently-via-github-actions",title:"Deploy Application Securely and Efficiently via GitHub Actions",description:"This document provides the instruction to deploy your application securely and efficiently via GitHub Actions.",source:"@site/docs_versioned_docs/version-v0.9/guides/github-actions/deploy-application-securely-and-efficiently-via-github-actions.md",sourceDirName:"guides/github-actions",slug:"/guides/github-actions/deploy-application-securely-and-efficiently-via-github-actions",permalink:"/docs/v0.9/guides/github-actions/deploy-application-securely-and-efficiently-via-github-actions",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/guides/github-actions/deploy-application-securely-and-efficiently-via-github-actions.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"kusion",previous:{title:"Configure Monitoring Behavior With Prometheus",permalink:"/docs/v0.9/guides/observability/prometheus"},next:{title:"Command Line Tools",permalink:"/docs/v0.9/reference/cli/"}},c={},l=[{value:"GitHub Actions Workflow",id:"github-actions-workflow",level:2},{value:"Get Changed Project and Stack",id:"get-changed-project-and-stack",level:2},{value:"Check Project and Stack Structure",id:"check-project-and-stack-structure",level:2},{value:"Test Code Correctness",id:"test-code-correctness",level:2},{value:"Preview Changed Stack",id:"preview-changed-stack",level:2},{value:"Apply Changed Stack",id:"apply-changed-stack",level:2},{value:"Summary",id:"summary",level:2}],p={toc:l};function u(e){let{components:t,...o}=e;return(0,i.kt)("wrapper",(0,n.Z)({},p,o,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"deploy-application-securely-and-efficiently-via-github-actions"},"Deploy Application Securely and Efficiently via GitHub Actions"),(0,i.kt)("p",null,"This document provides the instruction to deploy your application securely and efficiently via GitHub Actions."),(0,i.kt)("p",null,"Using git repository is a very reliable and common way to manage code, and the same goes for Kusion-managed configuration code. ",(0,i.kt)("a",{parentName:"p",href:"https://docs.github.com/en/actions"},"GitHub Actions")," is a CI/CD platform. By customizing ",(0,i.kt)("a",{parentName:"p",href:"https://docs.github.com/en/actions/using-workflows/about-workflows"},"GitHub Actions workflow"),", the pipeline such as building, testing, and deploying will be executed automatically."),(0,i.kt)("p",null,"Kusion has a commendable integration with Github Actions. You can use Github Actions to test configuration correctness, preview change, and deploy application. This tutorial demonstrates how to deploy and operate an application through GitHub Actions."),(0,i.kt)("h2",{id:"github-actions-workflow"},"GitHub Actions Workflow"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig"},"KusionStack/konfig")," is the official example repository, and provides the GitHub Actions workflow ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/blob/main/.github/workflows/main.yml"},"main.yml"),". The main.yml is triggered by a push or a pull request on the main branch, and includes multiple jobs, which ensures the reliability of configuration code, and deploys the changed application."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"workflow",src:a(74559).Z,width:"2594",height:"1364"})),(0,i.kt)("p",null,"The workflow to deploy an application is shown above, which includes the following jobs:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Get changed project and stack"),(0,i.kt)("li",{parentName:"ul"},"Check project and stack structure"),(0,i.kt)("li",{parentName:"ul"},"Test code correctness"),(0,i.kt)("li",{parentName:"ul"},"Preview changed stack"),(0,i.kt)("li",{parentName:"ul"},"Apply changed stack")),(0,i.kt)("p",null,"These jobs ensure the security and efficiency of the application deployment. Next, this tutorial will introduce the usage and function of these jobs. To show how they work more visually, ",(0,i.kt)("em",{parentName:"p"},(0,i.kt)("a",{parentName:"em",href:"https://github.com/KusionStack/konfig/actions/runs/6325390734"},"updating port configuration of multi-stack"),' (referred to "the example" in the below)')," is given as an example."),(0,i.kt)("h2",{id:"get-changed-project-and-stack"},"Get Changed Project and Stack"),(0,i.kt)("p",null,"As Kusion organizes code by ",(0,i.kt)("strong",{parentName:"p"},"project")," and ",(0,i.kt)("strong",{parentName:"p"},"stack"),", to deploy the affected applications, analyze the changed project and stack is the first step."),(0,i.kt)("p",null,"The jobs, ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/blob/main/.github/workflows/main.yml#L10"},"get-changed-project-stack")," perfectly accomplish the analysis. The main steps are as follows:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Obtain the list of changed files through ",(0,i.kt)("inlineCode",{parentName:"li"},"git diff"),";"),(0,i.kt)("li",{parentName:"ul"},"Based on the changed file list, obtain the changed projects and stacks which are indicated by ",(0,i.kt)("inlineCode",{parentName:"li"},"project.yaml")," and ",(0,i.kt)("inlineCode",{parentName:"li"},"stack.yaml")," respectively.")),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/actions/runs/6325320773/job/17176584497"},"example")," changes the file ",(0,i.kt)("inlineCode",{parentName:"p"},"example/multi-stack/base/base.k"),", where the affected project is ",(0,i.kt)("inlineCode",{parentName:"p"},"example/multi-stack"),", and the stack is ",(0,i.kt)("inlineCode",{parentName:"p"},"example/multi-stack/dev")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"example/multi-stack/prod"),". Delightfully, the result, which is shown below, meets our expectation."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"changed-project-stack",src:a(465).Z,width:"1758",height:"1038"})),(0,i.kt)("h2",{id:"check-project-and-stack-structure"},"Check Project and Stack Structure"),(0,i.kt)("p",null,"The job ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/blob/main/.github/workflows/main.yml#L39"},"check-structure")," guarantees the structure legality of the changed project and stack, so that Kusion CLI tools can be used correctly. The check items are as follows:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"The field ",(0,i.kt)("inlineCode",{parentName:"li"},"name")," is required in project.yaml;"),(0,i.kt)("li",{parentName:"ul"},"The field ",(0,i.kt)("inlineCode",{parentName:"li"},"name")," is required in stack.yaml.")),(0,i.kt)("p",null,"The success of structure-check means the correctness of structure. A ",(0,i.kt)("a",{parentName:"p",href:"https://docs.pytest.org/en/7.3.x/"},"pytest")," report ",(0,i.kt)("inlineCode",{parentName:"p"},"check-structure-report")," is also generated, and you can get it from ",(0,i.kt)("a",{parentName:"p",href:"https://docs.github.com/en/actions/managing-workflow-runs/downloading-workflow-artifacts"},"GithHub Actions Artifacts")," ."),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/actions/runs/6325320773/job/17176592318"},"example")," passes the directory structure verification. It is clear from the report that the changed project and stack have get checked, and the result is passed."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"check-structure",src:a(71020).Z,width:"1452",height:"482"})),(0,i.kt)("h2",{id:"test-code-correctness"},"Test Code Correctness"),(0,i.kt)("p",null,"Besides a rightful structure, the code must have correct syntax and semantics, and the job ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/blob/main/.github/workflows/main.yml#L65"},"test-correctness")," ensures the correctness. ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion compile")," get executed on the changed stacks. If succeeded, there are no syntax errors; or the configuration code is illegal, and the following application deployment will fail."),(0,i.kt)("p",null,"The report whose name is ",(0,i.kt)("inlineCode",{parentName:"p"},"test-correctness-report")," get generated."),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/actions/runs/6325320773/job/17176592034"},"example")," passes the code correctness test. The report shows that the tested stack is ",(0,i.kt)("inlineCode",{parentName:"p"},"example/multi-stack/dev")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"example/multi-stack/prod"),", and the result is passed."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"test-correctness",src:a(48848).Z,width:"1626",height:"404"})),(0,i.kt)("h2",{id:"preview-changed-stack"},"Preview Changed Stack"),(0,i.kt)("p",null,"After passing the above jobs, security of the configuration change is guaranteed, and it's time to deploy your application. Before applying the change to the real infrastructure, it's necessary to get the expected result of the application deployment. The job ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/blob/main/.github/workflows/main.yml#L90"},"preview")," calls ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion preview")," to get the expected change result, the result is uploaded to the artifact ",(0,i.kt)("inlineCode",{parentName:"p"},"preview-report"),". If the result meets your requirement, you can go to the next job and deploy the application."),(0,i.kt)("p",null,"The ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/actions/runs/6325320773/job/17176612053"},"example")," changes stack ",(0,i.kt)("inlineCode",{parentName:"p"},"example/multi-stack/dev")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"example/multi-stack/prod"),". The following picture shows the preview result of ",(0,i.kt)("inlineCode",{parentName:"p"},"example/multi-stack/prod"),", where the result is to create a Kubernetes Namespace, Service and Deployment if call ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion apply"),"."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"preview",src:a(72915).Z,width:"1424",height:"264"})),(0,i.kt)("h2",{id:"apply-changed-stack"},"Apply Changed Stack"),(0,i.kt)("p",null,"Finally, the last step is arrived, i.e. deploy application. The job ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/blob/main/.github/workflows/main.yml#L121"},"apply")," calls ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion apply")," to apply the configuration change to the real infrastructure. If the job succeeded, the result will be uploaded to the artifact ",(0,i.kt)("inlineCode",{parentName:"p"},"apply-report"),"."),(0,i.kt)("p",null,"For the stack ",(0,i.kt)("inlineCode",{parentName:"p"},"example/multi-stack/prod")," in the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/actions/runs/6325320773/job/17176645252"},"example"),", a Kubernetes Namespace, Service and Deployment get created, which is consistent with the preview result."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"apply",src:a(32965).Z,width:"1456",height:"554"})),(0,i.kt)("h2",{id:"summary"},"Summary"),(0,i.kt)("p",null,"This tutorial demonstrates how Kusion integrates with GitHub Actions to deploy an application. By structure check, correctness test, preview and apply, Kusion with GitHub Actions enables you deploy application efficiently and securely."))}u.isMDXComponent=!0},32965:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/apply-3197adde2cbda84d3e032918679c17cb.png"},465:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/changed-project-stack-0055bea978f129b99b6e74c5b7c4ab88.png"},71020:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/check-structure-2e3226c0efbdbf41b4d7ae70bd16df28.png"},72915:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/preview-4f2aae42391f5decddfcac6107d53a25.png"},48848:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/test-correctness-a6846c2c32c4129b816b6463927325b8.png"},74559:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/workflow-052aa326816199187357363891109493.png"}}]); \ No newline at end of file diff --git a/assets/js/10669232.7d91494e.js b/assets/js/10669232.7d91494e.js deleted file mode 100644 index 92f65c7702a..00000000000 --- a/assets/js/10669232.7d91494e.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2301],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>c});var o=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function i(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=o.createContext({}),d=function(e){var n=o.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},p=function(e){var n=d(e.components);return o.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},m=o.forwardRef((function(e,n){var t=e.components,a=e.mdxType,r=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),m=d(t),c=a,h=m["".concat(s,".").concat(c)]||m[c]||u[c]||r;return t?o.createElement(h,i(i({ref:n},p),{},{components:t})):o.createElement(h,i({ref:n},p))}));function c(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var r=t.length,i=new Array(r);i[0]=m;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var d=2;d{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>i,default:()=>u,frontMatter:()=>r,metadata:()=>l,toc:()=>d});var o=t(87462),a=(t(67294),t(3905));const r={},i="Platform Engineer Develop Guide",l={unversionedId:"concepts/kusion-module/develop-guide",id:"concepts/kusion-module/develop-guide",title:"Platform Engineer Develop Guide",description:"Prerequisites",source:"@site/docs/kusion/3-concepts/3-kusion-module/2-develop-guide.md",sourceDirName:"3-concepts/3-kusion-module",slug:"/concepts/kusion-module/develop-guide",permalink:"/docs/next/concepts/kusion-module/develop-guide",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/3-concepts/3-kusion-module/2-develop-guide.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{},sidebar:"kusion",previous:{title:"Overview",permalink:"/docs/next/concepts/kusion-module/overview"},next:{title:"Application Developer User Guide",permalink:"/docs/next/concepts/kusion-module/app-dev-guide"}},s={},d=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Workflow",id:"workflow",level:2},{value:"Set up a developing environment",id:"set-up-a-developing-environment",level:2},{value:"Developing",id:"developing",level:2},{value:"Publish",id:"publish",level:2},{value:"Initialize the workspace",id:"initialize-the-workspace",level:2}],p={toc:d};function u(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,o.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"platform-engineer-develop-guide"},"Platform Engineer Develop Guide"),(0,a.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,a.kt)("p",null,"To follow this guide, you will need:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Go 1.22 or higher installed and configured"),(0,a.kt)("li",{parentName:"ul"},"Kusion v0.11.0 or higher installed locally")),(0,a.kt)("h2",{id:"workflow"},"Workflow"),(0,a.kt)("p",null,"As a platform engineer, the workflow of developing a Kusion module looks like this:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Communicate with app developers and identify the fields that should exposed to them in the dev-orient schema"),(0,a.kt)("li",{parentName:"ol"},"Identify module input parameters that should be configured by platform engineers in the ",(0,a.kt)("a",{parentName:"li",href:"../workspace"},"workspace")),(0,a.kt)("li",{parentName:"ol"},"Define the app dev-orient schema"),(0,a.kt)("li",{parentName:"ol"},"Develop the module by implementing gRPC interfaces")),(0,a.kt)("p",null,"The first two steps primarily involve communication with the application development team, and the specific details are not included in this tutorial. This tutorial begins with the subsequent two steps."),(0,a.kt)("h2",{id:"set-up-a-developing-environment"},"Set up a developing environment"),(0,a.kt)("p",null,"Developing a Kusion module includes defining a KCL schema and developing a module binary in golang. We will provide a scaffold repository and a new command ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion mod init")," to help developers set up the developing environment easily."),(0,a.kt)("p",null,"After executing the command"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"kusion mod init \n")),(0,a.kt)("p",null,"Kusion will download a ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion-module-scaffolding"},"scaffold repository")," and rename this project with your module name. The scaffold contains code templates and all files needed for developing a Kusion module."),(0,a.kt)("h2",{id:"developing"},"Developing"),(0,a.kt)("p",null,"The scaffold repository directory structure is shown below:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"$ tree kawesome/\n.\n\u251c\u2500\u2500 example\n\u2502\xa0\xa0 \u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 example_workspace.yaml\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2502\xa0\xa0 \u2514\u2500\u2500 project.yaml\n\u251c\u2500\u2500 kawesome.k\n\u251c\u2500\u2500 kcl.mod\n\u2514\u2500\u2500 src\n \u251c\u2500\u2500 Makefile\n \u251c\u2500\u2500 go.mod\n \u251c\u2500\u2500 go.sum\n \u251c\u2500\u2500 kawesome_generator.go\n \u2514\u2500\u2500 kawesome_generator_test.go\n")),(0,a.kt)("p",null,"When developing a Kusion module with the scaffold repository, you could follow the steps below:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("strong",{parentName:"li"},"Define module name.")," Rename ",(0,a.kt)("inlineCode",{parentName:"li"},"go.mod")," module and related files to your Kusion module name. We assume the module named is ",(0,a.kt)("inlineCode",{parentName:"li"},"kawesome")," in this guide."),(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("strong",{parentName:"li"},"Define the dev-orient schemas"),". They would be initialized by app developers. In this scaffold repository, we've defined a schema named Kawesome in ",(0,a.kt)("inlineCode",{parentName:"li"},"kawesome.k")," that consists of two resources ",(0,a.kt)("inlineCode",{parentName:"li"},"Service")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"RandomPassword")," and they will be generated into a Kubernetes Service and a Terraform RandomPassword later.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'schema Kawesome: \n""" Kawesome is a sample module schema consisting of Service\nand RandomPassword\n\nAttributes\n----------\nservice: Service, default is Undefined, required. \n The exposed port of Workload, which will be generated into Kubernetes Service. \nrandomPassword: RandomPassword, default is Undefined, required. \n The sensitive random string, which will be generated into Terraform random_password. \n\nExamples\n--------\nimport kawesome as ks\n\naccessories: {\n "kusionstack/kawesome@v0.1.0": ks.Kawesome {\n service: ks.Service {\n port: 8080\n }\n randomPassword: ks.RandomPassword {\n length: 20\n }\n }\n}\n"""\n\n# The exposed port of Workload, which will be generated into Kubernetes Service. \nservice: Service\n\n# The sensitive random string, which will be generated into Terraform random_password. \nrandomPassword: RandomPassword\n')),(0,a.kt)("ol",{start:3},(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("strong",{parentName:"li"},"Implement the gRPC generate interface.")," The ",(0,a.kt)("inlineCode",{parentName:"li"},"generate")," interface consumes the application developer's config described in the ",(0,a.kt)("a",{parentName:"li",href:"../app-configuration"},(0,a.kt)("inlineCode",{parentName:"a"},"AppConfiguration"))," and the platform engineer's config described in the ",(0,a.kt)("a",{parentName:"li",href:"../workspace"},(0,a.kt)("inlineCode",{parentName:"a"},"workspace"))," to generate all infrastructure resources represented by this module.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-go"},'func (k *Kawesome) Generate(_ context.Context, request *module.GeneratorRequest) (*module.GeneratorResponse, error){\n // generate your infrastructure resoruces\n}\n\n// Patcher contains fields should be patched into the workload corresponding fields\ntype Patcher struct {\n // Environments represent the environment variables patched to all containers in the workload.\n Environments []v1.EnvVar `json:"environments" yaml:"environments"`\n // Labels represent the labels patched to both the workload and pod.\n Labels map[string]string `json:"labels" yaml:"labels"`\n // Annotations represent the annotations patched to both the workload and pod.\n Annotations map[string]string `json:"annotations" yaml:"annotations"`\n}\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"GeneratorRequest")," contains the application developer's config, platform engineer's config, workload config and related metadata a module could need to generate infrastructure resources.\nIn the ",(0,a.kt)("inlineCode",{parentName:"p"},"GeneratorResponse"),", there are two fields, ",(0,a.kt)("inlineCode",{parentName:"p"},"Resources")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"Patchers"),". The ",(0,a.kt)("inlineCode",{parentName:"p"},"Resource")," represents resources that should operated by Kusion and they will be appended into the ",(0,a.kt)("a",{parentName:"p",href:"../spec"},"Spec"),". The ",(0,a.kt)("inlineCode",{parentName:"p"},"Patchers")," are used to patch other resources. In this version, Kusion will parse them and patch workload corresponding fields."),(0,a.kt)("h2",{id:"publish"},"Publish"),(0,a.kt)("p",null,"Publish the Kusion module to an OCI registry with the command ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion mod push"),"."),(0,a.kt)("p",null,"Publish a stable version"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"kusion mod push /path/to/your-module oci://ghcr.io/kusionstack/kawesome --version=1.0.0 --latest=true --creds \n")),(0,a.kt)("p",null,"Publish a pre-release version"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"kusion mod push /path/to/your-module oci://ghcr.io/kusionstack/kawesome --version=1.0.0-rc.1 --latest=false --creds \n")),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"Please ensure that your token has the appropriate permissions to write to the registry.")),(0,a.kt)("p",null,"More details can be found in the ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion mod push")," reference doc."),(0,a.kt)("h2",{id:"initialize-the-workspace"},"Initialize the workspace"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},"modules: \n kusionstack/kawesome@0.1.0: \n default: \n service: \n labels: \n kusionstack.io/module-name: kawesome\n")),(0,a.kt)("p",null,"Initialize module platform configuration in the ",(0,a.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," to standardize the module's behavior. Please notice the key of this module should match this format: ",(0,a.kt)("inlineCode",{parentName:"p"},"namespace/moduleName@version")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/10669232.c7f81478.js b/assets/js/10669232.c7f81478.js new file mode 100644 index 00000000000..5fc93f29285 --- /dev/null +++ b/assets/js/10669232.c7f81478.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2301],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>c});var o=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function i(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=o.createContext({}),p=function(e){var n=o.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},d=function(e){var n=p(e.components);return o.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},m=o.forwardRef((function(e,n){var t=e.components,a=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),m=p(t),c=a,k=m["".concat(s,".").concat(c)]||m[c]||u[c]||r;return t?o.createElement(k,i(i({ref:n},d),{},{components:t})):o.createElement(k,i({ref:n},d))}));function c(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var r=t.length,i=new Array(r);i[0]=m;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var p=2;p{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>i,default:()=>u,frontMatter:()=>r,metadata:()=>l,toc:()=>p});var o=t(87462),a=(t(67294),t(3905));const r={},i="Platform Engineer Develop Guide",l={unversionedId:"concepts/kusion-module/develop-guide",id:"concepts/kusion-module/develop-guide",title:"Platform Engineer Develop Guide",description:"Prerequisites",source:"@site/docs/kusion/3-concepts/3-kusion-module/2-develop-guide.md",sourceDirName:"3-concepts/3-kusion-module",slug:"/concepts/kusion-module/develop-guide",permalink:"/docs/next/concepts/kusion-module/develop-guide",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/3-concepts/3-kusion-module/2-develop-guide.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{},sidebar:"kusion",previous:{title:"Overview",permalink:"/docs/next/concepts/kusion-module/overview"},next:{title:"Application Developer User Guide",permalink:"/docs/next/concepts/kusion-module/app-dev-guide"}},s={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Workflow",id:"workflow",level:2},{value:"Set up a developing environment",id:"set-up-a-developing-environment",level:2},{value:"Developing",id:"developing",level:2},{value:"Publish",id:"publish",level:2},{value:"Initialize the workspace",id:"initialize-the-workspace",level:2}],d={toc:p};function u(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,o.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"platform-engineer-develop-guide"},"Platform Engineer Develop Guide"),(0,a.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,a.kt)("p",null,"To follow this guide, you will need:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Go 1.22 or higher installed and configured"),(0,a.kt)("li",{parentName:"ul"},"Kusion v0.11.1 or higher installed locally")),(0,a.kt)("h2",{id:"workflow"},"Workflow"),(0,a.kt)("p",null,"As a platform engineer, the workflow of developing a Kusion module looks like this:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Communicate with app developers and identify the fields that should exposed to them in the dev-orient schema"),(0,a.kt)("li",{parentName:"ol"},"Identify module input parameters that should be configured by platform engineers in the ",(0,a.kt)("a",{parentName:"li",href:"../workspace"},"workspace")),(0,a.kt)("li",{parentName:"ol"},"Define the app dev-orient schema"),(0,a.kt)("li",{parentName:"ol"},"Develop the module by implementing gRPC interfaces")),(0,a.kt)("p",null,"The first two steps primarily involve communication with the application development team, and the specific details are not included in this tutorial. This tutorial begins with the subsequent two steps."),(0,a.kt)("h2",{id:"set-up-a-developing-environment"},"Set up a developing environment"),(0,a.kt)("p",null,"Developing a Kusion module includes defining a KCL schema and developing a module binary in golang. We will provide a scaffold repository and a new command ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion mod init")," to help developers set up the developing environment easily."),(0,a.kt)("p",null,"After executing the command"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"kusion mod init \n")),(0,a.kt)("p",null,"Kusion will download a ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion-module-scaffolding"},"scaffold repository")," and rename this project with your module name. The scaffold contains code templates and all files needed for developing a Kusion module."),(0,a.kt)("h2",{id:"developing"},"Developing"),(0,a.kt)("p",null,"The scaffold repository directory structure is shown below:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"$ tree kawesome/\n.\n\u251c\u2500\u2500 example\n\u2502\xa0\xa0 \u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 example_workspace.yaml\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2502\xa0\xa0 \u2514\u2500\u2500 project.yaml\n\u251c\u2500\u2500 kawesome.k\n\u251c\u2500\u2500 kcl.mod\n\u2514\u2500\u2500 src\n \u251c\u2500\u2500 Makefile\n \u251c\u2500\u2500 go.mod\n \u251c\u2500\u2500 go.sum\n \u251c\u2500\u2500 kawesome_generator.go\n \u2514\u2500\u2500 kawesome_generator_test.go\n")),(0,a.kt)("p",null,"When developing a Kusion module with the scaffold repository, you could follow the steps below:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("p",{parentName:"li"},(0,a.kt)("strong",{parentName:"p"},"Define the module name and version")," "),(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},"For go files. Rename the module name in the ",(0,a.kt)("inlineCode",{parentName:"li"},"go.mod")," and related files to your Kusion module name.")),(0,a.kt)("pre",{parentName:"li"},(0,a.kt)("code",{parentName:"pre",className:"language-yaml"}," module kawsome\n go 1.22\n require (\n ...\n )\n")),(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},"For KCL files. Rename package name and version in the ",(0,a.kt)("inlineCode",{parentName:"li"},"kcl.mod"))),(0,a.kt)("pre",{parentName:"li"},(0,a.kt)("code",{parentName:"pre",className:"language-toml"},' [package]\n name = "kawesome"\n version = 0.1.0\n')),(0,a.kt)("p",{parentName:"li"}," We assume the module named is ",(0,a.kt)("inlineCode",{parentName:"p"},"kawesome")," and the version is ",(0,a.kt)("inlineCode",{parentName:"p"},"0.1.0")," in this guide.")),(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("p",{parentName:"li"},(0,a.kt)("strong",{parentName:"p"},"Define the dev-orient schemas"),". They would be initialized by app developers. In this scaffold repository, we've defined a schema named Kawesome in ",(0,a.kt)("inlineCode",{parentName:"p"},"kawesome.k")," that consists of two resources ",(0,a.kt)("inlineCode",{parentName:"p"},"Service")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"RandomPassword")," and they will be generated into a Kubernetes Service and a Terraform RandomPassword later."))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'schema Kawesome: \n""" Kawesome is a sample module schema consisting of Service\nand RandomPassword\n\nAttributes\n----------\nservice: Service, default is Undefined, required. \n The exposed port of Workload, which will be generated into Kubernetes Service. \nrandomPassword: RandomPassword, default is Undefined, required. \n The sensitive random string, which will be generated into Terraform random_password. \n\nExamples\n--------\nimport kawesome as ks\n\naccessories: {\n "kusionstack/kawesome@v0.1.0": ks.Kawesome {\n service: ks.Service {\n port: 8080\n }\n randomPassword: ks.RandomPassword {\n length: 20\n }\n }\n}\n"""\n\n# The exposed port of Workload, which will be generated into Kubernetes Service. \nservice: Service\n\n# The sensitive random string, which will be generated into Terraform random_password. \nrandomPassword: RandomPassword\n')),(0,a.kt)("ol",{start:3},(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("strong",{parentName:"li"},"Implement the gRPC generate interface.")," The ",(0,a.kt)("inlineCode",{parentName:"li"},"generate")," interface consumes the application developer's config described in the ",(0,a.kt)("a",{parentName:"li",href:"../app-configuration"},(0,a.kt)("inlineCode",{parentName:"a"},"AppConfiguration"))," and the platform engineer's config described in the ",(0,a.kt)("a",{parentName:"li",href:"../workspace"},(0,a.kt)("inlineCode",{parentName:"a"},"workspace"))," to generate all infrastructure resources represented by this module.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-go"},'func (k *Kawesome) Generate(_ context.Context, request *module.GeneratorRequest) (*module.GeneratorResponse, error){\n // generate your infrastructure resoruces\n}\n\n// Patcher contains fields should be patched into the workload corresponding fields\ntype Patcher struct {\n // Environments represent the environment variables patched to all containers in the workload.\n Environments []v1.EnvVar `json:"environments" yaml:"environments"`\n // Labels represent the labels patched to both the workload and pod.\n Labels map[string]string `json:"labels" yaml:"labels"`\n // Annotations represent the annotations patched to both the workload and pod.\n Annotations map[string]string `json:"annotations" yaml:"annotations"`\n}\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"GeneratorRequest")," contains the application developer's config, platform engineer's config, workload config and related metadata a module could need to generate infrastructure resources.\nIn the ",(0,a.kt)("inlineCode",{parentName:"p"},"GeneratorResponse"),", there are two fields, ",(0,a.kt)("inlineCode",{parentName:"p"},"Resources")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"Patchers"),". The ",(0,a.kt)("inlineCode",{parentName:"p"},"Resource")," represents resources that should operated by Kusion and they will be appended into the ",(0,a.kt)("a",{parentName:"p",href:"../spec"},"Spec"),". The ",(0,a.kt)("inlineCode",{parentName:"p"},"Patchers")," are used to patch other resources. In this version, Kusion will parse them and patch workload corresponding fields."),(0,a.kt)("h2",{id:"publish"},"Publish"),(0,a.kt)("p",null,"Publish the Kusion module to an OCI registry with the command ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion mod push"),"."),(0,a.kt)("p",null,"Publish a stable version"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"kusion mod push /path/to/your-module oci://ghcr.io/kusionstack --latest=true --creds \n")),(0,a.kt)("p",null,"Publish a pre-release version"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"kusion mod push /path/to/your-module oci://ghcr.io/kusionstack --latest=false --creds \n")),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"The OCI URL format is ",(0,a.kt)("inlineCode",{parentName:"p"},"oci:///")," and please ensure that your token has the appropriate permissions to write to the registry.")),(0,a.kt)("p",null,"More details can be found in the ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion mod push")," reference doc."),(0,a.kt)("h2",{id:"initialize-the-workspace"},"Initialize the workspace"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},"modules: \n kusionstack/kawesome@0.1.0: \n default: \n service: \n labels: \n kusionstack.io/module-name: kawesome\n")),(0,a.kt)("p",null,"Initialize module platform configuration in the ",(0,a.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," to standardize the module's behavior. Please notice the key of this module should match this format: ",(0,a.kt)("inlineCode",{parentName:"p"},"namespace/moduleName@version")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/12216004.24717c2b.js b/assets/js/12216004.24717c2b.js new file mode 100644 index 00000000000..1230d447b7e --- /dev/null +++ b/assets/js/12216004.24717c2b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6524],{3905:(e,n,r)=>{r.d(n,{Zo:()=>l,kt:()=>m});var t=r(67294);function o(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function i(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,t)}return r}function a(e){for(var n=1;n=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=t.createContext({}),p=function(e){var n=t.useContext(c),r=n;return e&&(r="function"==typeof e?e(n):a(a({},n),e)),r},l=function(e){var n=p(e.components);return t.createElement(c.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},f=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),f=p(r),m=o,d=f["".concat(c,".").concat(m)]||f[m]||u[m]||i;return r?t.createElement(d,a(a({ref:n},l),{},{components:r})):t.createElement(d,a({ref:n},l))}));function m(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=f;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var p=2;p{r.r(n),r.d(n,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>p});var t=r(87462),o=(r(67294),r(3905));const i={},a="kusion version",s={unversionedId:"reference/commands/kusion-version",id:"version-v0.11/reference/commands/kusion-version",title:"kusion version",description:"Print the Kusion version information for the current context",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-version.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-version",permalink:"/docs/reference/commands/kusion-version",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-version.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion stack",permalink:"/docs/reference/commands/kusion-stack"},next:{title:"kusion workspace create",permalink:"/docs/reference/commands/kusion-workspace-create"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:n,...r}=e;return(0,o.kt)("wrapper",(0,t.Z)({},l,r,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-version"},"kusion version"),(0,o.kt)("p",null,"Print the Kusion version information for the current context"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Print the Kusion version information for the current context"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion version [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Print the Kusion version\n kusion version\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for version\n -o, --output string Output format. Only json format is supported for now\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/12216004.b0bfea70.js b/assets/js/12216004.b0bfea70.js deleted file mode 100644 index bd86fbe2ff3..00000000000 --- a/assets/js/12216004.b0bfea70.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6524],{3905:(e,n,r)=>{r.d(n,{Zo:()=>l,kt:()=>m});var t=r(67294);function o(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function i(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,t)}return r}function s(e){for(var n=1;n=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=t.createContext({}),p=function(e){var n=t.useContext(c),r=n;return e&&(r="function"==typeof e?e(n):s(s({},n),e)),r},l=function(e){var n=p(e.components);return t.createElement(c.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},f=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,l=a(e,["components","mdxType","originalType","parentName"]),f=p(r),m=o,d=f["".concat(c,".").concat(m)]||f[m]||u[m]||i;return r?t.createElement(d,s(s({ref:n},l),{},{components:r})):t.createElement(d,s({ref:n},l))}));function m(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=r.length,s=new Array(i);s[0]=f;var a={};for(var c in n)hasOwnProperty.call(n,c)&&(a[c]=n[c]);a.originalType=e,a.mdxType="string"==typeof e?e:o,s[1]=a;for(var p=2;p{r.r(n),r.d(n,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>i,metadata:()=>a,toc:()=>p});var t=r(87462),o=(r(67294),r(3905));const i={},s="kusion version",a={unversionedId:"reference/commands/kusion-version",id:"version-v0.11/reference/commands/kusion-version",title:"kusion version",description:"Print the Kusion version information for the current context",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-version.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-version",permalink:"/docs/reference/commands/kusion-version",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-version.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion stack",permalink:"/docs/reference/commands/kusion-stack"},next:{title:"kusion workspace create",permalink:"/docs/reference/commands/kusion-workspace-create"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:n,...r}=e;return(0,o.kt)("wrapper",(0,t.Z)({},l,r,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-version"},"kusion version"),(0,o.kt)("p",null,"Print the Kusion version information for the current context"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Print the Kusion version information for the current context"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion version [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Print the Kusion version\n kusion version\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for version\n -o, --output string Output format. Only json format is supported for now\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/13e25c40.e20487bc.js b/assets/js/13e25c40.f5ef4c7e.js similarity index 54% rename from assets/js/13e25c40.e20487bc.js rename to assets/js/13e25c40.f5ef4c7e.js index 5b8d74d75e4..906887bce73 100644 --- a/assets/js/13e25c40.e20487bc.js +++ b/assets/js/13e25c40.f5ef4c7e.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2306],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var a=r.createContext({}),s=function(e){var t=r.useContext(a),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(a.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,c=u(e,["components","mdxType","originalType","parentName"]),d=s(n),f=o,k=d["".concat(a,".").concat(f)]||d[f]||p[f]||i;return n?r.createElement(k,l(l({ref:t},c),{},{components:n})):r.createElement(k,l({ref:t},c))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,l=new Array(i);l[0]=d;var u={};for(var a in t)hasOwnProperty.call(t,a)&&(u[a]=t[a]);u.originalType=e,u.mdxType="string"==typeof e?e:o,l[1]=u;for(var s=2;s{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>l,default:()=>p,frontMatter:()=>i,metadata:()=>u,toc:()=>s});var r=n(87462),o=(n(67294),n(3905));const i={},l="kusion build",u={unversionedId:"reference/cli/kusion/kusion_build",id:"version-v0.9/reference/cli/kusion/kusion_build",title:"kusion build",description:"Build Kusion modules in a Stack to the Intent.",source:"@site/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_build.md",sourceDirName:"reference/cli/kusion",slug:"/reference/cli/kusion/kusion_build",permalink:"/docs/v0.9/reference/cli/kusion/kusion_build",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_build.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion apply",permalink:"/docs/v0.9/reference/cli/kusion/kusion_apply"},next:{title:"kusion compile",permalink:"/docs/v0.9/reference/cli/kusion/kusion_compile"}},a={},s=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 30-Nov-2023",id:"auto-generated-by-spf13cobra-on-30-nov-2023",level:6}],c={toc:s};function p(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-build"},"kusion build"),(0,o.kt)("p",null,"Build Kusion modules in a Stack to the Intent."),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Build Kusion modules in a Stack to the Intent."),(0,o.kt)("p",null," The command must be executed in a Stack or by specifying a Stack directory with the -w flag. You can provide a list of arguments to replace the placeholders defined in KCL, and use the --output flag to output the built results to a file."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion build [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Build main.k with arguments\n kusion build -D name=test -D age=18\n \n # Build main.k with work directory\n kusion build -w appops/demo/dev\n \n # Build main.k and write result into output.yaml\n kusion build -o output.yaml\n \n # Build without output style and color\n kusion build --no-style=true\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -D, --argument stringToString Specify the top-level argument (default [])\n -h, --help help for build\n --no-style Disable the output style and color\n -o, --output string Specify the output file\n -w, --workdir string Specify the work directory\n")),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.9/reference/cli/kusion/"},"kusion"),"\t - Kusion is the platform engineering engine of KusionStack")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-30-nov-2023"},"Auto generated by spf13/cobra on 30-Nov-2023"))}p.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2306],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var a=r.createContext({}),s=function(e){var t=r.useContext(a),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(a.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,a=e.parentName,c=u(e,["components","mdxType","originalType","parentName"]),d=s(n),f=o,k=d["".concat(a,".").concat(f)]||d[f]||p[f]||i;return n?r.createElement(k,l(l({ref:t},c),{},{components:n})):r.createElement(k,l({ref:t},c))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,l=new Array(i);l[0]=d;var u={};for(var a in t)hasOwnProperty.call(t,a)&&(u[a]=t[a]);u.originalType=e,u.mdxType="string"==typeof e?e:o,l[1]=u;for(var s=2;s{n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>l,default:()=>p,frontMatter:()=>i,metadata:()=>u,toc:()=>s});var r=n(87462),o=(n(67294),n(3905));const i={},l="kusion build",u={unversionedId:"reference/cli/kusion/kusion_build",id:"version-v0.9/reference/cli/kusion/kusion_build",title:"kusion build",description:"Build Kusion modules in a Stack to the Intent.",source:"@site/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_build.md",sourceDirName:"reference/cli/kusion",slug:"/reference/cli/kusion/kusion_build",permalink:"/docs/v0.9/reference/cli/kusion/kusion_build",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_build.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion apply",permalink:"/docs/v0.9/reference/cli/kusion/kusion_apply"},next:{title:"kusion compile",permalink:"/docs/v0.9/reference/cli/kusion/kusion_compile"}},a={},s=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 30-Nov-2023",id:"auto-generated-by-spf13cobra-on-30-nov-2023",level:6}],c={toc:s};function p(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-build"},"kusion build"),(0,o.kt)("p",null,"Build Kusion modules in a Stack to the Intent."),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Build Kusion modules in a Stack to the Intent."),(0,o.kt)("p",null," The command must be executed in a Stack or by specifying a Stack directory with the -w flag. You can provide a list of arguments to replace the placeholders defined in KCL, and use the --output flag to output the built results to a file."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion build [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Build main.k with arguments\n kusion build -D name=test -D age=18\n \n # Build main.k with work directory\n kusion build -w appops/demo/dev\n \n # Build main.k and write result into output.yaml\n kusion build -o output.yaml\n \n # Build without output style and color\n kusion build --no-style=true\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -D, --argument stringToString Specify the top-level argument (default [])\n -h, --help help for build\n --no-style Disable the output style and color\n -o, --output string Specify the output file\n -w, --workdir string Specify the work directory\n")),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.9/reference/cli/kusion/"},"kusion"),"\t - Kusion is the platform engineering engine of KusionStack")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-30-nov-2023"},"Auto generated by spf13/cobra on 30-Nov-2023"))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/163cf949.5abc9c73.js b/assets/js/163cf949.5abc9c73.js new file mode 100644 index 00000000000..b019d083115 --- /dev/null +++ b/assets/js/163cf949.5abc9c73.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6534],{3905:(e,n,t)=>{t.d(n,{Zo:()=>s,kt:()=>m});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var p=r.createContext({}),d=function(e){var n=r.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},s=function(e){var n=d(e.components);return r.createElement(p.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=d(t),m=a,g=u["".concat(p,".").concat(m)]||u[m]||c[m]||i;return t?r.createElement(g,o(o({ref:n},s),{},{components:t})):r.createElement(g,o({ref:n},s))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,o=new Array(i);o[0]=u;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var d=2;d{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>o,default:()=>c,frontMatter:()=>i,metadata:()=>l,toc:()=>d});var r=t(87462),a=(t(67294),t(3905));const i={},o="Upgrade Image",l={unversionedId:"guides/working-with-k8s/image-upgrade",id:"version-v0.9/guides/working-with-k8s/image-upgrade",title:"Upgrade Image",description:"You can declare the application's container image via image field of the Container schema.",source:"@site/docs_versioned_docs/version-v0.9/guides/working-with-k8s/4-image-upgrade.md",sourceDirName:"guides/working-with-k8s",slug:"/guides/working-with-k8s/image-upgrade",permalink:"/docs/v0.9/guides/working-with-k8s/image-upgrade",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/guides/working-with-k8s/4-image-upgrade.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:4,frontMatter:{},sidebar:"kusion",previous:{title:"Expose Service",permalink:"/docs/v0.9/guides/working-with-k8s/service"},next:{title:"Configure Resource Specification",permalink:"/docs/v0.9/guides/working-with-k8s/resource-spec"}},p={},d=[{value:"Pre-requisite",id:"pre-requisite",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],s={toc:d};function c(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},s,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"upgrade-image"},"Upgrade Image"),(0,a.kt)("p",null,"You can declare the application's container image via ",(0,a.kt)("inlineCode",{parentName:"p"},"image")," field of the ",(0,a.kt)("inlineCode",{parentName:"p"},"Container")," schema."),(0,a.kt)("p",null,"For the full ",(0,a.kt)("inlineCode",{parentName:"p"},"Container")," schema reference, please see ",(0,a.kt)("a",{parentName:"p",href:"../../reference/model/catalog_models/workload/doc_service#schema-container"},"here")," for more details."),(0,a.kt)("h2",{id:"pre-requisite"},"Pre-requisite"),(0,a.kt)("p",null,"Please refer to the ",(0,a.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,a.kt)("p",null,"The example below also requires you to have ",(0,a.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will generate a ",(0,a.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,a.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the project directory."),(0,a.kt)("h2",{id:"example"},"Example"),(0,a.kt)("p",null,"Update the image value in ",(0,a.kt)("inlineCode",{parentName:"p"},"dev/main.k"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-py"},'import catalog.models.schema.v1 as ac\n\nhelloworld: ac.AppConfiguration {\n workload.containers.nginx: {\n # dev stack has different image\n # set image to your want\n # before: \n # image = "gcr.io/google-samples/gb-frontend:v4"\n # after: \n image = "gcr.io/google-samples/gb-frontend:v5"\n }\n}\n')),(0,a.kt)("p",null,"Everything else in ",(0,a.kt)("inlineCode",{parentName:"p"},"main.k")," stay the same."),(0,a.kt)("h2",{id:"applying"},"Applying"),(0,a.kt)("p",null,"Re-run steps in ",(0,a.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", update image is completed."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"$ kusion apply\n\u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:helloworld UnChanged\n* \u251c\u2500 v1:Service:helloworld:helloworld-dev-helloworld-private UnChanged\n* \u2514\u2500 apps/v1:Deployment:helloworld:helloworld-dev-helloworld Update\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:helloworld, skip \n SUCCESS UnChanged v1:Service:helloworld:helloworld-dev-helloworld-private, skip \n SUCCESS Update apps/v1:Deployment:helloworld:helloworld-dev-helloworld success \nUpdate apps/v1:Deployment:helloworld:helloworld-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,a.kt)("h2",{id:"validation"},"Validation"),(0,a.kt)("p",null,"We can verify the application container (in the deployment template) now has the updated image (v5) as defined in the container configuration:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"kubectl get deployment -n helloworld -o yaml\n...\n template:\n ...\n spec:\n containers:\n - env:\n ...\n image: gcr.io/google-samples/gb-frontend:v5\n ...\n...\n")))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/163cf949.6371565d.js b/assets/js/163cf949.6371565d.js deleted file mode 100644 index e0c5f43ce38..00000000000 --- a/assets/js/163cf949.6371565d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6534],{3905:(e,n,t)=>{t.d(n,{Zo:()=>s,kt:()=>m});var r=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var p=r.createContext({}),d=function(e){var n=r.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},s=function(e){var n=d(e.components);return r.createElement(p.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=d(t),m=a,g=u["".concat(p,".").concat(m)]||u[m]||c[m]||i;return t?r.createElement(g,o(o({ref:n},s),{},{components:t})):r.createElement(g,o({ref:n},s))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,o=new Array(i);o[0]=u;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var d=2;d{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>o,default:()=>c,frontMatter:()=>i,metadata:()=>l,toc:()=>d});var r=t(87462),a=(t(67294),t(3905));const i={},o="Upgrade Image",l={unversionedId:"guides/working-with-k8s/image-upgrade",id:"version-v0.9/guides/working-with-k8s/image-upgrade",title:"Upgrade Image",description:"You can declare the application's container image via image field of the Container schema.",source:"@site/docs_versioned_docs/version-v0.9/guides/working-with-k8s/4-image-upgrade.md",sourceDirName:"guides/working-with-k8s",slug:"/guides/working-with-k8s/image-upgrade",permalink:"/docs/v0.9/guides/working-with-k8s/image-upgrade",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/guides/working-with-k8s/4-image-upgrade.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:4,frontMatter:{},sidebar:"kusion",previous:{title:"Expose Service",permalink:"/docs/v0.9/guides/working-with-k8s/service"},next:{title:"Configure Resource Specification",permalink:"/docs/v0.9/guides/working-with-k8s/resource-spec"}},p={},d=[{value:"Pre-requisite",id:"pre-requisite",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],s={toc:d};function c(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,r.Z)({},s,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"upgrade-image"},"Upgrade Image"),(0,a.kt)("p",null,"You can declare the application's container image via ",(0,a.kt)("inlineCode",{parentName:"p"},"image")," field of the ",(0,a.kt)("inlineCode",{parentName:"p"},"Container")," schema."),(0,a.kt)("p",null,"For the full ",(0,a.kt)("inlineCode",{parentName:"p"},"Container")," schema reference, please see ",(0,a.kt)("a",{parentName:"p",href:"../../reference/model/catalog_models/workload/doc_service#schema-container"},"here")," for more details."),(0,a.kt)("h2",{id:"pre-requisite"},"Pre-requisite"),(0,a.kt)("p",null,"Please refer to the ",(0,a.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,a.kt)("p",null,"The example below also requires you to have ",(0,a.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will generate a ",(0,a.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,a.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the project directory."),(0,a.kt)("h2",{id:"example"},"Example"),(0,a.kt)("p",null,"Update the image value in ",(0,a.kt)("inlineCode",{parentName:"p"},"dev/main.k"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-py"},'import catalog.models.schema.v1 as ac\n\nhelloworld: ac.AppConfiguration {\n workload.containers.nginx: {\n # dev stack has different image\n # set image to your want\n # before: \n # image = "gcr.io/google-samples/gb-frontend:v4"\n # after: \n image = "gcr.io/google-samples/gb-frontend:v5"\n }\n}\n')),(0,a.kt)("p",null,"Everything else in ",(0,a.kt)("inlineCode",{parentName:"p"},"main.k")," stay the same."),(0,a.kt)("h2",{id:"applying"},"Applying"),(0,a.kt)("p",null,"Re-run steps in ",(0,a.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", update image is completed."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"$ kusion apply\n\u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:helloworld UnChanged\n* \u251c\u2500 v1:Service:helloworld:helloworld-dev-helloworld-private UnChanged\n* \u2514\u2500 apps/v1:Deployment:helloworld:helloworld-dev-helloworld Update\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:helloworld, skip \n SUCCESS UnChanged v1:Service:helloworld:helloworld-dev-helloworld-private, skip \n SUCCESS Update apps/v1:Deployment:helloworld:helloworld-dev-helloworld success \nUpdate apps/v1:Deployment:helloworld:helloworld-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,a.kt)("h2",{id:"validation"},"Validation"),(0,a.kt)("p",null,"We can verify the application container (in the deployment template) now has the updated image (v5) as defined in the container configuration:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"kubectl get deployment -n helloworld -o yaml\n...\n template:\n ...\n spec:\n containers:\n - env:\n ...\n image: gcr.io/google-samples/gb-frontend:v5\n ...\n...\n")))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/16a19535.19833e67.js b/assets/js/16a19535.19833e67.js deleted file mode 100644 index 2224bce5dde..00000000000 --- a/assets/js/16a19535.19833e67.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9906],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var o=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=o.createContext({}),p=function(e){var t=o.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},c=function(e){var t=p(e.components);return o.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},u=o.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(n),f=i,h=u["".concat(s,".").concat(f)]||u[f]||d[f]||a;return n?o.createElement(h,r(r({ref:t},c),{},{components:n})):o.createElement(h,r({ref:t},c))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,r=new Array(a);r[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>r,default:()=>d,frontMatter:()=>a,metadata:()=>l,toc:()=>p});var o=n(87462),i=(n(67294),n(3905));const a={id:"app-configuration",sidebar_label:"AppConfiguration"},r="AppConfiguration",l={unversionedId:"concepts/app-configuration",id:"version-v0.10/concepts/app-configuration",title:"AppConfiguration",description:"As a modern cloud-native application delivery toolchain, declarative intent-based actuation is the central idea of Kusion, and AppConfiguration model plays the role of describing the intent, which provides a simpler path for on-boarding developers to the platform without leaking low level details in runtime infrastructure and allows developers to fully focus on the application logic itself.",source:"@site/docs_versioned_docs/version-v0.10/3-concepts/5-appconfiguration.md",sourceDirName:"3-concepts",slug:"/concepts/app-configuration",permalink:"/docs/v0.10/concepts/app-configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/3-concepts/5-appconfiguration.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:5,frontMatter:{id:"app-configuration",sidebar_label:"AppConfiguration"},sidebar:"kusion",previous:{title:"Workspace",permalink:"/docs/v0.10/concepts/workspace"},next:{title:"Intent",permalink:"/docs/v0.10/concepts/intent"}},s={},p=[{value:"Component",id:"component",level:4},{value:"Pipeline",id:"pipeline",level:4},{value:"Topologies",id:"topologies",level:4},{value:"PolicySets",id:"policysets",level:4},{value:"Dependency",id:"dependency",level:4}],c={toc:p};function d(e){let{components:t,...a}=e;return(0,i.kt)("wrapper",(0,o.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"appconfiguration"},"AppConfiguration"),(0,i.kt)("p",null,"As a modern cloud-native application delivery toolchain, declarative intent-based actuation is the central idea of Kusion, and ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model plays the role of describing the intent, which provides a simpler path for on-boarding developers to the platform without leaking low level details in runtime infrastructure and allows developers to fully focus on the application logic itself."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model consolidates all the necessary components and their dependent accessories for the application deployment, along with any workflow, policy and operational requirements into one standardized, infrastructure-independent declarative specification. This declarative specification represents the intuitive user intent for the application, which drives a standardized and efficient application delivery and operation process in a hybrid environment."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"appconfig.png",src:n(57091).Z,width:"5512",height:"3390"})),(0,i.kt)("p",null,"AppConfiguration consists of five core concepts, namely ",(0,i.kt)("inlineCode",{parentName:"p"},"Components"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Topologies"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Pipeline"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"PolicySets"),", and ",(0,i.kt)("inlineCode",{parentName:"p"},"Dependency"),". We will walk through these concepts one by one."),(0,i.kt)("h4",{id:"component"},"Component"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Components")," defines the foundation of any application configuration. Generally speaking, we believe that a comprehensive application description should at least consist of a core deployable workload that is frequently iterated and a collection of any other core services that the workload depends on, such as databases, caches or any other cloud services."),(0,i.kt)("p",null,"Components are conceptually split into two categories, ",(0,i.kt)("inlineCode",{parentName:"p"},"Workload")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"Accessories"),". The former revolves around the configuration for the computing resource. The latter represents any third-party runtime capabilities and operational requirements that the application needs. Each AppConfiguration consists of exactly one workload and any number of accessories."),(0,i.kt)("p",null,"Simply put, we can define ",(0,i.kt)("inlineCode",{parentName:"p"},"Components")," with the following expression:"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Components = Workload + Accessories")),(0,i.kt)("p",null,"The concept of ",(0,i.kt)("inlineCode",{parentName:"p"},"Components")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"Accessories")," itself is implicit when ",(0,i.kt)("a",{parentName:"p",href:"../configuration-walkthrough/overview"},"authoring the configuration files"),". You can define the workload and any type of accessories (such as database or monitoring) directly under the AppConfiguration model."),(0,i.kt)("p",null,"From a collaboration perspective, platform developers and SREs are responsible for continuously adding any new schema (as abstractions for the underlying infrastructure) and implementations that can be used out-of-the-box. Application developers SREs should be able to leverage the corresponding schemas to cover the evolving application needs. This helps software organizations achieve separation of concern, so that different roles can focus on the subject matter they are an expert of."),(0,i.kt)("h4",{id:"pipeline"},"Pipeline"),(0,i.kt)("p",null,"In most of the cases, the platform is capable of providing a consistent application delivery process that can meet most application needs. In the case that an application warrants any customization in the delivery workflow, the ",(0,i.kt)("inlineCode",{parentName:"p"},"Pipeline")," section in AppConfiguration provides an approach to extend the workflow as needed. "),(0,i.kt)("p",null,"A typical delivery workflow is made of several stages, each corresponds to some logic that needs to be executed, such as manual approval, data transfer, coordinated multi-cluster release, notification, etc. Implementation-wise, the execution of each stage should be carried out with a plugin, developed and managed by the platform owners."),(0,i.kt)("h4",{id:"topologies"},"Topologies"),(0,i.kt)("p",null,"In reality, what we have observed for production-grade applications is that they usually need to be deployed to a wide range of different targets including different clouds, regions, availability zones or runtimes for availability/cost/regulation/performance or disaster recovery related reasons. The ",(0,i.kt)("inlineCode",{parentName:"p"},"Topologies")," section in AppConfiguration highlights the different deployment targets in the application delivery and provides a single pane of glass that overlooks the entire deployment topology."),(0,i.kt)("h4",{id:"policysets"},"PolicySets"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"PolicySets")," section is responsible for defining the set of rules and procedures that should be followed in the application delivery process. They generally represent the guidelines with the purpose of minimizing any technical, security or compliance risks. Some examples include release strategies, risk management policies, and self-healing strategies. The collections of policies are expected to be managed as a joint effort from all the stakeholders, including platform owners, infrastructure owners, and security and compliance stakeholders. Some policy sets (usually security and compliance related) are expected to be mandatory. Some can be switched on and off by the application owner (self-healing strategy for instance) depending on their specific needs."),(0,i.kt)("h4",{id:"dependency"},"Dependency"),(0,i.kt)("p",null,"In a production-scale environment, there are usually intricate dependencies between multiple applications. The ",(0,i.kt)("inlineCode",{parentName:"p"},"Dependency")," section is responsible for describing the dependencies between multiple applications."))}d.isMDXComponent=!0},57091:(e,t,n)=>{n.d(t,{Z:()=>o});const o=n.p+"assets/images/appconfig-04e20b2e12ca7d5c3bc3992b2d602416.png"}}]); \ No newline at end of file diff --git a/assets/js/16a19535.2e160473.js b/assets/js/16a19535.2e160473.js new file mode 100644 index 00000000000..bccf1ac58df --- /dev/null +++ b/assets/js/16a19535.2e160473.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9906],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var o=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=o.createContext({}),p=function(e){var t=o.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},c=function(e){var t=p(e.components);return o.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},u=o.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(n),f=i,h=u["".concat(s,".").concat(f)]||u[f]||d[f]||a;return n?o.createElement(h,r(r({ref:t},c),{},{components:n})):o.createElement(h,r({ref:t},c))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,r=new Array(a);r[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>r,default:()=>d,frontMatter:()=>a,metadata:()=>l,toc:()=>p});var o=n(87462),i=(n(67294),n(3905));const a={id:"app-configuration",sidebar_label:"AppConfiguration"},r="AppConfiguration",l={unversionedId:"concepts/app-configuration",id:"version-v0.10/concepts/app-configuration",title:"AppConfiguration",description:"As a modern cloud-native application delivery toolchain, declarative intent-based actuation is the central idea of Kusion, and AppConfiguration model plays the role of describing the intent, which provides a simpler path for on-boarding developers to the platform without leaking low level details in runtime infrastructure and allows developers to fully focus on the application logic itself.",source:"@site/docs_versioned_docs/version-v0.10/3-concepts/5-appconfiguration.md",sourceDirName:"3-concepts",slug:"/concepts/app-configuration",permalink:"/docs/v0.10/concepts/app-configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/3-concepts/5-appconfiguration.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:5,frontMatter:{id:"app-configuration",sidebar_label:"AppConfiguration"},sidebar:"kusion",previous:{title:"Workspace",permalink:"/docs/v0.10/concepts/workspace"},next:{title:"Intent",permalink:"/docs/v0.10/concepts/intent"}},s={},p=[{value:"Component",id:"component",level:4},{value:"Pipeline",id:"pipeline",level:4},{value:"Topologies",id:"topologies",level:4},{value:"PolicySets",id:"policysets",level:4},{value:"Dependency",id:"dependency",level:4}],c={toc:p};function d(e){let{components:t,...a}=e;return(0,i.kt)("wrapper",(0,o.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"appconfiguration"},"AppConfiguration"),(0,i.kt)("p",null,"As a modern cloud-native application delivery toolchain, declarative intent-based actuation is the central idea of Kusion, and ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model plays the role of describing the intent, which provides a simpler path for on-boarding developers to the platform without leaking low level details in runtime infrastructure and allows developers to fully focus on the application logic itself."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model consolidates all the necessary components and their dependent accessories for the application deployment, along with any workflow, policy and operational requirements into one standardized, infrastructure-independent declarative specification. This declarative specification represents the intuitive user intent for the application, which drives a standardized and efficient application delivery and operation process in a hybrid environment."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"appconfig.png",src:n(57091).Z,width:"5512",height:"3390"})),(0,i.kt)("p",null,"AppConfiguration consists of five core concepts, namely ",(0,i.kt)("inlineCode",{parentName:"p"},"Components"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Topologies"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Pipeline"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"PolicySets"),", and ",(0,i.kt)("inlineCode",{parentName:"p"},"Dependency"),". We will walk through these concepts one by one."),(0,i.kt)("h4",{id:"component"},"Component"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Components")," defines the foundation of any application configuration. Generally speaking, we believe that a comprehensive application description should at least consist of a core deployable workload that is frequently iterated and a collection of any other core services that the workload depends on, such as databases, caches or any other cloud services."),(0,i.kt)("p",null,"Components are conceptually split into two categories, ",(0,i.kt)("inlineCode",{parentName:"p"},"Workload")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"Accessories"),". The former revolves around the configuration for the computing resource. The latter represents any third-party runtime capabilities and operational requirements that the application needs. Each AppConfiguration consists of exactly one workload and any number of accessories."),(0,i.kt)("p",null,"Simply put, we can define ",(0,i.kt)("inlineCode",{parentName:"p"},"Components")," with the following expression:"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Components = Workload + Accessories")),(0,i.kt)("p",null,"The concept of ",(0,i.kt)("inlineCode",{parentName:"p"},"Components")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"Accessories")," itself is implicit when ",(0,i.kt)("a",{parentName:"p",href:"../configuration-walkthrough/overview"},"authoring the configuration files"),". You can define the workload and any type of accessories (such as database or monitoring) directly under the AppConfiguration model."),(0,i.kt)("p",null,"From a collaboration perspective, platform developers and SREs are responsible for continuously adding any new schema (as abstractions for the underlying infrastructure) and implementations that can be used out-of-the-box. Application developers SREs should be able to leverage the corresponding schemas to cover the evolving application needs. This helps software organizations achieve separation of concern, so that different roles can focus on the subject matter they are an expert of."),(0,i.kt)("h4",{id:"pipeline"},"Pipeline"),(0,i.kt)("p",null,"In most of the cases, the platform is capable of providing a consistent application delivery process that can meet most application needs. In the case that an application warrants any customization in the delivery workflow, the ",(0,i.kt)("inlineCode",{parentName:"p"},"Pipeline")," section in AppConfiguration provides an approach to extend the workflow as needed. "),(0,i.kt)("p",null,"A typical delivery workflow is made of several stages, each corresponds to some logic that needs to be executed, such as manual approval, data transfer, coordinated multi-cluster release, notification, etc. Implementation-wise, the execution of each stage should be carried out with a plugin, developed and managed by the platform owners."),(0,i.kt)("h4",{id:"topologies"},"Topologies"),(0,i.kt)("p",null,"In reality, what we have observed for production-grade applications is that they usually need to be deployed to a wide range of different targets including different clouds, regions, availability zones or runtimes for availability/cost/regulation/performance or disaster recovery related reasons. The ",(0,i.kt)("inlineCode",{parentName:"p"},"Topologies")," section in AppConfiguration highlights the different deployment targets in the application delivery and provides a single pane of glass that overlooks the entire deployment topology."),(0,i.kt)("h4",{id:"policysets"},"PolicySets"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"PolicySets")," section is responsible for defining the set of rules and procedures that should be followed in the application delivery process. They generally represent the guidelines with the purpose of minimizing any technical, security or compliance risks. Some examples include release strategies, risk management policies, and self-healing strategies. The collections of policies are expected to be managed as a joint effort from all the stakeholders, including platform owners, infrastructure owners, and security and compliance stakeholders. Some policy sets (usually security and compliance related) are expected to be mandatory. Some can be switched on and off by the application owner (self-healing strategy for instance) depending on their specific needs."),(0,i.kt)("h4",{id:"dependency"},"Dependency"),(0,i.kt)("p",null,"In a production-scale environment, there are usually intricate dependencies between multiple applications. The ",(0,i.kt)("inlineCode",{parentName:"p"},"Dependency")," section is responsible for describing the dependencies between multiple applications."))}d.isMDXComponent=!0},57091:(e,t,n)=>{n.d(t,{Z:()=>o});const o=n.p+"assets/images/appconfig-04e20b2e12ca7d5c3bc3992b2d602416.png"}}]); \ No newline at end of file diff --git a/assets/js/16bff117.185946e6.js b/assets/js/16bff117.185946e6.js new file mode 100644 index 00000000000..5c559b6c4ac --- /dev/null +++ b/assets/js/16bff117.185946e6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4300],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),c=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=c(r),m=a,f=u["".concat(i,".").concat(m)]||u[m]||d[m]||l;return r?n.createElement(f,o(o({ref:t},p),{},{components:r})):n.createElement(f,o({ref:t},p))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=u;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var c=2;c{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>d,frontMatter:()=>l,metadata:()=>s,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const l={},o="secret",s={unversionedId:"reference/modules/developer-schemas/internal/secret/secret",id:"reference/modules/developer-schemas/internal/secret/secret",title:"secret",description:"Schema Secret",source:"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/internal/secret/secret.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/internal/secret",slug:"/reference/modules/developer-schemas/internal/secret/",permalink:"/docs/next/reference/modules/developer-schemas/internal/secret/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/1-developer-schemas/internal/secret/secret.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"probe",permalink:"/docs/next/reference/modules/developer-schemas/internal/container/probe/"},next:{title:"prometheus",permalink:"/docs/next/reference/modules/developer-schemas/monitoring/prometheus"}},i={},c=[{value:"Schema Secret",id:"schema-secret",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:c};function d(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"secret"},"secret"),(0,a.kt)("h2",{id:"schema-secret"},"Schema Secret"),(0,a.kt)("p",null,"Secrets are used to provide data that is considered sensitive like passwords, API keys,",(0,a.kt)("br",null),"TLS certificates, tokens or other credentials."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"data")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Data contains the non-binary secret data in string form."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"immutable")),(0,a.kt)("td",{parentName:"tr",align:null},"bool"),(0,a.kt)("td",{parentName:"tr",align:null},"Immutable, if set to true, ensures that data stored in the Secret cannot be updated."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"params")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Collection of parameters used to facilitate programmatic handling of secret data."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"type")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},'"basic"'),(0,a.kt)("td",{parentName:"tr",align:null},'"token"'),(0,a.kt)("td",{parentName:"tr",align:null},'"opaque"')))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.secret as sec\n\nbasicAuth = sec.Secret {\n type: "basic"\n data: {\n "username": ""\n "password": ""\n }\n}\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/16bff117.9d605764.js b/assets/js/16bff117.9d605764.js deleted file mode 100644 index 372a28395d7..00000000000 --- a/assets/js/16bff117.9d605764.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4300],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>u});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),c=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),m=c(r),u=a,f=m["".concat(i,".").concat(u)]||m[u]||d[u]||l;return r?n.createElement(f,o(o({ref:t},p),{},{components:r})):n.createElement(f,o({ref:t},p))}));function u(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=m;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var c=2;c{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>d,frontMatter:()=>l,metadata:()=>s,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const l={},o="secret",s={unversionedId:"reference/modules/developer-schemas/internal/secret/secret",id:"reference/modules/developer-schemas/internal/secret/secret",title:"secret",description:"Schema Secret",source:"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/internal/secret/secret.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/internal/secret",slug:"/reference/modules/developer-schemas/internal/secret/",permalink:"/docs/next/reference/modules/developer-schemas/internal/secret/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/1-developer-schemas/internal/secret/secret.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"probe",permalink:"/docs/next/reference/modules/developer-schemas/internal/container/probe/"},next:{title:"prometheus",permalink:"/docs/next/reference/modules/developer-schemas/monitoring/prometheus"}},i={},c=[{value:"Schema Secret",id:"schema-secret",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:c};function d(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"secret"},"secret"),(0,a.kt)("h2",{id:"schema-secret"},"Schema Secret"),(0,a.kt)("p",null,"Secrets are used to provide data that is considered sensitive like passwords, API keys,",(0,a.kt)("br",null),"TLS certificates, tokens or other credentials."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"data")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Data contains the non-binary secret data in string form."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"immutable")),(0,a.kt)("td",{parentName:"tr",align:null},"bool"),(0,a.kt)("td",{parentName:"tr",align:null},"Immutable, if set to true, ensures that data stored in the Secret cannot be updated."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"params")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Collection of parameters used to facilitate programmatic handling of secret data."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"type")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},'"basic"'),(0,a.kt)("td",{parentName:"tr",align:null},'"token"'),(0,a.kt)("td",{parentName:"tr",align:null},'"opaque"')))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.secret as sec\n\nbasicAuth = sec.Secret {\n type: "basic"\n data: {\n "username": ""\n "password": ""\n }\n}\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/17658ce1.7bf5ac4b.js b/assets/js/17658ce1.b4908420.js similarity index 78% rename from assets/js/17658ce1.7bf5ac4b.js rename to assets/js/17658ce1.b4908420.js index 5de6f9c06ae..6651008eb38 100644 --- a/assets/js/17658ce1.7bf5ac4b.js +++ b/assets/js/17658ce1.b4908420.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1209],{3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},l={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,u=a(e,["components","mdxType","originalType","parentName"]),d=p(r),f=o,m=d["".concat(c,".").concat(f)]||d[f]||l[f]||i;return r?n.createElement(m,s(s({ref:t},u),{},{components:r})):n.createElement(m,s({ref:t},u))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,s=new Array(i);s[0]=d;var a={};for(var c in t)hasOwnProperty.call(t,c)&&(a[c]=t[c]);a.originalType=e,a.mdxType="string"==typeof e?e:o,s[1]=a;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>l,frontMatter:()=>i,metadata:()=>a,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const i={},s="Kubernetes",a={unversionedId:"guides/working-with-k8s/index",id:"version-v0.9/guides/working-with-k8s/index",title:"Kubernetes",description:"",source:"@site/docs_versioned_docs/version-v0.9/guides/working-with-k8s/index.md",sourceDirName:"guides/working-with-k8s",slug:"/guides/working-with-k8s/",permalink:"/docs/v0.9/guides/working-with-k8s/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/guides/working-with-k8s/index.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Expose Application Service Deployed on CSP Kubernetes",permalink:"/docs/v0.9/guides/cloud-resources/expose-service"},next:{title:"Deploy Application",permalink:"/docs/v0.9/guides/working-with-k8s/deploy-application"}},c={},p=[],u={toc:p};function l(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kubernetes"},"Kubernetes"))}l.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1209],{3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},l={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,u=a(e,["components","mdxType","originalType","parentName"]),d=p(r),f=o,y=d["".concat(c,".").concat(f)]||d[f]||l[f]||i;return r?n.createElement(y,s(s({ref:t},u),{},{components:r})):n.createElement(y,s({ref:t},u))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,s=new Array(i);s[0]=d;var a={};for(var c in t)hasOwnProperty.call(t,c)&&(a[c]=t[c]);a.originalType=e,a.mdxType="string"==typeof e?e:o,s[1]=a;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>l,frontMatter:()=>i,metadata:()=>a,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const i={},s="Kubernetes",a={unversionedId:"guides/working-with-k8s/index",id:"version-v0.9/guides/working-with-k8s/index",title:"Kubernetes",description:"",source:"@site/docs_versioned_docs/version-v0.9/guides/working-with-k8s/index.md",sourceDirName:"guides/working-with-k8s",slug:"/guides/working-with-k8s/",permalink:"/docs/v0.9/guides/working-with-k8s/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/guides/working-with-k8s/index.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Expose Application Service Deployed on CSP Kubernetes",permalink:"/docs/v0.9/guides/cloud-resources/expose-service"},next:{title:"Deploy Application",permalink:"/docs/v0.9/guides/working-with-k8s/deploy-application"}},c={},p=[],u={toc:p};function l(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kubernetes"},"Kubernetes"))}l.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/17a1e8ae.45c60e6d.js b/assets/js/17a1e8ae.45c60e6d.js deleted file mode 100644 index 4f9dadcaa68..00000000000 --- a/assets/js/17a1e8ae.45c60e6d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8071],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),c=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=c(r),m=o,f=d["".concat(l,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(f,s(s({ref:t},p),{},{components:r})):n.createElement(f,s({ref:t},p))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=d;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var c=2;c{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>c});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion workspace list",i={unversionedId:"reference/commands/kusion-workspace-list",id:"version-v0.10/reference/commands/kusion-workspace-list",title:"kusion workspace list",description:"List all workspace names",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace-list.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-list",permalink:"/docs/v0.10/reference/commands/kusion-workspace-list",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace-list.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace delete",permalink:"/docs/v0.10/reference/commands/kusion-workspace-delete"},next:{title:"kusion workspace show",permalink:"/docs/v0.10/reference/commands/kusion-workspace-show"}},l={},c=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],p={toc:c};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-list"},"kusion workspace list"),(0,o.kt)("p",null,"List all workspace names"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command list the names of all workspaces."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace list\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # List all workspace names\n kusion workspace list\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for list\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/17a1e8ae.ccf48d6a.js b/assets/js/17a1e8ae.ccf48d6a.js new file mode 100644 index 00000000000..86e272f00a6 --- /dev/null +++ b/assets/js/17a1e8ae.ccf48d6a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8071],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(r),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(f,s(s({ref:t},p),{},{components:r})):n.createElement(f,s({ref:t},p))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion workspace list",i={unversionedId:"reference/commands/kusion-workspace-list",id:"version-v0.10/reference/commands/kusion-workspace-list",title:"kusion workspace list",description:"List all workspace names",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace-list.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-list",permalink:"/docs/v0.10/reference/commands/kusion-workspace-list",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace-list.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace delete",permalink:"/docs/v0.10/reference/commands/kusion-workspace-delete"},next:{title:"kusion workspace show",permalink:"/docs/v0.10/reference/commands/kusion-workspace-show"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],p={toc:l};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-list"},"kusion workspace list"),(0,o.kt)("p",null,"List all workspace names"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command list the names of all workspaces."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace list\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # List all workspace names\n kusion workspace list\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for list\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/180ff8b9.814b6860.js b/assets/js/180ff8b9.7ee38d2d.js similarity index 52% rename from assets/js/180ff8b9.814b6860.js rename to assets/js/180ff8b9.7ee38d2d.js index b3fd1565ebd..4148efd790c 100644 --- a/assets/js/180ff8b9.814b6860.js +++ b/assets/js/180ff8b9.7ee38d2d.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7057],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},l=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,l=a(e,["components","mdxType","originalType","parentName"]),f=p(n),m=o,d=f["".concat(c,".").concat(m)]||f[m]||u[m]||i;return n?r.createElement(d,s(s({ref:t},l),{},{components:n})):r.createElement(d,s({ref:t},l))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,s=new Array(i);s[0]=f;var a={};for(var c in t)hasOwnProperty.call(t,c)&&(a[c]=t[c]);a.originalType=e,a.mdxType="string"==typeof e?e:o,s[1]=a;for(var p=2;p{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>i,metadata:()=>a,toc:()=>p});var r=n(87462),o=(n(67294),n(3905));const i={},s="kusion config set",a={unversionedId:"reference/commands/kusion-config-set",id:"reference/commands/kusion-config-set",title:"kusion config set",description:"Set a config item",source:"@site/docs/kusion/6-reference/1-commands/kusion-config-set.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-config-set",permalink:"/docs/next/reference/commands/kusion-config-set",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-config-set.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion config list",permalink:"/docs/next/reference/commands/kusion-config-list"},next:{title:"kusion config unset",permalink:"/docs/next/reference/commands/kusion-config-unset"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-config-set"},"kusion config set"),(0,o.kt)("p",null,"Set a config item"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command sets the value of a specified kusion config item, where the config item must be registered, and the value must be in valid type."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion config set\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' # Set a config item with string type value\n kusion config set backends.current mysql-pre\n \n # Set a config item with int type value\n kusion config set backends.mysql-pre.configs.port 3306\n \n # Set a config item with struct or map type value\n kusion config set backends.mysql-pre.configs \'{"dbName":"kusion","user":"kk","host":"127.0.0.1","port":3306}\'\n')),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for set\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-config"},"kusion config"),"\t - Interact with the Kusion config")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7057],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},l=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,l=a(e,["components","mdxType","originalType","parentName"]),f=p(n),m=o,d=f["".concat(c,".").concat(m)]||f[m]||u[m]||i;return n?r.createElement(d,s(s({ref:t},l),{},{components:n})):r.createElement(d,s({ref:t},l))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,s=new Array(i);s[0]=f;var a={};for(var c in t)hasOwnProperty.call(t,c)&&(a[c]=t[c]);a.originalType=e,a.mdxType="string"==typeof e?e:o,s[1]=a;for(var p=2;p{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>i,metadata:()=>a,toc:()=>p});var r=n(87462),o=(n(67294),n(3905));const i={},s="kusion config set",a={unversionedId:"reference/commands/kusion-config-set",id:"reference/commands/kusion-config-set",title:"kusion config set",description:"Set a config item",source:"@site/docs/kusion/6-reference/1-commands/kusion-config-set.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-config-set",permalink:"/docs/next/reference/commands/kusion-config-set",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-config-set.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion config list",permalink:"/docs/next/reference/commands/kusion-config-list"},next:{title:"kusion config unset",permalink:"/docs/next/reference/commands/kusion-config-unset"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-config-set"},"kusion config set"),(0,o.kt)("p",null,"Set a config item"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command sets the value of a specified kusion config item, where the config item must be registered, and the value must be in valid type."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion config set\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' # Set a config item with string type value\n kusion config set backends.current mysql-pre\n \n # Set a config item with int type value\n kusion config set backends.mysql-pre.configs.port 3306\n \n # Set a config item with struct or map type value\n kusion config set backends.mysql-pre.configs \'{"dbName":"kusion","user":"kk","host":"127.0.0.1","port":3306}\'\n')),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for set\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-config"},"kusion config"),"\t - Interact with the Kusion config")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/18d9b529.258fd535.js b/assets/js/18d9b529.258fd535.js deleted file mode 100644 index 747b30e99d7..00000000000 --- a/assets/js/18d9b529.258fd535.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2218],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(n),m=a,g=d["".concat(c,".").concat(m)]||d[m]||u[m]||s;return n?r.createElement(g,o(o({ref:t},p),{},{components:n})):r.createElement(g,o({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>s,metadata:()=>i,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const s={id:"using-cloud-secrets"},o="Using Cloud Secrets Manager",i={unversionedId:"user-guides/secrets-management/using-cloud-secrets",id:"user-guides/secrets-management/using-cloud-secrets",title:"Using Cloud Secrets Manager",description:"Applications usually store sensitive data in secrets by using centralized secrets management solutions. For example, you authenticate databases, services, and external systems with passwords, API keys, tokens, and other credentials stored in a secret store, e.g. Hashicorp Vault, AWS Secrets Manager, Azure Key Vault, etc",source:"@site/docs/kusion/5-user-guides/4-secrets-management/1-using-cloud-secrets.md",sourceDirName:"5-user-guides/4-secrets-management",slug:"/user-guides/secrets-management/using-cloud-secrets",permalink:"/docs/next/user-guides/secrets-management/using-cloud-secrets",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/5-user-guides/4-secrets-management/1-using-cloud-secrets.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"using-cloud-secrets"},sidebar:"kusion",previous:{title:"Configure Monitoring Behavior With Prometheus",permalink:"/docs/next/user-guides/observability/prometheus"},next:{title:"Kusion Commands",permalink:"/docs/next/reference/commands/"}},c={},l=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Setting up workspace",id:"setting-up-workspace",level:2},{value:"Update AppConfiguration",id:"update-appconfiguration",level:2},{value:"Apply and Verify",id:"apply-and-verify",level:2}],p={toc:l};function u(e){let{components:t,...s}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,s,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"using-cloud-secrets-manager"},"Using Cloud Secrets Manager"),(0,a.kt)("p",null,"Applications usually store sensitive data in secrets by using centralized secrets management solutions. For example, you authenticate databases, services, and external systems with passwords, API keys, tokens, and other credentials stored in a secret store, e.g. Hashicorp Vault, AWS Secrets Manager, Azure Key Vault, etc"),(0,a.kt)("p",null,"Kusion provides out-of-the-box support to reference existing external secrets management solution, this tutorial introduces that how to pull the secret from AWS Secrets Manager to make it available to applications."),(0,a.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,a.kt)("p",null,"Please refer to the ",(0,a.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,a.kt)("p",null,"The example below also requires you to have ",(0,a.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#initializing"},"initialized the project")," using the ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will generate a ",(0,a.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#kclmod"},(0,a.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the project directory."),(0,a.kt)("p",null,"Additionally, you also need to configure the obtained AccessKey and SecretKey as environment variables: "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},'export AWS_ACCESS_KEY_ID="AKIAQZDxxxx" # replace it with your AccessKey\nexport AWS_SECRET_ACCESS_KEY="oE/xxxx" # replace it with your SecretKey\n')),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"aws iam account",src:n(24838).Z,width:"2874",height:"1398"})),(0,a.kt)("h2",{id:"setting-up-workspace"},"Setting up workspace"),(0,a.kt)("p",null,"Since v0.10.0, we have introduced the concept of ",(0,a.kt)("a",{parentName:"p",href:"/docs/next/concepts/workspace"},"workspaces"),", whose configurations represent the part of the application behaviors that platform teams are interested in standardizing, or the ones to eliminate from developer's mind to make their lives easier."),(0,a.kt)("p",null,"In the case of setting up cloud secrets manager, platform teams need to specify which secrets management solution to use and necessary information to access on the workspace level."),(0,a.kt)("p",null,"A sample ",(0,a.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," with AWS Secrets Manager settings:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"modules:\n ...\nsecretStore:\n provider:\n aws:\n region: us-east-1\n profile: The optional profile to be used to interact with AWS Secrets Manager.\n...\n")),(0,a.kt)("h2",{id:"update-appconfiguration"},"Update AppConfiguration"),(0,a.kt)("p",null,"At this point we are set up for good! Now you can declare external type of secrets via the ",(0,a.kt)("inlineCode",{parentName:"p"},"secrets")," field in the ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model to consume sensitive data stored in AWS Secrets Manager."),(0,a.kt)("p",null,"See the example below for a full, deployable AppConfiguration."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport kam.v1.workload.secret as sec\n\ngitsync: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "syncer": c.Container {\n image: "dyrnq/git-sync"\n # Run the following command as defined\n command: [\n "--repo=https://github.com/KusionStack/kusion"\n "--ref=HEAD"\n "--root=/mnt/git"\n ]\n # Consume secrets in environment variables\n env: {\n "GIT_SYNC_USERNAME": "secret://git-auth/username"\n "GIT_SYNC_PASSWORD": "secret://git-auth/password"\n }\n }\n }\n # Secrets used to retrieve secret data from AWS Secrets Manager\n secrets: {\n "git-auth": sec.Secret {\n type: "external"\n data: {\n "username": "ref://git-auth-info/username"\n "password": "ref://git-auth-info/password"\n }\n }\n }\n }\n}\n')),(0,a.kt)("h2",{id:"apply-and-verify"},"Apply and Verify"),(0,a.kt)("p",null,"Run ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion apply")," command to deploy above application, then use the below command to verify if the secret got deployed:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"kubectl get secret -n secretdemo\n")),(0,a.kt)("p",null,"You will find ",(0,a.kt)("inlineCode",{parentName:"p"},"git-auth")," of type Opaque automatically created and contains sensitive information pulled from AWS Secrets Manager."))}u.isMDXComponent=!0},24838:(e,t,n)=>{n.d(t,{Z:()=>r});const r=n.p+"assets/images/aws-iam-account-2216105e7fa18fb2f7bf4be7e19f98bd.png"}}]); \ No newline at end of file diff --git a/assets/js/18d9b529.6440b594.js b/assets/js/18d9b529.6440b594.js new file mode 100644 index 00000000000..640bc9054fb --- /dev/null +++ b/assets/js/18d9b529.6440b594.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2218],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(n),m=a,g=d["".concat(c,".").concat(m)]||d[m]||u[m]||s;return n?r.createElement(g,o(o({ref:t},p),{},{components:n})):r.createElement(g,o({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>s,metadata:()=>i,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const s={id:"using-cloud-secrets"},o="Using Cloud Secrets Manager",i={unversionedId:"user-guides/secrets-management/using-cloud-secrets",id:"user-guides/secrets-management/using-cloud-secrets",title:"Using Cloud Secrets Manager",description:"Applications usually store sensitive data in secrets by using centralized secrets management solutions. For example, you authenticate databases, services, and external systems with passwords, API keys, tokens, and other credentials stored in a secret store, e.g. Hashicorp Vault, AWS Secrets Manager, Azure Key Vault, etc",source:"@site/docs/kusion/5-user-guides/4-secrets-management/1-using-cloud-secrets.md",sourceDirName:"5-user-guides/4-secrets-management",slug:"/user-guides/secrets-management/using-cloud-secrets",permalink:"/docs/next/user-guides/secrets-management/using-cloud-secrets",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/5-user-guides/4-secrets-management/1-using-cloud-secrets.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"using-cloud-secrets"},sidebar:"kusion",previous:{title:"Configure Monitoring Behavior With Prometheus",permalink:"/docs/next/user-guides/observability/prometheus"},next:{title:"Kusion Commands",permalink:"/docs/next/reference/commands/"}},c={},l=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Setting up workspace",id:"setting-up-workspace",level:2},{value:"Update AppConfiguration",id:"update-appconfiguration",level:2},{value:"Apply and Verify",id:"apply-and-verify",level:2}],p={toc:l};function u(e){let{components:t,...s}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,s,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"using-cloud-secrets-manager"},"Using Cloud Secrets Manager"),(0,a.kt)("p",null,"Applications usually store sensitive data in secrets by using centralized secrets management solutions. For example, you authenticate databases, services, and external systems with passwords, API keys, tokens, and other credentials stored in a secret store, e.g. Hashicorp Vault, AWS Secrets Manager, Azure Key Vault, etc"),(0,a.kt)("p",null,"Kusion provides out-of-the-box support to reference existing external secrets management solution, this tutorial introduces that how to pull the secret from AWS Secrets Manager to make it available to applications."),(0,a.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,a.kt)("p",null,"Please refer to the ",(0,a.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,a.kt)("p",null,"The example below also requires you to have ",(0,a.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#initializing"},"initialized the project")," using the ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will generate a ",(0,a.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#kclmod"},(0,a.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the project directory."),(0,a.kt)("p",null,"Additionally, you also need to configure the obtained AccessKey and SecretKey as environment variables: "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},'export AWS_ACCESS_KEY_ID="AKIAQZDxxxx" # replace it with your AccessKey\nexport AWS_SECRET_ACCESS_KEY="oE/xxxx" # replace it with your SecretKey\n')),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"aws iam account",src:n(24838).Z,width:"2874",height:"1398"})),(0,a.kt)("h2",{id:"setting-up-workspace"},"Setting up workspace"),(0,a.kt)("p",null,"Since v0.10.0, we have introduced the concept of ",(0,a.kt)("a",{parentName:"p",href:"/docs/next/concepts/workspace"},"workspaces"),", whose configurations represent the part of the application behaviors that platform teams are interested in standardizing, or the ones to eliminate from developer's mind to make their lives easier."),(0,a.kt)("p",null,"In the case of setting up cloud secrets manager, platform teams need to specify which secrets management solution to use and necessary information to access on the workspace level."),(0,a.kt)("p",null,"A sample ",(0,a.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," with AWS Secrets Manager settings:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"modules:\n ...\nsecretStore:\n provider:\n aws:\n region: us-east-1\n profile: The optional profile to be used to interact with AWS Secrets Manager.\n...\n")),(0,a.kt)("h2",{id:"update-appconfiguration"},"Update AppConfiguration"),(0,a.kt)("p",null,"At this point we are set up for good! Now you can declare external type of secrets via the ",(0,a.kt)("inlineCode",{parentName:"p"},"secrets")," field in the ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model to consume sensitive data stored in AWS Secrets Manager."),(0,a.kt)("p",null,"See the example below for a full, deployable AppConfiguration."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport kam.v1.workload.secret as sec\n\ngitsync: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "syncer": c.Container {\n image: "dyrnq/git-sync"\n # Run the following command as defined\n command: [\n "--repo=https://github.com/KusionStack/kusion"\n "--ref=HEAD"\n "--root=/mnt/git"\n ]\n # Consume secrets in environment variables\n env: {\n "GIT_SYNC_USERNAME": "secret://git-auth/username"\n "GIT_SYNC_PASSWORD": "secret://git-auth/password"\n }\n }\n }\n # Secrets used to retrieve secret data from AWS Secrets Manager\n secrets: {\n "git-auth": sec.Secret {\n type: "external"\n data: {\n "username": "ref://git-auth-info/username"\n "password": "ref://git-auth-info/password"\n }\n }\n }\n }\n}\n')),(0,a.kt)("h2",{id:"apply-and-verify"},"Apply and Verify"),(0,a.kt)("p",null,"Run ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion apply")," command to deploy above application, then use the below command to verify if the secret got deployed:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"kubectl get secret -n secretdemo\n")),(0,a.kt)("p",null,"You will find ",(0,a.kt)("inlineCode",{parentName:"p"},"git-auth")," of type Opaque automatically created and contains sensitive information pulled from AWS Secrets Manager."))}u.isMDXComponent=!0},24838:(e,t,n)=>{n.d(t,{Z:()=>r});const r=n.p+"assets/images/aws-iam-account-2216105e7fa18fb2f7bf4be7e19f98bd.png"}}]); \ No newline at end of file diff --git a/assets/js/18fa340a.7e78f7eb.js b/assets/js/18fa340a.7e78f7eb.js deleted file mode 100644 index 9fbe31a9809..00000000000 --- a/assets/js/18fa340a.7e78f7eb.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[440],{3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function s(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var i=n.createContext({}),c=function(e){var t=n.useContext(i),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},d=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},p=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),p=c(a),m=r,k=p["".concat(i,".").concat(m)]||p[m]||u[m]||o;return a?n.createElement(k,s(s({ref:t},d),{},{components:a})):n.createElement(k,s({ref:t},d))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=p;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,s[1]=l;for(var c=2;c{a.d(t,{Z:()=>s});var n=a(67294),r=a(86010);const o="tabItem_Ymn6";function s(e){let{children:t,hidden:a,className:s}=e;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(o,s),hidden:a},t)}},74866:(e,t,a)=>{a.d(t,{Z:()=>N});var n=a(87462),r=a(67294),o=a(86010),s=a(12466),l=a(76775),i=a(91980),c=a(67392),d=a(50012);function u(e){return function(e){var t;return(null==(t=r.Children.map(e,(e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})))?void 0:t.filter(Boolean))??[]}(e).map((e=>{let{props:{value:t,label:a,attributes:n,default:r}}=e;return{value:t,label:a,attributes:n,default:r}}))}function p(e){const{values:t,children:a}=e;return(0,r.useMemo)((()=>{const e=t??u(a);return function(e){const t=(0,c.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,a])}function m(e){let{value:t,tabValues:a}=e;return a.some((e=>e.value===t))}function k(e){let{queryString:t=!1,groupId:a}=e;const n=(0,l.k6)(),o=function(e){let{queryString:t=!1,groupId:a}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!a)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return a??null}({queryString:t,groupId:a});return[(0,i._X)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(n.location.search);t.set(o,e),n.replace({...n.location,search:t.toString()})}),[o,n])]}function h(e){const{defaultValue:t,queryString:a=!1,groupId:n}=e,o=p(e),[s,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:a}=e;if(0===a.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:a}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${a.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const n=a.find((e=>e.default))??a[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:o}))),[i,c]=k({queryString:a,groupId:n}),[u,h]=function(e){let{groupId:t}=e;const a=function(e){return e?`docusaurus.tab.${e}`:null}(t),[n,o]=(0,d.Nk)(a);return[n,(0,r.useCallback)((e=>{a&&o.set(e)}),[a,o])]}({groupId:n}),f=(()=>{const e=i??u;return m({value:e,tabValues:o})?e:null})();(0,r.useLayoutEffect)((()=>{f&&l(f)}),[f]);return{selectedValue:s,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),c(e),h(e)}),[c,h,o]),tabValues:o}}var f=a(72389);const w="tabList__CuJ",g="tabItem_LNqP";function b(e){let{className:t,block:a,selectedValue:l,selectValue:i,tabValues:c}=e;const d=[],{blockElementScrollPositionUntilNextRender:u}=(0,s.o5)(),p=e=>{const t=e.currentTarget,a=d.indexOf(t),n=c[a].value;n!==l&&(u(t),i(n))},m=e=>{var t;let a=null;switch(e.key){case"Enter":p(e);break;case"ArrowRight":{const t=d.indexOf(e.currentTarget)+1;a=d[t]??d[0];break}case"ArrowLeft":{const t=d.indexOf(e.currentTarget)-1;a=d[t]??d[d.length-1];break}}null==(t=a)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":a},t)},c.map((e=>{let{value:t,label:a,attributes:s}=e;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:l===t?0:-1,"aria-selected":l===t,key:t,ref:e=>d.push(e),onKeyDown:m,onClick:p},s,{className:(0,o.Z)("tabs__item",g,null==s?void 0:s.className,{"tabs__item--active":l===t})}),a??t)})))}function v(e){let{lazy:t,children:a,selectedValue:n}=e;const o=(Array.isArray(a)?a:[a]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===n));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==n}))))}function y(e){const t=h(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",w)},r.createElement(b,(0,n.Z)({},e,t)),r.createElement(v,(0,n.Z)({},e,t)))}function N(e){const t=(0,f.Z)();return r.createElement(y,(0,n.Z)({key:String(t)},e))}},59118:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>c,toc:()=>u});var n=a(87462),r=(a(67294),a(3905)),o=a(74866),s=a(85162);const l={id:"database"},i="Deliver the WordPress Application with Cloud RDS",c={unversionedId:"user-guides/cloud-resources/database",id:"version-v0.11/user-guides/cloud-resources/database",title:"Deliver the WordPress Application with Cloud RDS",description:"This tutorial will demonstrate how to deploy a WordPress application with Kusion, which relies on both Kubernetes and IaaS resources provided by cloud vendors. We can learn how to declare the Relational Database Service (RDS) to provide a cloud-based database solution with Kusion for our application from this article.",source:"@site/docs_versioned_docs/version-v0.11/5-user-guides/1-cloud-resources/1-database.md",sourceDirName:"5-user-guides/1-cloud-resources",slug:"/user-guides/cloud-resources/database",permalink:"/docs/user-guides/cloud-resources/database",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/5-user-guides/1-cloud-resources/1-database.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"database"},sidebar:"kusion",previous:{title:"Operational Rules",permalink:"/docs/configuration-walkthrough/operational-rules"},next:{title:"Expose Application Service Deployed on CSP Kubernetes",permalink:"/docs/user-guides/cloud-resources/expose-service"}},d={},u=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Init Workspace",id:"init-workspace",level:2},{value:"Create Project And Stack",id:"create-project-and-stack",level:2},{value:"Update And Review Configuration Codes",id:"update-and-review-configuration-codes",level:3},{value:"Application Delivery",id:"application-delivery",level:2},{value:"Verify WordPress Application",id:"verify-wordpress-application",level:2},{value:"Delete WordPress Application",id:"delete-wordpress-application",level:2}],p={toc:u};function m(e){let{components:t,...l}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,l,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"deliver-the-wordpress-application-with-cloud-rds"},"Deliver the WordPress Application with Cloud RDS"),(0,r.kt)("p",null,"This tutorial will demonstrate how to deploy a WordPress application with Kusion, which relies on both Kubernetes and IaaS resources provided by cloud vendors. We can learn how to declare the Relational Database Service (RDS) to provide a cloud-based database solution with Kusion for our application from this article. "),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"/docs/getting-started/install-kusion"},"Kusion"),". "),(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/tasks/tools/#kubectl"},"kubectl CLI")," and run a ",(0,r.kt)("a",{parentName:"li",href:"https://kubernetes.io/"},"Kubernetes")," or ",(0,r.kt)("a",{parentName:"li",href:"https://docs.k3s.io/quick-start"},"k3s")," or ",(0,r.kt)("a",{parentName:"li",href:"https://k3d.io/v5.4.4/#installation"},"k3d")," or ",(0,r.kt)("a",{parentName:"li",href:"https://minikube.sigs.k8s.io/docs/tutorials/multi_node"},"MiniKube")," cluster. "),(0,r.kt)("li",{parentName:"ul"},"Prepare a cloud service account and create a user with at least ",(0,r.kt)("strong",{parentName:"li"},"VPCFullAccess")," and ",(0,r.kt)("strong",{parentName:"li"},"RDSFullAccess")," related permissions to use the Relational Database Service (RDS). This kind of user can be created and managed in the Identity and Access Management (IAM) console of the cloud vendor. "),(0,r.kt)("li",{parentName:"ul"},"The environment that executes ",(0,r.kt)("inlineCode",{parentName:"li"},"kusion")," needs to have connectivity to terraform registry to download the terraform providers. ")),(0,r.kt)("p",null,"Additionally, we also need to configure the obtained AccessKey and SecretKey as well as the cloud resource region as environment variables for specific cloud provider: "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'export AWS_ACCESS_KEY_ID="AKIAQZDxxxx" # replace it with your AccessKey\nexport AWS_SECRET_ACCESS_KEY="oE/xxxx" # replace it with your SecretKey\nexport AWS_REGION=us-east-1 # replace it with your region\n')),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"aws iam account",src:a(24838).Z,width:"2874",height:"1398"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'export ALICLOUD_ACCESS_KEY="LTAI5txxx" # replace it with your AccessKey\nexport ALICLOUD_SECRET_KEY="nxuowIxxx" # replace it with your SecretKey\nexport ALICLOUD_REGION=cn-hangzhou # replace it with your region\n')),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"alicloud iam account",src:a(73725).Z,width:"1500",height:"629"})))),(0,r.kt)("h2",{id:"init-workspace"},"Init Workspace"),(0,r.kt)("p",null,"To deploy the WordPress application with cloud rds, we first need to initiate a ",(0,r.kt)("inlineCode",{parentName:"p"},"Workspace")," for the targeted stack (here we are using ",(0,r.kt)("inlineCode",{parentName:"p"},"dev"),"). Please copy the following example YAML file to your local ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),". "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'# MySQL configurations for AWS RDS\nmodules: \n kusionstack/mysql@0.1.0: \n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n privateRouting: false\n databaseName: "wordpress-mysql"\n'))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'# MySQL configurations for Alicloud RDS\nmodules: \n kusionstack/mysql@0.1.0: \n default: \n cloud: alicloud\n size: 20\n instanceType: mysql.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n databaseName: "wordpress-mysql"\n')))),(0,r.kt)("p",null,"If you would like to try creating the ",(0,r.kt)("inlineCode",{parentName:"p"},"Alicloud")," RDS instance, you should replace the ",(0,r.kt)("inlineCode",{parentName:"p"},"[your-subnet-id]")," of ",(0,r.kt)("inlineCode",{parentName:"p"},"modules.kusionstack/mysql@0.1.0.default.subnetID")," field with the Alicloud ",(0,r.kt)("inlineCode",{parentName:"p"},"vSwitchID")," to which the database will be provisioned in. After that, you can execute the following command line to initiate the configuration for ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace create dev -f workspace.yaml\n")),(0,r.kt)("p",null,"Since Kusion by default use the ",(0,r.kt)("inlineCode",{parentName:"p"},"default")," workspace, we can switch to the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace with the following cmd: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace switch dev\n")),(0,r.kt)("p",null,"If you have already created and used the configuration of ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace, you can append the MySQL module configs to your workspace YAML file and use the following command line to update the workspace configuration. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace update dev -f workspace.yaml\n")),(0,r.kt)("p",null,"We can use the following command lines to show the current workspace configurations for ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace show\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," is a sample configuration file for workspace management, including ",(0,r.kt)("inlineCode",{parentName:"p"},"MySQL")," module configs. Workspace configurations are usually declared by ",(0,r.kt)("strong",{parentName:"p"},"Platform Engineers")," and will take effect through the corresponding stack. "),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about the configuration of Workspace can be found in ",(0,r.kt)("a",{parentName:"p",href:"/docs/concepts/workspace"},"Concepts of Workspace"),". ")),(0,r.kt)("h2",{id:"create-project-and-stack"},"Create Project And Stack"),(0,r.kt)("p",null,"We can create a new project named ",(0,r.kt)("inlineCode",{parentName:"p"},"wordpress-rds-cloud")," with the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion project create")," command. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"# Create a new directory and navigate into it. \nmkdir wordpress-rds-cloud && cd wordpress-rds-cloud\n\n# Create a new project with the name of the current directory. \nkusion project create\n")),(0,r.kt)("p",null,"After creating the new project, we can create a new stack named ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," with the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion stack create")," command. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"# Create a new stack with the specified name under current project directory. \nkusion stack create dev\n")),(0,r.kt)("p",null,"The created project and stack structure looks like below: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"tree\n.\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n\n2 directories, 4 files\n")),(0,r.kt)("h3",{id:"update-and-review-configuration-codes"},"Update And Review Configuration Codes"),(0,r.kt)("p",null,"The configuration codes in the created stack are basically empty, thus we should replace the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/kcl.mod")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/main.k")," with the below codes: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},'# dev/kcl.mod\n[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\nmysql = { oci = "oci://ghcr.io/kusionstack/mysql", tag = "0.1.0" }\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'# dev/main.k \nimport kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\nimport mysql\n\n# main.k declares customized configurations for dev stacks.\nwordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n wordpress: c.Container {\n image: "wordpress:6.3"\n env: {\n "WORDPRESS_DB_HOST": "$(KUSION_DB_HOST_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_NAME": "mysql"\n }\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n "mysql": mysql.MySQL {\n type: "cloud"\n version: "8.0"\n }\n }\n}\n')),(0,r.kt)("h2",{id:"application-delivery"},"Application Delivery"),(0,r.kt)("p",null,"You can complete the delivery of the WordPress application in the folder of ",(0,r.kt)("inlineCode",{parentName:"p"},"wordpress-cloud-rds/dev")," using the following command line. Kusion will enable the watching of the application resource creation and automatic port-forwarding of the specified port (80) from local to the Kubernetes Service. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"cd dev && kusion apply --watch\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"During the first apply, the models and modules as well as the Terraform CLI (if not exists) that the application depends on will be downloaded, so it may take some time (usually within two minutes). You can take a break and have a cup of coffee. ")),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply the wordpress application with aws rds",src:a(5721).Z,width:"2874",height:"802"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply the wordpress application with alicloud rds",src:a(91609).Z,width:"2876",height:"858"})))),(0,r.kt)("p",null,"After all the resources reconciled, we can port-forward our local port (e.g. 12345) to the WordPress frontend service port (80) in the cluster:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kubectl port-forward -n wordpress-cloud-rds svc/wordpress-cloud-rds-dev-wordpress-private 12345:80\n")),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kubectl port-forward for wordpress",src:a(76831).Z,width:"2874",height:"150"})),(0,r.kt)("h2",{id:"verify-wordpress-application"},"Verify WordPress Application"),(0,r.kt)("p",null,"Next, we will verify the WordPress site service we just delivered, along with the creation of the RDS instance it depends on. We can start using the WordPress site by accessing the link of local-forwarded port ",(0,r.kt)("a",{parentName:"p",href:"http://localhost:12345"},"(http://localhost:12345)")," we just configured in the browser. "),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"wordpress site page",src:a(85773).Z,width:"1500",height:"803"})),(0,r.kt)("p",null,"In addition, we can also log in to the cloud service console page to view the RDS instance we just created."),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"aws rds instance",src:a(42229).Z,width:"2298",height:"706"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"alicloud rds instance",src:a(99782).Z,width:"2870",height:"616"})))),(0,r.kt)("h2",{id:"delete-wordpress-application"},"Delete WordPress Application"),(0,r.kt)("p",null,"You can delete the WordPress application and related RDS resources using the following command line. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion destroy --yes\n")),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kusion destroy wordpress with aws rds",src:a(74068).Z,width:"2874",height:"788"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kusion destroy wordpress with alicloud rds",src:a(72557).Z,width:"2874",height:"820"})))))}m.isMDXComponent=!0},91609:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/apply-wordpress-cloud-rds-alicloud-14224502ce1c4d077fa1ed3777b1add9.png"},5721:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/apply-wordpress-cloud-rds-aws-9c72f8fd79000427958c5376085a65b8.png"},24838:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/aws-iam-account-2216105e7fa18fb2f7bf4be7e19f98bd.png"},99782:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/cloud-rds-instance-alicloud-e2062c7a477d445b3decf429105ab3d6.png"},42229:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/cloud-rds-instance-aws-64d6371851d55e05fb05353bbd9a19b1.png"},72557:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/destroy-wordpress-cloud-rds-alicloud-9c5da68051d92f6a8b3a11db9dd49273.png"},74068:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/destroy-wordpress-cloud-rds-aws-04a2cf44dbce1bcac488f8ce3dcdae81.png"},73725:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/set-rds-access-9347ae09377aeb94d9f6d1e5d8688ab5.png"},76831:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/wordpress-cloud-rds-port-forward-611c4f17d055d9ee941b9ff87a0727f5.png"},85773:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/wordpress-site-page-ef650e640399209d1eec5e6dfe88c454.png"}}]); \ No newline at end of file diff --git a/assets/js/18fa340a.da7036b2.js b/assets/js/18fa340a.da7036b2.js new file mode 100644 index 00000000000..755cd3458f9 --- /dev/null +++ b/assets/js/18fa340a.da7036b2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[440],{3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function s(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var i=n.createContext({}),c=function(e){var t=n.useContext(i),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},d=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},p=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),p=c(a),m=r,k=p["".concat(i,".").concat(m)]||p[m]||u[m]||o;return a?n.createElement(k,s(s({ref:t},d),{},{components:a})):n.createElement(k,s({ref:t},d))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=p;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,s[1]=l;for(var c=2;c{a.d(t,{Z:()=>s});var n=a(67294),r=a(86010);const o="tabItem_Ymn6";function s(e){let{children:t,hidden:a,className:s}=e;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(o,s),hidden:a},t)}},74866:(e,t,a)=>{a.d(t,{Z:()=>N});var n=a(87462),r=a(67294),o=a(86010),s=a(12466),l=a(76775),i=a(91980),c=a(67392),d=a(50012);function u(e){return function(e){var t;return(null==(t=r.Children.map(e,(e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})))?void 0:t.filter(Boolean))??[]}(e).map((e=>{let{props:{value:t,label:a,attributes:n,default:r}}=e;return{value:t,label:a,attributes:n,default:r}}))}function p(e){const{values:t,children:a}=e;return(0,r.useMemo)((()=>{const e=t??u(a);return function(e){const t=(0,c.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,a])}function m(e){let{value:t,tabValues:a}=e;return a.some((e=>e.value===t))}function k(e){let{queryString:t=!1,groupId:a}=e;const n=(0,l.k6)(),o=function(e){let{queryString:t=!1,groupId:a}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!a)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return a??null}({queryString:t,groupId:a});return[(0,i._X)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(n.location.search);t.set(o,e),n.replace({...n.location,search:t.toString()})}),[o,n])]}function h(e){const{defaultValue:t,queryString:a=!1,groupId:n}=e,o=p(e),[s,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:a}=e;if(0===a.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:a}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${a.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const n=a.find((e=>e.default))??a[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:o}))),[i,c]=k({queryString:a,groupId:n}),[u,h]=function(e){let{groupId:t}=e;const a=function(e){return e?`docusaurus.tab.${e}`:null}(t),[n,o]=(0,d.Nk)(a);return[n,(0,r.useCallback)((e=>{a&&o.set(e)}),[a,o])]}({groupId:n}),f=(()=>{const e=i??u;return m({value:e,tabValues:o})?e:null})();(0,r.useLayoutEffect)((()=>{f&&l(f)}),[f]);return{selectedValue:s,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),c(e),h(e)}),[c,h,o]),tabValues:o}}var f=a(72389);const w="tabList__CuJ",g="tabItem_LNqP";function b(e){let{className:t,block:a,selectedValue:l,selectValue:i,tabValues:c}=e;const d=[],{blockElementScrollPositionUntilNextRender:u}=(0,s.o5)(),p=e=>{const t=e.currentTarget,a=d.indexOf(t),n=c[a].value;n!==l&&(u(t),i(n))},m=e=>{var t;let a=null;switch(e.key){case"Enter":p(e);break;case"ArrowRight":{const t=d.indexOf(e.currentTarget)+1;a=d[t]??d[0];break}case"ArrowLeft":{const t=d.indexOf(e.currentTarget)-1;a=d[t]??d[d.length-1];break}}null==(t=a)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":a},t)},c.map((e=>{let{value:t,label:a,attributes:s}=e;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:l===t?0:-1,"aria-selected":l===t,key:t,ref:e=>d.push(e),onKeyDown:m,onClick:p},s,{className:(0,o.Z)("tabs__item",g,null==s?void 0:s.className,{"tabs__item--active":l===t})}),a??t)})))}function y(e){let{lazy:t,children:a,selectedValue:n}=e;const o=(Array.isArray(a)?a:[a]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===n));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==n}))))}function v(e){const t=h(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",w)},r.createElement(b,(0,n.Z)({},e,t)),r.createElement(y,(0,n.Z)({},e,t)))}function N(e){const t=(0,f.Z)();return r.createElement(v,(0,n.Z)({key:String(t)},e))}},59118:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>c,toc:()=>u});var n=a(87462),r=(a(67294),a(3905)),o=a(74866),s=a(85162);const l={id:"database"},i="Deliver the WordPress Application with Cloud RDS",c={unversionedId:"user-guides/cloud-resources/database",id:"version-v0.11/user-guides/cloud-resources/database",title:"Deliver the WordPress Application with Cloud RDS",description:"This tutorial will demonstrate how to deploy a WordPress application with Kusion, which relies on both Kubernetes and IaaS resources provided by cloud vendors. We can learn how to declare the Relational Database Service (RDS) to provide a cloud-based database solution with Kusion for our application from this article.",source:"@site/docs_versioned_docs/version-v0.11/5-user-guides/1-cloud-resources/1-database.md",sourceDirName:"5-user-guides/1-cloud-resources",slug:"/user-guides/cloud-resources/database",permalink:"/docs/user-guides/cloud-resources/database",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/5-user-guides/1-cloud-resources/1-database.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"database"},sidebar:"kusion",previous:{title:"Operational Rules",permalink:"/docs/configuration-walkthrough/operational-rules"},next:{title:"Expose Application Service Deployed on CSP Kubernetes",permalink:"/docs/user-guides/cloud-resources/expose-service"}},d={},u=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Init Workspace",id:"init-workspace",level:2},{value:"Create Project And Stack",id:"create-project-and-stack",level:2},{value:"Update And Review Configuration Codes",id:"update-and-review-configuration-codes",level:3},{value:"Application Delivery",id:"application-delivery",level:2},{value:"Verify WordPress Application",id:"verify-wordpress-application",level:2},{value:"Delete WordPress Application",id:"delete-wordpress-application",level:2}],p={toc:u};function m(e){let{components:t,...l}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,l,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"deliver-the-wordpress-application-with-cloud-rds"},"Deliver the WordPress Application with Cloud RDS"),(0,r.kt)("p",null,"This tutorial will demonstrate how to deploy a WordPress application with Kusion, which relies on both Kubernetes and IaaS resources provided by cloud vendors. We can learn how to declare the Relational Database Service (RDS) to provide a cloud-based database solution with Kusion for our application from this article. "),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"/docs/getting-started/install-kusion"},"Kusion"),". "),(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/tasks/tools/#kubectl"},"kubectl CLI")," and run a ",(0,r.kt)("a",{parentName:"li",href:"https://kubernetes.io/"},"Kubernetes")," or ",(0,r.kt)("a",{parentName:"li",href:"https://docs.k3s.io/quick-start"},"k3s")," or ",(0,r.kt)("a",{parentName:"li",href:"https://k3d.io/v5.4.4/#installation"},"k3d")," or ",(0,r.kt)("a",{parentName:"li",href:"https://minikube.sigs.k8s.io/docs/tutorials/multi_node"},"MiniKube")," cluster. "),(0,r.kt)("li",{parentName:"ul"},"Prepare a cloud service account and create a user with at least ",(0,r.kt)("strong",{parentName:"li"},"VPCFullAccess")," and ",(0,r.kt)("strong",{parentName:"li"},"RDSFullAccess")," related permissions to use the Relational Database Service (RDS). This kind of user can be created and managed in the Identity and Access Management (IAM) console of the cloud vendor. "),(0,r.kt)("li",{parentName:"ul"},"The environment that executes ",(0,r.kt)("inlineCode",{parentName:"li"},"kusion")," needs to have connectivity to terraform registry to download the terraform providers. ")),(0,r.kt)("p",null,"Additionally, we also need to configure the obtained AccessKey and SecretKey as well as the cloud resource region as environment variables for specific cloud provider: "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'export AWS_ACCESS_KEY_ID="AKIAQZDxxxx" # replace it with your AccessKey\nexport AWS_SECRET_ACCESS_KEY="oE/xxxx" # replace it with your SecretKey\nexport AWS_REGION=us-east-1 # replace it with your region\n')),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"aws iam account",src:a(24838).Z,width:"2874",height:"1398"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'export ALICLOUD_ACCESS_KEY="LTAI5txxx" # replace it with your AccessKey\nexport ALICLOUD_SECRET_KEY="nxuowIxxx" # replace it with your SecretKey\nexport ALICLOUD_REGION=cn-hangzhou # replace it with your region\n')),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"alicloud iam account",src:a(73725).Z,width:"1500",height:"629"})))),(0,r.kt)("h2",{id:"init-workspace"},"Init Workspace"),(0,r.kt)("p",null,"To deploy the WordPress application with cloud rds, we first need to initiate a ",(0,r.kt)("inlineCode",{parentName:"p"},"Workspace")," for the targeted stack (here we are using ",(0,r.kt)("inlineCode",{parentName:"p"},"dev"),"). Please copy the following example YAML file to your local ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),". "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'# MySQL configurations for AWS RDS\nmodules: \n kusionstack/mysql@0.1.0: \n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n privateRouting: false\n databaseName: "wordpress-mysql"\n'))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'# MySQL configurations for Alicloud RDS\nmodules: \n kusionstack/mysql@0.1.0: \n default: \n cloud: alicloud\n size: 20\n instanceType: mysql.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n databaseName: "wordpress-mysql"\n')))),(0,r.kt)("p",null,"If you would like to try creating the ",(0,r.kt)("inlineCode",{parentName:"p"},"Alicloud")," RDS instance, you should replace the ",(0,r.kt)("inlineCode",{parentName:"p"},"[your-subnet-id]")," of ",(0,r.kt)("inlineCode",{parentName:"p"},"modules.kusionstack/mysql@0.1.0.default.subnetID")," field with the Alicloud ",(0,r.kt)("inlineCode",{parentName:"p"},"vSwitchID")," to which the database will be provisioned in. After that, you can execute the following command line to initiate the configuration for ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace create dev -f workspace.yaml\n")),(0,r.kt)("p",null,"Since Kusion by default use the ",(0,r.kt)("inlineCode",{parentName:"p"},"default")," workspace, we can switch to the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace with the following cmd: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace switch dev\n")),(0,r.kt)("p",null,"If you have already created and used the configuration of ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace, you can append the MySQL module configs to your workspace YAML file and use the following command line to update the workspace configuration. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace update dev -f workspace.yaml\n")),(0,r.kt)("p",null,"We can use the following command lines to show the current workspace configurations for ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace show\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," is a sample configuration file for workspace management, including ",(0,r.kt)("inlineCode",{parentName:"p"},"MySQL")," module configs. Workspace configurations are usually declared by ",(0,r.kt)("strong",{parentName:"p"},"Platform Engineers")," and will take effect through the corresponding stack. "),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about the configuration of Workspace can be found in ",(0,r.kt)("a",{parentName:"p",href:"/docs/concepts/workspace"},"Concepts of Workspace"),". ")),(0,r.kt)("h2",{id:"create-project-and-stack"},"Create Project And Stack"),(0,r.kt)("p",null,"We can create a new project named ",(0,r.kt)("inlineCode",{parentName:"p"},"wordpress-rds-cloud")," with the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion project create")," command. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"# Create a new directory and navigate into it. \nmkdir wordpress-rds-cloud && cd wordpress-rds-cloud\n\n# Create a new project with the name of the current directory. \nkusion project create\n")),(0,r.kt)("p",null,"After creating the new project, we can create a new stack named ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," with the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion stack create")," command. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"# Create a new stack with the specified name under current project directory. \nkusion stack create dev\n")),(0,r.kt)("p",null,"The created project and stack structure looks like below: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"tree\n.\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n\n2 directories, 4 files\n")),(0,r.kt)("h3",{id:"update-and-review-configuration-codes"},"Update And Review Configuration Codes"),(0,r.kt)("p",null,"The configuration codes in the created stack are basically empty, thus we should replace the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/kcl.mod")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/main.k")," with the below codes: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},'# dev/kcl.mod\n[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\nmysql = { oci = "oci://ghcr.io/kusionstack/mysql", tag = "0.1.0" }\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'# dev/main.k \nimport kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\nimport mysql\n\n# main.k declares customized configurations for dev stacks.\nwordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n wordpress: c.Container {\n image: "wordpress:6.3"\n env: {\n "WORDPRESS_DB_HOST": "$(KUSION_DB_HOST_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_NAME": "mysql"\n }\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n "mysql": mysql.MySQL {\n type: "cloud"\n version: "8.0"\n }\n }\n}\n')),(0,r.kt)("h2",{id:"application-delivery"},"Application Delivery"),(0,r.kt)("p",null,"You can complete the delivery of the WordPress application in the folder of ",(0,r.kt)("inlineCode",{parentName:"p"},"wordpress-cloud-rds/dev")," using the following command line. Kusion will enable the watching of the application resource creation and automatic port-forwarding of the specified port (80) from local to the Kubernetes Service. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"cd dev && kusion apply --watch\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"During the first apply, the models and modules as well as the Terraform CLI (if not exists) that the application depends on will be downloaded, so it may take some time (usually within two minutes). You can take a break and have a cup of coffee. ")),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply the wordpress application with aws rds",src:a(5721).Z,width:"2874",height:"802"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply the wordpress application with alicloud rds",src:a(91609).Z,width:"2876",height:"858"})))),(0,r.kt)("p",null,"After all the resources reconciled, we can port-forward our local port (e.g. 12345) to the WordPress frontend service port (80) in the cluster:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kubectl port-forward -n wordpress-cloud-rds svc/wordpress-cloud-rds-dev-wordpress-private 12345:80\n")),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kubectl port-forward for wordpress",src:a(76831).Z,width:"2874",height:"150"})),(0,r.kt)("h2",{id:"verify-wordpress-application"},"Verify WordPress Application"),(0,r.kt)("p",null,"Next, we will verify the WordPress site service we just delivered, along with the creation of the RDS instance it depends on. We can start using the WordPress site by accessing the link of local-forwarded port ",(0,r.kt)("a",{parentName:"p",href:"http://localhost:12345"},"(http://localhost:12345)")," we just configured in the browser. "),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"wordpress site page",src:a(85773).Z,width:"1500",height:"803"})),(0,r.kt)("p",null,"In addition, we can also log in to the cloud service console page to view the RDS instance we just created."),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"aws rds instance",src:a(42229).Z,width:"2298",height:"706"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"alicloud rds instance",src:a(99782).Z,width:"2870",height:"616"})))),(0,r.kt)("h2",{id:"delete-wordpress-application"},"Delete WordPress Application"),(0,r.kt)("p",null,"You can delete the WordPress application and related RDS resources using the following command line. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion destroy --yes\n")),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kusion destroy wordpress with aws rds",src:a(74068).Z,width:"2874",height:"788"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kusion destroy wordpress with alicloud rds",src:a(72557).Z,width:"2874",height:"820"})))))}m.isMDXComponent=!0},91609:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/apply-wordpress-cloud-rds-alicloud-14224502ce1c4d077fa1ed3777b1add9.png"},5721:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/apply-wordpress-cloud-rds-aws-9c72f8fd79000427958c5376085a65b8.png"},24838:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/aws-iam-account-2216105e7fa18fb2f7bf4be7e19f98bd.png"},99782:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/cloud-rds-instance-alicloud-e2062c7a477d445b3decf429105ab3d6.png"},42229:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/cloud-rds-instance-aws-64d6371851d55e05fb05353bbd9a19b1.png"},72557:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/destroy-wordpress-cloud-rds-alicloud-9c5da68051d92f6a8b3a11db9dd49273.png"},74068:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/destroy-wordpress-cloud-rds-aws-04a2cf44dbce1bcac488f8ce3dcdae81.png"},73725:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/set-rds-access-9347ae09377aeb94d9f6d1e5d8688ab5.png"},76831:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/wordpress-cloud-rds-port-forward-611c4f17d055d9ee941b9ff87a0727f5.png"},85773:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/wordpress-site-page-ef650e640399209d1eec5e6dfe88c454.png"}}]); \ No newline at end of file diff --git a/assets/js/194f885d.950b5f7d.js b/assets/js/194f885d.950b5f7d.js deleted file mode 100644 index 3ab2e92e8ae..00000000000 --- a/assets/js/194f885d.950b5f7d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9315],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var o=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function r(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var p=o.createContext({}),s=function(e){var n=o.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):r(r({},n),e)),t},c=function(e){var n=s(e.components);return o.createElement(p.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},u=o.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(t),m=a,k=u["".concat(p,".").concat(m)]||u[m]||d[m]||i;return t?o.createElement(k,r(r({ref:n},c),{},{components:t})):o.createElement(k,r({ref:n},c))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,r=new Array(i);r[0]=u;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:a,r[1]=l;for(var s=2;s{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>r,default:()=>d,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var o=t(87462),a=(t(67294),t(3905));const i={sidebar_position:4},r="Workload",l={unversionedId:"config-walkthrough/workload",id:"version-v0.9/config-walkthrough/workload",title:"Workload",description:"The workload attribute in the AppConfiguration instance is used to describe the specification for the application workload. The application workload generally represents the computing component for the application. It is the only required field when instantiating an AppConfiguration.",source:"@site/docs_versioned_docs/version-v0.9/config-walkthrough/workload.md",sourceDirName:"config-walkthrough",slug:"/config-walkthrough/workload",permalink:"/docs/v0.9/config-walkthrough/workload",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/config-walkthrough/workload.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:4,frontMatter:{sidebar_position:4},sidebar:"kusion",previous:{title:"Base and Override",permalink:"/docs/v0.9/config-walkthrough/base_override"},next:{title:"Application Networking",permalink:"/docs/v0.9/config-walkthrough/networking"}},p={},s=[{value:"Table of Content",id:"table-of-content",level:2},{value:"Import",id:"import",level:2},{value:"Types of Workloads",id:"types-of-workloads",level:2},{value:"Configure containers",id:"configure-containers",level:2},{value:"Application image",id:"application-image",level:3},{value:"Resource Requirements",id:"resource-requirements",level:3},{value:"Health Probes",id:"health-probes",level:3},{value:"Lifecycle Hooks",id:"lifecycle-hooks",level:3},{value:"Create Files",id:"create-files",level:3},{value:"Customize container initialization",id:"customize-container-initialization",level:3},{value:"Configure Replicas",id:"configure-replicas",level:2},{value:"Differences between Services and Jobs",id:"differences-between-services-and-jobs",level:2},{value:"Exposure",id:"exposure",level:3},{value:"Workload Implementations",id:"workload-implementations",level:3},{value:"Job Schedule",id:"job-schedule",level:3},{value:"Workload References",id:"workload-references",level:2}],c={toc:s};function d(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,o.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"workload"},"Workload"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," attribute in the ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance is used to describe the specification for the application workload. The application workload generally represents the computing component for the application. It is the only required field when instantiating an ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),"."),(0,a.kt)("p",null,"A ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," maps to an ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance 1:1. If there are more than one workload, they should be considered different applications."),(0,a.kt)("h2",{id:"table-of-content"},"Table of Content"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#import"},"Import")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#types-of-workloads"},"Types of workloads")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#configure-containers"},"Configure containers"),(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#application-image"},"Application image")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#resource-requirements"},"Resource Requirements")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#health-probes"},"Health Probes")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#lifecycle-hooks"},"Lifecycle Hooks")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#create-files"},"Create Files")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#customize-container-initialization"},"Customize container initialization")))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#configure-replicas"},"Configure Replicas")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#differences-between-services-and-jobs"},"Differences between Services and Jobs")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#workload-references"},"Workload References"))),(0,a.kt)("h2",{id:"import"},"Import"),(0,a.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,a.kt)("inlineCode",{parentName:"p"},"catalog")," package. For more details on KCL package import, please refer to the ",(0,a.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.container.lifecycle as lc\n")),(0,a.kt)("h2",{id:"types-of-workloads"},"Types of Workloads"),(0,a.kt)("p",null,"There are currently two types of workloads defined in the ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Service"),', representing a long-running, scalable workload type that should "never" go down and respond to short-lived latency-sensitive requests. This workload type is commonly used for web applications and services that expose APIs.'),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Job"),", representing batch tasks that take from a few seconds to days to complete and then stop. These are commonly used for batch processing that is less sensitive to short-term performance fluctuations.")),(0,a.kt)("p",null,"To instantiate a ",(0,a.kt)("inlineCode",{parentName:"p"},"Service"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {}\n}\n")),(0,a.kt)("p",null,"To instantiate a ",(0,a.kt)("inlineCode",{parentName:"p"},"Job"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Job {}\n}\n")),(0,a.kt)("p",null,"Of course, the ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instances above is not sufficient to describe an application. We still need to provide more details in the ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," section."),(0,a.kt)("h2",{id:"configure-containers"},"Configure containers"),(0,a.kt)("p",null,"Kusion is built on top of cloud-native philosophies. One of which is that applications should run as loosely coupled microservices on abstract and self-contained software units, such as containers."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"containers")," attribute in a workload instance is used to define the behavior for the containers that run application workload. The ",(0,a.kt)("inlineCode",{parentName:"p"},"containers")," attribute is a map, from the name of the container to the ",(0,a.kt)("inlineCode",{parentName:"p"},"catalog.models.schema.v1.workload.container.Container")," Object which includes the container configurations."),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"The name of the container is in the context of the configuration file, so you could refer to it later. It's not referring to the name of the container in the Kubernetes cluster (or any other runtime).")),(0,a.kt)("p",null,"Everything defined in the ",(0,a.kt)("inlineCode",{parentName:"p"},"containers")," attribute is considered an application container, as opposed to a sidecar container. Sidecar containers will be introduced in a different attribute in a future version."),(0,a.kt)("p",null,"In most of the cases, only one application container is needed. Ideally, we recommend mapping an ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance to a microservice in the microservice terminology."),(0,a.kt)("p",null,"We will walkthrough the details of configuring a container using an example of the ",(0,a.kt)("inlineCode",{parentName:"p"},"Service")," type."),(0,a.kt)("p",null,"To add an application container:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {}\n }\n }\n}\n')),(0,a.kt)("h3",{id:"application-image"},"Application image"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"image")," attribute in the ",(0,a.kt)("inlineCode",{parentName:"p"},"Container")," schema specifies the application image to run. This is the only required field in the ",(0,a.kt)("inlineCode",{parentName:"p"},"Container")," schema."),(0,a.kt)("p",null,"To specify an application image:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n }\n # ...\n }\n }\n}\n')),(0,a.kt)("h3",{id:"resource-requirements"},"Resource Requirements"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"resources")," attribute in the ",(0,a.kt)("inlineCode",{parentName:"p"},"Container")," schema specifies the application resource requirements such as cpu and memory."),(0,a.kt)("p",null,"You can specify an upper limit (which maps to resource limits only) or a range as the resource requirements (which maps to resource requests and limits in Kubernetes)."),(0,a.kt)("p",null,"To specify an upper bound (only resource limits):"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n # ...\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"To specify a range (both resource requests and limits):"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # Sets requests to cpu=250m and memory=256Mi\n # Sets limits to cpu=500m and memory=512Mi\n resources: {\n "cpu": "250m-500m"\n "memory": "256Mi-512Mi"\n }\n # ...\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"health-probes"},"Health Probes"),(0,a.kt)("p",null,"There are three types of ",(0,a.kt)("inlineCode",{parentName:"p"},"Probe")," defined in a ",(0,a.kt)("inlineCode",{parentName:"p"},"Container"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"livenessProbe")," - used to determine if the container is healthy and running"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"readinessProbe")," - used to determine if the container is ready to accept traffic"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"startupProbe")," - used to determine if the container has started properly. Liveness and readiness probes don't start until ",(0,a.kt)("inlineCode",{parentName:"li"},"startupProbe")," succeeds. Commonly used for containers that takes a while to start")),(0,a.kt)("p",null,"The probes are optional. You can only have one Probe of each kind for a given ",(0,a.kt)("inlineCode",{parentName:"p"},"Container"),"."),(0,a.kt)("p",null,"To configure a ",(0,a.kt)("inlineCode",{parentName:"p"},"Http")," type ",(0,a.kt)("inlineCode",{parentName:"p"},"readinessProbe")," that probes the health via HTTP request and a ",(0,a.kt)("inlineCode",{parentName:"p"},"Exec")," type ",(0,a.kt)("inlineCode",{parentName:"p"},"livenessProbe")," which executes a command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # ...\n # Configure an Http type readiness probe at /healthz\n readinessProbe: p.Probe {\n probeHandler: p.Http {\n url: "/healthz"\n }\n initialDelaySeconds: 10\n timeoutSeconds: 5\n periodSeconds: 15\n successThreshold: 3\n failureThreshold: 1\n }\n # Configure an Exec type liveness probe that executes probe.sh\n livenessProbe: p.Probe {\n probeHandler: p.Exec {\n command: ["probe.sh"]\n }\n initialDelaySeconds: 10\n }\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"lifecycle-hooks"},"Lifecycle Hooks"),(0,a.kt)("p",null,"You can also configure lifecycle hooks that triggers in response to container lifecycle events such as liveness/startup probe failure, preemption, resource contention, etc."),(0,a.kt)("p",null,"There are two types that is currently supported:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"PreStop")," - triggers before the container is terminated."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"PostStart")," - triggers after the container is initialized.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # ...\n # Configure lifecycle hooks\n lifecycle: lc.Lifecycle {\n # Configures an Exec type pre-stop hook that executes preStop.sh\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n # Configures an Http type pre-stop hook at /post-start\n postStart: p.Http {\n url: "/post-start"\n }\n }\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"create-files"},"Create Files"),(0,a.kt)("p",null,"You can also create files on-demand during the container initialization."),(0,a.kt)("p",null,"To create a custom file and mount it to ",(0,a.kt)("inlineCode",{parentName:"p"},"/home/admin/my-file")," when the container starts:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n }\n # ...\n # Creates a file during container startup\n files: {\n "/home/admin/my-file": c.FileSpec {\n content: "some file contents"\n mode: "0777"\n }\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"customize-container-initialization"},"Customize container initialization"),(0,a.kt)("p",null,"You can also customize the container entrypoint via ",(0,a.kt)("inlineCode",{parentName:"p"},"command"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"args"),", and ",(0,a.kt)("inlineCode",{parentName:"p"},"workingDir"),". These should ",(0,a.kt)("strong",{parentName:"p"},"most likely not be required"),". In most of the cases, the entrypoint details should be baked into the application image itself."),(0,a.kt)("p",null,"To customize the container entrypoint:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # ...\n # This command will overwrite the entrypoint set in the image Dockerfile\n command: ["/usr/local/bin/my-init-script.sh"]\n # Extra arguments append to command defined above\n args: [\n "--log-dir=/home/my-app/logs"\n "--timeout=60s"\n ]\n # Run the command as defined above, in the directory "/tmp"\n workingDir: "/tmp"\n }\n }\n }\n}\n')),(0,a.kt)("h2",{id:"configure-replicas"},"Configure Replicas"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"replicas")," field in the ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," instance describes the number of identical copies to run at the same time. It is generally recommended to have multiple replicas in production environments to eliminate any single point of failure. In Kubernetes, this corresponds to the ",(0,a.kt)("inlineCode",{parentName:"p"},"spec.replicas")," field in the relevant workload manifests."),(0,a.kt)("p",null,"To configure a workload to have a replica count of 3:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n # ...\n }\n replicas: 3\n # ...\n }\n # ...\n}\n")),(0,a.kt)("p",null,"Autoscaling will be supported in a future version of Kusion, at which point you will be able to specify a range of replicas."),(0,a.kt)("h2",{id:"differences-between-services-and-jobs"},"Differences between Services and Jobs"),(0,a.kt)("p",null,"The two types of workloads, namely ",(0,a.kt)("inlineCode",{parentName:"p"},"Service")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"Job"),", share a majority of the attributes with some minor differences."),(0,a.kt)("h3",{id:"exposure"},"Exposure"),(0,a.kt)("p",null,"A ",(0,a.kt)("inlineCode",{parentName:"p"},"Service")," usually represents a long-running, scalable workload that responds to short-lived latency-sensitive requests and never go down. Hence a ",(0,a.kt)("inlineCode",{parentName:"p"},"Service")," has an additional attribute that determines how it is exposed and can be accessed. A ",(0,a.kt)("inlineCode",{parentName:"p"},"Job")," does NOT the option to be exposed. We will explore more in the ",(0,a.kt)("a",{parentName:"p",href:"networking"},"application networking walkthrough"),"."),(0,a.kt)("h3",{id:"workload-implementations"},"Workload Implementations"),(0,a.kt)("p",null,"Kusion also supports multiple kinds of Kubernetes workload implementations for a ",(0,a.kt)("inlineCode",{parentName:"p"},"Service")," type workload. The current supported kinds are ",(0,a.kt)("inlineCode",{parentName:"p"},"Deployment"),"(default) and ",(0,a.kt)("inlineCode",{parentName:"p"},"CollaSet"),", which is a workload type defined in the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/operating"},"KusionStack-operating toolkit")," under the KusionStack family. You can learn more about ",(0,a.kt)("inlineCode",{parentName:"p"},"CollaSet")," ",(0,a.kt)("a",{parentName:"p",href:"https://kusionstack.io/"},"here"),"."),(0,a.kt)("p",null,"To specify a ",(0,a.kt)("inlineCode",{parentName:"p"},"CollaSet")," kind ",(0,a.kt)("inlineCode",{parentName:"p"},"Service"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n type: "CollaSet"\n # ...\n }\n}\n')),(0,a.kt)("p",null,"If ",(0,a.kt)("inlineCode",{parentName:"p"},"type")," is not provided, Kusion defaults to use the Kubernetes ",(0,a.kt)("inlineCode",{parentName:"p"},"Deployment"),"."),(0,a.kt)("h3",{id:"job-schedule"},"Job Schedule"),(0,a.kt)("p",null,"A ",(0,a.kt)("inlineCode",{parentName:"p"},"Job")," can be configured to run in a recurring manner. In this case, the job will have a cron-format schedule that represents its recurring schedule."),(0,a.kt)("p",null,"To configure a job to run at 21:00 every night:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: wl.Job {\n containers: {\n # ...\n }\n schedule: "0 21 * * *"\n }\n')),(0,a.kt)("h2",{id:"workload-references"},"Workload References"),(0,a.kt)("p",null,"You can find workload references ",(0,a.kt)("a",{parentName:"p",href:"../reference/model/catalog_models/workload/doc_service"},"here"),"."),(0,a.kt)("p",null,"You can find workload schema source ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog/tree/main/models/schema/v1/workload"},"here"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/194f885d.b56556c2.js b/assets/js/194f885d.b56556c2.js new file mode 100644 index 00000000000..9d1c53cd650 --- /dev/null +++ b/assets/js/194f885d.b56556c2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9315],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function r(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=a.createContext({}),s=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):r(r({},n),e)),t},c=function(e){var n=s(e.components);return a.createElement(p.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(t),m=o,k=u["".concat(p,".").concat(m)]||u[m]||d[m]||i;return t?a.createElement(k,r(r({ref:n},c),{},{components:t})):a.createElement(k,r({ref:n},c))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,r=new Array(i);r[0]=u;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:o,r[1]=l;for(var s=2;s{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>r,default:()=>d,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var a=t(87462),o=(t(67294),t(3905));const i={sidebar_position:4},r="Workload",l={unversionedId:"config-walkthrough/workload",id:"version-v0.9/config-walkthrough/workload",title:"Workload",description:"The workload attribute in the AppConfiguration instance is used to describe the specification for the application workload. The application workload generally represents the computing component for the application. It is the only required field when instantiating an AppConfiguration.",source:"@site/docs_versioned_docs/version-v0.9/config-walkthrough/workload.md",sourceDirName:"config-walkthrough",slug:"/config-walkthrough/workload",permalink:"/docs/v0.9/config-walkthrough/workload",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/config-walkthrough/workload.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:4,frontMatter:{sidebar_position:4},sidebar:"kusion",previous:{title:"Base and Override",permalink:"/docs/v0.9/config-walkthrough/base_override"},next:{title:"Application Networking",permalink:"/docs/v0.9/config-walkthrough/networking"}},p={},s=[{value:"Table of Content",id:"table-of-content",level:2},{value:"Import",id:"import",level:2},{value:"Types of Workloads",id:"types-of-workloads",level:2},{value:"Configure containers",id:"configure-containers",level:2},{value:"Application image",id:"application-image",level:3},{value:"Resource Requirements",id:"resource-requirements",level:3},{value:"Health Probes",id:"health-probes",level:3},{value:"Lifecycle Hooks",id:"lifecycle-hooks",level:3},{value:"Create Files",id:"create-files",level:3},{value:"Customize container initialization",id:"customize-container-initialization",level:3},{value:"Configure Replicas",id:"configure-replicas",level:2},{value:"Differences between Services and Jobs",id:"differences-between-services-and-jobs",level:2},{value:"Exposure",id:"exposure",level:3},{value:"Workload Implementations",id:"workload-implementations",level:3},{value:"Job Schedule",id:"job-schedule",level:3},{value:"Workload References",id:"workload-references",level:2}],c={toc:s};function d(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"workload"},"Workload"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"workload")," attribute in the ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance is used to describe the specification for the application workload. The application workload generally represents the computing component for the application. It is the only required field when instantiating an ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),"."),(0,o.kt)("p",null,"A ",(0,o.kt)("inlineCode",{parentName:"p"},"workload")," maps to an ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance 1:1. If there are more than one workload, they should be considered different applications."),(0,o.kt)("h2",{id:"table-of-content"},"Table of Content"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#import"},"Import")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#types-of-workloads"},"Types of workloads")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#configure-containers"},"Configure containers"),(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#application-image"},"Application image")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#resource-requirements"},"Resource Requirements")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#health-probes"},"Health Probes")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#lifecycle-hooks"},"Lifecycle Hooks")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#create-files"},"Create Files")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#customize-container-initialization"},"Customize container initialization")))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#configure-replicas"},"Configure Replicas")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#differences-between-services-and-jobs"},"Differences between Services and Jobs")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#workload-references"},"Workload References"))),(0,o.kt)("h2",{id:"import"},"Import"),(0,o.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,o.kt)("inlineCode",{parentName:"p"},"catalog")," package. For more details on KCL package import, please refer to the ",(0,o.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.container.lifecycle as lc\n")),(0,o.kt)("h2",{id:"types-of-workloads"},"Types of Workloads"),(0,o.kt)("p",null,"There are currently two types of workloads defined in the ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"Service"),', representing a long-running, scalable workload type that should "never" go down and respond to short-lived latency-sensitive requests. This workload type is commonly used for web applications and services that expose APIs.'),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"Job"),", representing batch tasks that take from a few seconds to days to complete and then stop. These are commonly used for batch processing that is less sensitive to short-term performance fluctuations.")),(0,o.kt)("p",null,"To instantiate a ",(0,o.kt)("inlineCode",{parentName:"p"},"Service"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {}\n}\n")),(0,o.kt)("p",null,"To instantiate a ",(0,o.kt)("inlineCode",{parentName:"p"},"Job"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Job {}\n}\n")),(0,o.kt)("p",null,"Of course, the ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instances above is not sufficient to describe an application. We still need to provide more details in the ",(0,o.kt)("inlineCode",{parentName:"p"},"workload")," section."),(0,o.kt)("h2",{id:"configure-containers"},"Configure containers"),(0,o.kt)("p",null,"Kusion is built on top of cloud-native philosophies. One of which is that applications should run as loosely coupled microservices on abstract and self-contained software units, such as containers."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"containers")," attribute in a workload instance is used to define the behavior for the containers that run application workload. The ",(0,o.kt)("inlineCode",{parentName:"p"},"containers")," attribute is a map, from the name of the container to the ",(0,o.kt)("inlineCode",{parentName:"p"},"catalog.models.schema.v1.workload.container.Container")," Object which includes the container configurations."),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"The name of the container is in the context of the configuration file, so you could refer to it later. It's not referring to the name of the container in the Kubernetes cluster (or any other runtime).")),(0,o.kt)("p",null,"Everything defined in the ",(0,o.kt)("inlineCode",{parentName:"p"},"containers")," attribute is considered an application container, as opposed to a sidecar container. Sidecar containers will be introduced in a different attribute in a future version."),(0,o.kt)("p",null,"In most of the cases, only one application container is needed. Ideally, we recommend mapping an ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance to a microservice in the microservice terminology."),(0,o.kt)("p",null,"We will walkthrough the details of configuring a container using an example of the ",(0,o.kt)("inlineCode",{parentName:"p"},"Service")," type."),(0,o.kt)("p",null,"To add an application container:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {}\n }\n }\n}\n')),(0,o.kt)("h3",{id:"application-image"},"Application image"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"image")," attribute in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Container")," schema specifies the application image to run. This is the only required field in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Container")," schema."),(0,o.kt)("p",null,"To specify an application image:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n }\n # ...\n }\n }\n}\n')),(0,o.kt)("h3",{id:"resource-requirements"},"Resource Requirements"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"resources")," attribute in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Container")," schema specifies the application resource requirements such as cpu and memory."),(0,o.kt)("p",null,"You can specify an upper limit (which maps to resource limits only) or a range as the resource requirements (which maps to resource requests and limits in Kubernetes)."),(0,o.kt)("p",null,"To specify an upper bound (only resource limits):"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n # ...\n }\n }\n }\n}\n')),(0,o.kt)("p",null,"To specify a range (both resource requests and limits):"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # Sets requests to cpu=250m and memory=256Mi\n # Sets limits to cpu=500m and memory=512Mi\n resources: {\n "cpu": "250m-500m"\n "memory": "256Mi-512Mi"\n }\n # ...\n }\n }\n }\n}\n')),(0,o.kt)("h3",{id:"health-probes"},"Health Probes"),(0,o.kt)("p",null,"There are three types of ",(0,o.kt)("inlineCode",{parentName:"p"},"Probe")," defined in a ",(0,o.kt)("inlineCode",{parentName:"p"},"Container"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"livenessProbe")," - used to determine if the container is healthy and running"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"readinessProbe")," - used to determine if the container is ready to accept traffic"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"startupProbe")," - used to determine if the container has started properly. Liveness and readiness probes don't start until ",(0,o.kt)("inlineCode",{parentName:"li"},"startupProbe")," succeeds. Commonly used for containers that takes a while to start")),(0,o.kt)("p",null,"The probes are optional. You can only have one Probe of each kind for a given ",(0,o.kt)("inlineCode",{parentName:"p"},"Container"),"."),(0,o.kt)("p",null,"To configure a ",(0,o.kt)("inlineCode",{parentName:"p"},"Http")," type ",(0,o.kt)("inlineCode",{parentName:"p"},"readinessProbe")," that probes the health via HTTP request and a ",(0,o.kt)("inlineCode",{parentName:"p"},"Exec")," type ",(0,o.kt)("inlineCode",{parentName:"p"},"livenessProbe")," which executes a command:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # ...\n # Configure an Http type readiness probe at /healthz\n readinessProbe: p.Probe {\n probeHandler: p.Http {\n url: "/healthz"\n }\n initialDelaySeconds: 10\n timeoutSeconds: 5\n periodSeconds: 15\n successThreshold: 3\n failureThreshold: 1\n }\n # Configure an Exec type liveness probe that executes probe.sh\n livenessProbe: p.Probe {\n probeHandler: p.Exec {\n command: ["probe.sh"]\n }\n initialDelaySeconds: 10\n }\n }\n }\n }\n}\n')),(0,o.kt)("h3",{id:"lifecycle-hooks"},"Lifecycle Hooks"),(0,o.kt)("p",null,"You can also configure lifecycle hooks that triggers in response to container lifecycle events such as liveness/startup probe failure, preemption, resource contention, etc."),(0,o.kt)("p",null,"There are two types that is currently supported:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"PreStop")," - triggers before the container is terminated."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"PostStart")," - triggers after the container is initialized.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # ...\n # Configure lifecycle hooks\n lifecycle: lc.Lifecycle {\n # Configures an Exec type pre-stop hook that executes preStop.sh\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n # Configures an Http type pre-stop hook at /post-start\n postStart: p.Http {\n url: "/post-start"\n }\n }\n }\n }\n }\n}\n')),(0,o.kt)("h3",{id:"create-files"},"Create Files"),(0,o.kt)("p",null,"You can also create files on-demand during the container initialization."),(0,o.kt)("p",null,"To create a custom file and mount it to ",(0,o.kt)("inlineCode",{parentName:"p"},"/home/admin/my-file")," when the container starts:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n }\n # ...\n # Creates a file during container startup\n files: {\n "/home/admin/my-file": c.FileSpec {\n content: "some file contents"\n mode: "0777"\n }\n }\n }\n }\n}\n')),(0,o.kt)("h3",{id:"customize-container-initialization"},"Customize container initialization"),(0,o.kt)("p",null,"You can also customize the container entrypoint via ",(0,o.kt)("inlineCode",{parentName:"p"},"command"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"args"),", and ",(0,o.kt)("inlineCode",{parentName:"p"},"workingDir"),". These should ",(0,o.kt)("strong",{parentName:"p"},"most likely not be required"),". In most of the cases, the entrypoint details should be baked into the application image itself."),(0,o.kt)("p",null,"To customize the container entrypoint:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # ...\n # This command will overwrite the entrypoint set in the image Dockerfile\n command: ["/usr/local/bin/my-init-script.sh"]\n # Extra arguments append to command defined above\n args: [\n "--log-dir=/home/my-app/logs"\n "--timeout=60s"\n ]\n # Run the command as defined above, in the directory "/tmp"\n workingDir: "/tmp"\n }\n }\n }\n}\n')),(0,o.kt)("h2",{id:"configure-replicas"},"Configure Replicas"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"replicas")," field in the ",(0,o.kt)("inlineCode",{parentName:"p"},"workload")," instance describes the number of identical copies to run at the same time. It is generally recommended to have multiple replicas in production environments to eliminate any single point of failure. In Kubernetes, this corresponds to the ",(0,o.kt)("inlineCode",{parentName:"p"},"spec.replicas")," field in the relevant workload manifests."),(0,o.kt)("p",null,"To configure a workload to have a replica count of 3:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n # ...\n }\n replicas: 3\n # ...\n }\n # ...\n}\n")),(0,o.kt)("p",null,"Autoscaling will be supported in a future version of Kusion, at which point you will be able to specify a range of replicas."),(0,o.kt)("h2",{id:"differences-between-services-and-jobs"},"Differences between Services and Jobs"),(0,o.kt)("p",null,"The two types of workloads, namely ",(0,o.kt)("inlineCode",{parentName:"p"},"Service")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Job"),", share a majority of the attributes with some minor differences."),(0,o.kt)("h3",{id:"exposure"},"Exposure"),(0,o.kt)("p",null,"A ",(0,o.kt)("inlineCode",{parentName:"p"},"Service")," usually represents a long-running, scalable workload that responds to short-lived latency-sensitive requests and never go down. Hence a ",(0,o.kt)("inlineCode",{parentName:"p"},"Service")," has an additional attribute that determines how it is exposed and can be accessed. A ",(0,o.kt)("inlineCode",{parentName:"p"},"Job")," does NOT the option to be exposed. We will explore more in the ",(0,o.kt)("a",{parentName:"p",href:"networking"},"application networking walkthrough"),"."),(0,o.kt)("h3",{id:"workload-implementations"},"Workload Implementations"),(0,o.kt)("p",null,"Kusion also supports multiple kinds of Kubernetes workload implementations for a ",(0,o.kt)("inlineCode",{parentName:"p"},"Service")," type workload. The current supported kinds are ",(0,o.kt)("inlineCode",{parentName:"p"},"Deployment"),"(default) and ",(0,o.kt)("inlineCode",{parentName:"p"},"CollaSet"),", which is a workload type defined in the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/operating"},"KusionStack-operating toolkit")," under the KusionStack family. You can learn more about ",(0,o.kt)("inlineCode",{parentName:"p"},"CollaSet")," ",(0,o.kt)("a",{parentName:"p",href:"https://kusionstack.io/"},"here"),"."),(0,o.kt)("p",null,"To specify a ",(0,o.kt)("inlineCode",{parentName:"p"},"CollaSet")," kind ",(0,o.kt)("inlineCode",{parentName:"p"},"Service"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n type: "CollaSet"\n # ...\n }\n}\n')),(0,o.kt)("p",null,"If ",(0,o.kt)("inlineCode",{parentName:"p"},"type")," is not provided, Kusion defaults to use the Kubernetes ",(0,o.kt)("inlineCode",{parentName:"p"},"Deployment"),"."),(0,o.kt)("h3",{id:"job-schedule"},"Job Schedule"),(0,o.kt)("p",null,"A ",(0,o.kt)("inlineCode",{parentName:"p"},"Job")," can be configured to run in a recurring manner. In this case, the job will have a cron-format schedule that represents its recurring schedule."),(0,o.kt)("p",null,"To configure a job to run at 21:00 every night:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: wl.Job {\n containers: {\n # ...\n }\n schedule: "0 21 * * *"\n }\n')),(0,o.kt)("h2",{id:"workload-references"},"Workload References"),(0,o.kt)("p",null,"You can find workload references ",(0,o.kt)("a",{parentName:"p",href:"../reference/model/catalog_models/workload/doc_service"},"here"),"."),(0,o.kt)("p",null,"You can find workload schema source ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog/tree/main/models/schema/v1/workload"},"here"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/19556a9e.65609499.js b/assets/js/19556a9e.65609499.js deleted file mode 100644 index de7576c9c6c..00000000000 --- a/assets/js/19556a9e.65609499.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5870],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>u});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),p=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(i.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),m=p(n),u=r,g=m["".concat(i,".").concat(u)]||m[u]||c[u]||o;return n?a.createElement(g,l(l({ref:t},d),{},{components:n})):a.createElement(g,l({ref:t},d))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=m;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:r,l[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var a=n(87462),r=(n(67294),n(3905));const o={},l="postgres",s={unversionedId:"reference/modules/developer-schemas/database/postgres",id:"version-v0.11/reference/modules/developer-schemas/database/postgres",title:"postgres",description:"Schema PostgreSQL",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/database/postgres.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/database",slug:"/reference/modules/developer-schemas/database/postgres",permalink:"/docs/reference/modules/developer-schemas/database/postgres",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/database/postgres.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"mysql",permalink:"/docs/reference/modules/developer-schemas/database/mysql"},next:{title:"common",permalink:"/docs/reference/modules/developer-schemas/internal/common"}},i={},p=[{value:"Schema PostgreSQL",id:"schema-postgresql",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Credentials and Connectivity",id:"credentials-and-connectivity",level:3}],d={toc:p};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"postgres"},"postgres"),(0,r.kt)("h2",{id:"schema-postgresql"},"Schema PostgreSQL"),(0,r.kt)("p",null,"PostgreSQL describes the attributes to locally deploy or create a cloud provider",(0,r.kt)("br",null),"managed postgresql database instance for the workload. "),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},'"local"'),(0,r.kt)("td",{parentName:"tr",align:null},'"cloud"'),(0,r.kt)("td",{parentName:"tr",align:null},"Type defines whether the postgresql database is deployed locally or provided by",(0,r.kt)("br",null),"cloud vendor.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"version")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Version defines the postgres version to use."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'#Instantiate a local postgresql database with image version of 14.0. \n\nimport postgres as postgres\n\naccessories: {\n "postgres": postgres.PostgreSQL {\n type: "local"\n version: "14.0"\n }\n}\n')),(0,r.kt)("h3",{id:"credentials-and-connectivity"},"Credentials and Connectivity"),(0,r.kt)("p",null,"For sensitive information such as the ",(0,r.kt)("strong",{parentName:"p"},"host"),", ",(0,r.kt)("strong",{parentName:"p"},"username")," and ",(0,r.kt)("strong",{parentName:"p"},"password")," for the database instance, Kusion will automatically inject them into the application container for users through environment variables. The relevant environment variables are listed in the table below. "),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Explanation"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","HOST","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Host address for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","USERNAME","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Account username for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","PASSWORD","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Account password for accessing the database instance")))),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"databaseName")," can be declared in ",(0,r.kt)("a",{parentName:"p",href:"/docs/reference/modules/workspace-configs/database/postgres"},"workspace configs of postgres"),", and Kusion will automatically concatenate the ",(0,r.kt)("inlineCode",{parentName:"p"},""),", ",(0,r.kt)("inlineCode",{parentName:"p"},""),", ",(0,r.kt)("inlineCode",{parentName:"p"},"")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"postgres")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"-")," if not specified. When injecting the credentials into containers' environment variables, Kusion will convert the ",(0,r.kt)("inlineCode",{parentName:"p"},"databaseName")," to uppercase, and replace ",(0,r.kt)("inlineCode",{parentName:"p"},"-")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"_"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/19556a9e.a7c83650.js b/assets/js/19556a9e.a7c83650.js new file mode 100644 index 00000000000..bde586060b1 --- /dev/null +++ b/assets/js/19556a9e.a7c83650.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5870],{3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>u});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var i=n.createContext({}),p=function(e){var t=n.useContext(i),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},d=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),m=p(a),u=r,g=m["".concat(i,".").concat(u)]||m[u]||c[u]||o;return a?n.createElement(g,l(l({ref:t},d),{},{components:a})):n.createElement(g,l({ref:t},d))}));function u(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,l=new Array(o);l[0]=m;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:r,l[1]=s;for(var p=2;p{a.r(t),a.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var n=a(87462),r=(a(67294),a(3905));const o={},l="postgres",s={unversionedId:"reference/modules/developer-schemas/database/postgres",id:"version-v0.11/reference/modules/developer-schemas/database/postgres",title:"postgres",description:"Schema PostgreSQL",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/database/postgres.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/database",slug:"/reference/modules/developer-schemas/database/postgres",permalink:"/docs/reference/modules/developer-schemas/database/postgres",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/database/postgres.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"mysql",permalink:"/docs/reference/modules/developer-schemas/database/mysql"},next:{title:"common",permalink:"/docs/reference/modules/developer-schemas/internal/common"}},i={},p=[{value:"Schema PostgreSQL",id:"schema-postgresql",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Credentials and Connectivity",id:"credentials-and-connectivity",level:3}],d={toc:p};function c(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"postgres"},"postgres"),(0,r.kt)("h2",{id:"schema-postgresql"},"Schema PostgreSQL"),(0,r.kt)("p",null,"PostgreSQL describes the attributes to locally deploy or create a cloud provider",(0,r.kt)("br",null),"managed postgresql database instance for the workload. "),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},'"local"'),(0,r.kt)("td",{parentName:"tr",align:null},'"cloud"'),(0,r.kt)("td",{parentName:"tr",align:null},"Type defines whether the postgresql database is deployed locally or provided by",(0,r.kt)("br",null),"cloud vendor.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"version")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Version defines the postgres version to use."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'#Instantiate a local postgresql database with image version of 14.0. \n\nimport postgres as postgres\n\naccessories: {\n "postgres": postgres.PostgreSQL {\n type: "local"\n version: "14.0"\n }\n}\n')),(0,r.kt)("h3",{id:"credentials-and-connectivity"},"Credentials and Connectivity"),(0,r.kt)("p",null,"For sensitive information such as the ",(0,r.kt)("strong",{parentName:"p"},"host"),", ",(0,r.kt)("strong",{parentName:"p"},"username")," and ",(0,r.kt)("strong",{parentName:"p"},"password")," for the database instance, Kusion will automatically inject them into the application container for users through environment variables. The relevant environment variables are listed in the table below. "),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Explanation"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","HOST","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Host address for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","USERNAME","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Account username for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","PASSWORD","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Account password for accessing the database instance")))),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"databaseName")," can be declared in ",(0,r.kt)("a",{parentName:"p",href:"/docs/reference/modules/workspace-configs/database/postgres"},"workspace configs of postgres"),", and Kusion will automatically concatenate the ",(0,r.kt)("inlineCode",{parentName:"p"},""),", ",(0,r.kt)("inlineCode",{parentName:"p"},""),", ",(0,r.kt)("inlineCode",{parentName:"p"},"")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"postgres")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"-")," if not specified. When injecting the credentials into containers' environment variables, Kusion will convert the ",(0,r.kt)("inlineCode",{parentName:"p"},"databaseName")," to uppercase, and replace ",(0,r.kt)("inlineCode",{parentName:"p"},"-")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"_"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1961a063.a2b468e0.js b/assets/js/1961a063.a2b468e0.js new file mode 100644 index 00000000000..536c8754be5 --- /dev/null +++ b/assets/js/1961a063.a2b468e0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8025],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function r(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=a.createContext({}),s=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):r(r({},n),e)),t},c=function(e){var n=s(e.components);return a.createElement(p.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},d=a.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=s(t),m=o,k=d["".concat(p,".").concat(m)]||d[m]||u[m]||i;return t?a.createElement(k,r(r({ref:n},c),{},{components:t})):a.createElement(k,r({ref:n},c))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,r=new Array(i);r[0]=d;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:o,r[1]=l;for(var s=2;s{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>r,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var a=t(87462),o=(t(67294),t(3905));const i={},r="Workload",l={unversionedId:"configuration-walkthrough/workload",id:"configuration-walkthrough/workload",title:"Workload",description:"The workload attribute in the AppConfiguration instance is used to describe the specification for the application workload. The application workload generally represents the computing component for the application.",source:"@site/docs/kusion/4-configuration-walkthrough/4-workload.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/workload",permalink:"/docs/next/configuration-walkthrough/workload",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/4-configuration-walkthrough/4-workload.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:4,frontMatter:{},sidebar:"kusion",previous:{title:"Base and Override",permalink:"/docs/next/configuration-walkthrough/base-override"},next:{title:"Application Networking",permalink:"/docs/next/configuration-walkthrough/networking"}},p={},s=[{value:"Table of Content",id:"table-of-content",level:2},{value:"Import",id:"import",level:2},{value:"Types of Workloads",id:"types-of-workloads",level:2},{value:"Configure containers",id:"configure-containers",level:2},{value:"Application image",id:"application-image",level:3},{value:"Resource Requirements",id:"resource-requirements",level:3},{value:"Health Probes",id:"health-probes",level:3},{value:"Lifecycle Hooks",id:"lifecycle-hooks",level:3},{value:"Create Files",id:"create-files",level:3},{value:"Customize container initialization",id:"customize-container-initialization",level:3},{value:"Configure Replicas",id:"configure-replicas",level:2},{value:"Differences between Service and Job",id:"differences-between-service-and-job",level:2},{value:"Exposure",id:"exposure",level:3},{value:"Job Schedule",id:"job-schedule",level:3},{value:"Workload References",id:"workload-references",level:2}],c={toc:s};function u(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"workload"},"Workload"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"workload")," attribute in the ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance is used to describe the specification for the application workload. The application workload generally represents the computing component for the application."),(0,o.kt)("p",null,"A ",(0,o.kt)("inlineCode",{parentName:"p"},"workload")," maps to an ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance 1:1. If there are more than one workload, they should be considered different applications."),(0,o.kt)("h2",{id:"table-of-content"},"Table of Content"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#import"},"Import")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#types-of-workloads"},"Types of workloads")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#configure-containers"},"Configure containers"),(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#application-image"},"Application image")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#resource-requirements"},"Resource Requirements")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#health-probes"},"Health Probes")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#lifecycle-hooks"},"Lifecycle Hooks")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#create-files"},"Create Files")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#customize-container-initialization"},"Customize container initialization")))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#configure-replicas"},"Configure Replicas")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#differences-between-service-and-job"},"Differences between Service and Job")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#workload-references"},"Workload References"))),(0,o.kt)("h2",{id:"import"},"Import"),(0,o.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,o.kt)("inlineCode",{parentName:"p"},"catalog")," package. For more details on KCL package import, please refer to the ",(0,o.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport kam.v1.workload.container.probe as p\nimport kam.v1.workload.container.lifecycle as lc\n")),(0,o.kt)("h2",{id:"types-of-workloads"},"Types of Workloads"),(0,o.kt)("p",null,"There are currently two types of workloads:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"Service"),', representing a long-running, scalable workload type that should "never" go down and respond to short-lived latency-sensitive requests. This workload type is commonly used for web applications and services that expose APIs.'),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"Job"),", representing batch tasks that take from a few seconds to days to complete and then stop. These are commonly used for batch processing that is less sensitive to short-term performance fluctuations.")),(0,o.kt)("p",null,"To instantiate a ",(0,o.kt)("inlineCode",{parentName:"p"},"Service"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {}\n}\n")),(0,o.kt)("p",null,"To instantiate a ",(0,o.kt)("inlineCode",{parentName:"p"},"Job"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Job {}\n}\n")),(0,o.kt)("p",null,"Of course, the ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instances above is not sufficient to describe an application. We still need to provide more details in the ",(0,o.kt)("inlineCode",{parentName:"p"},"workload")," section."),(0,o.kt)("h2",{id:"configure-containers"},"Configure containers"),(0,o.kt)("p",null,"Kusion is built on top of cloud-native philosophies. One of which is that applications should run as loosely coupled microservices on abstract and self-contained software units, such as containers."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"containers")," attribute in a workload instance is used to define the behavior for the containers that run application workload. The ",(0,o.kt)("inlineCode",{parentName:"p"},"containers")," attribute is a map, from the name of the container to the ",(0,o.kt)("inlineCode",{parentName:"p"},"catalog.models.schema.v1.workload.container.Container")," Object which includes the container configurations."),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"The name of the container is in the context of the configuration file, so you could refer to it later. It's not referring to the name of the container in the Kubernetes cluster (or any other runtime).")),(0,o.kt)("p",null,"Everything defined in the ",(0,o.kt)("inlineCode",{parentName:"p"},"containers")," attribute is considered an application container, as opposed to a sidecar container. Sidecar containers will be introduced in a different attribute in a future version."),(0,o.kt)("p",null,"In most of the cases, only one application container is needed. Ideally, we recommend mapping an ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance to a microservice in the microservice terminology."),(0,o.kt)("p",null,"We will walk through the details of configuring a container using an example of the ",(0,o.kt)("inlineCode",{parentName:"p"},"Service")," type."),(0,o.kt)("p",null,"To add an application container:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {}\n }\n }\n}\n')),(0,o.kt)("h3",{id:"application-image"},"Application image"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"image")," attribute in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Container")," schema specifies the application image to run. This is the only required field in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Container")," schema."),(0,o.kt)("p",null,"To specify an application image:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n }\n # ...\n }\n }\n}\n')),(0,o.kt)("h3",{id:"resource-requirements"},"Resource Requirements"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"resources")," attribute in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Container")," schema specifies the application resource requirements such as cpu and memory."),(0,o.kt)("p",null,"You can specify an upper limit (which maps to resource limits only) or a range as the resource requirements (which maps to resource requests and limits in Kubernetes)."),(0,o.kt)("p",null,"To specify an upper bound (only resource limits):"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n # ...\n }\n }\n }\n}\n')),(0,o.kt)("p",null,"To specify a range (both resource requests and limits):"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # Sets requests to cpu=250m and memory=256Mi\n # Sets limits to cpu=500m and memory=512Mi\n resources: {\n "cpu": "250m-500m"\n "memory": "256Mi-512Mi"\n }\n # ...\n }\n }\n }\n}\n')),(0,o.kt)("h3",{id:"health-probes"},"Health Probes"),(0,o.kt)("p",null,"There are three types of ",(0,o.kt)("inlineCode",{parentName:"p"},"Probe")," defined in a ",(0,o.kt)("inlineCode",{parentName:"p"},"Container"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"livenessProbe")," - used to determine if the container is healthy and running"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"readinessProbe")," - used to determine if the container is ready to accept traffic"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"startupProbe")," - used to determine if the container has started properly. Liveness and readiness probes don't start until ",(0,o.kt)("inlineCode",{parentName:"li"},"startupProbe")," succeeds. Commonly used for containers that takes a while to start")),(0,o.kt)("p",null,"The probes are optional. You can only have one Probe of each kind for a given ",(0,o.kt)("inlineCode",{parentName:"p"},"Container"),"."),(0,o.kt)("p",null,"To configure a ",(0,o.kt)("inlineCode",{parentName:"p"},"Http")," type ",(0,o.kt)("inlineCode",{parentName:"p"},"readinessProbe")," that probes the health via HTTP request and a ",(0,o.kt)("inlineCode",{parentName:"p"},"Exec")," type ",(0,o.kt)("inlineCode",{parentName:"p"},"livenessProbe")," which executes a command:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # ...\n # Configure an Http type readiness probe at /healthz\n readinessProbe: p.Probe {\n probeHandler: p.Http {\n url: "/healthz"\n }\n initialDelaySeconds: 10\n timeoutSeconds: 5\n periodSeconds: 15\n successThreshold: 3\n failureThreshold: 1\n }\n # Configure an Exec type liveness probe that executes probe.sh\n livenessProbe: p.Probe {\n probeHandler: p.Exec {\n command: ["probe.sh"]\n }\n initialDelaySeconds: 10\n }\n }\n }\n }\n}\n')),(0,o.kt)("h3",{id:"lifecycle-hooks"},"Lifecycle Hooks"),(0,o.kt)("p",null,"You can also configure lifecycle hooks that triggers in response to container lifecycle events such as liveness/startup probe failure, preemption, resource contention, etc."),(0,o.kt)("p",null,"There are two types that is currently supported:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"PreStop")," - triggers before the container is terminated."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"PostStart")," - triggers after the container is initialized.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # ...\n # Configure lifecycle hooks\n lifecycle: lc.Lifecycle {\n # Configures an Exec type pre-stop hook that executes preStop.sh\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n # Configures an Http type pre-stop hook at /post-start\n postStart: p.Http {\n url: "/post-start"\n }\n }\n }\n }\n }\n}\n')),(0,o.kt)("h3",{id:"create-files"},"Create Files"),(0,o.kt)("p",null,"You can also create files on-demand during the container initialization."),(0,o.kt)("p",null,"To create a custom file and mount it to ",(0,o.kt)("inlineCode",{parentName:"p"},"/home/admin/my-file")," when the container starts:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n }\n # ...\n # Creates a file during container startup\n files: {\n "/home/admin/my-file": c.FileSpec {\n content: "some file contents"\n mode: "0777"\n }\n }\n }\n }\n}\n')),(0,o.kt)("h3",{id:"customize-container-initialization"},"Customize container initialization"),(0,o.kt)("p",null,"You can also customize the container entrypoint via ",(0,o.kt)("inlineCode",{parentName:"p"},"command"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"args"),", and ",(0,o.kt)("inlineCode",{parentName:"p"},"workingDir"),". These should ",(0,o.kt)("strong",{parentName:"p"},"most likely not be required"),". In most of the cases, the entrypoint details should be baked into the application image itself."),(0,o.kt)("p",null,"To customize the container entrypoint:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # ...\n # This command will overwrite the entrypoint set in the image Dockerfile\n command: ["/usr/local/bin/my-init-script.sh"]\n # Extra arguments append to command defined above\n args: [\n "--log-dir=/home/my-app/logs"\n "--timeout=60s"\n ]\n # Run the command as defined above, in the directory "/tmp"\n workingDir: "/tmp"\n }\n }\n }\n}\n')),(0,o.kt)("h2",{id:"configure-replicas"},"Configure Replicas"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"replicas")," field in the ",(0,o.kt)("inlineCode",{parentName:"p"},"workload")," instance describes the number of identical copies to run at the same time. It is generally recommended to have multiple replicas in production environments to eliminate any single point of failure. In Kubernetes, this corresponds to the ",(0,o.kt)("inlineCode",{parentName:"p"},"spec.replicas")," field in the relevant workload manifests."),(0,o.kt)("p",null,"To configure a workload to have a replica count of 3:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n # ...\n }\n replicas: 3\n # ...\n }\n # ...\n}\n")),(0,o.kt)("h2",{id:"differences-between-service-and-job"},"Differences between Service and Job"),(0,o.kt)("p",null,"The two types of workloads, namely ",(0,o.kt)("inlineCode",{parentName:"p"},"Service")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Job"),", share a majority of the attributes with some minor differences."),(0,o.kt)("h3",{id:"exposure"},"Exposure"),(0,o.kt)("p",null,"A ",(0,o.kt)("inlineCode",{parentName:"p"},"Service")," usually represents a long-running, scalable workload that responds to short-lived latency-sensitive requests and never go down. Hence, a ",(0,o.kt)("inlineCode",{parentName:"p"},"Service")," has an additional attribute that determines how it is exposed and can be accessed. A ",(0,o.kt)("inlineCode",{parentName:"p"},"Job")," does NOT have the option to be exposed. We will explore more in the ",(0,o.kt)("a",{parentName:"p",href:"networking"},"application networking walkthrough"),"."),(0,o.kt)("h3",{id:"job-schedule"},"Job Schedule"),(0,o.kt)("p",null,"A ",(0,o.kt)("inlineCode",{parentName:"p"},"Job")," can be configured to run in a recurring manner. In this case, the job will have a cron-format schedule that represents its recurring schedule."),(0,o.kt)("p",null,"To configure a job to run at 21:00 every night:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myjob: ac.AppConfiguration {\n workload: wl.Job {\n containers: {\n "busybox": c.Container {\n image: "busybox:1.28"\n # Run the following command as defined\n command: ["/bin/sh", "-c", "echo hello"]\n }\n }\n # Run every hour.\n schedule: "0 * * * *"\n }\n}\n')),(0,o.kt)("h2",{id:"workload-references"},"Workload References"),(0,o.kt)("p",null,"You can find workload references ",(0,o.kt)("a",{parentName:"p",href:"../reference/modules/developer-schemas/workload/service"},"here"),"."),(0,o.kt)("p",null,"You can find workload schema source ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog/tree/main/models/schema/v1/workload"},"here"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1961a063.eef31fca.js b/assets/js/1961a063.eef31fca.js deleted file mode 100644 index e2b9b3ad381..00000000000 --- a/assets/js/1961a063.eef31fca.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8025],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var o=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function r(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var p=o.createContext({}),s=function(e){var n=o.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):r(r({},n),e)),t},c=function(e){var n=s(e.components);return o.createElement(p.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},d=o.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=s(t),m=a,k=d["".concat(p,".").concat(m)]||d[m]||u[m]||i;return t?o.createElement(k,r(r({ref:n},c),{},{components:t})):o.createElement(k,r({ref:n},c))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,r=new Array(i);r[0]=d;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:a,r[1]=l;for(var s=2;s{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>r,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var o=t(87462),a=(t(67294),t(3905));const i={},r="Workload",l={unversionedId:"configuration-walkthrough/workload",id:"configuration-walkthrough/workload",title:"Workload",description:"The workload attribute in the AppConfiguration instance is used to describe the specification for the application workload. The application workload generally represents the computing component for the application.",source:"@site/docs/kusion/4-configuration-walkthrough/4-workload.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/workload",permalink:"/docs/next/configuration-walkthrough/workload",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/4-configuration-walkthrough/4-workload.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:4,frontMatter:{},sidebar:"kusion",previous:{title:"Base and Override",permalink:"/docs/next/configuration-walkthrough/base-override"},next:{title:"Application Networking",permalink:"/docs/next/configuration-walkthrough/networking"}},p={},s=[{value:"Table of Content",id:"table-of-content",level:2},{value:"Import",id:"import",level:2},{value:"Types of Workloads",id:"types-of-workloads",level:2},{value:"Configure containers",id:"configure-containers",level:2},{value:"Application image",id:"application-image",level:3},{value:"Resource Requirements",id:"resource-requirements",level:3},{value:"Health Probes",id:"health-probes",level:3},{value:"Lifecycle Hooks",id:"lifecycle-hooks",level:3},{value:"Create Files",id:"create-files",level:3},{value:"Customize container initialization",id:"customize-container-initialization",level:3},{value:"Configure Replicas",id:"configure-replicas",level:2},{value:"Differences between Service and Job",id:"differences-between-service-and-job",level:2},{value:"Exposure",id:"exposure",level:3},{value:"Job Schedule",id:"job-schedule",level:3},{value:"Workload References",id:"workload-references",level:2}],c={toc:s};function u(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,o.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"workload"},"Workload"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," attribute in the ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance is used to describe the specification for the application workload. The application workload generally represents the computing component for the application."),(0,a.kt)("p",null,"A ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," maps to an ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance 1:1. If there are more than one workload, they should be considered different applications."),(0,a.kt)("h2",{id:"table-of-content"},"Table of Content"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#import"},"Import")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#types-of-workloads"},"Types of workloads")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#configure-containers"},"Configure containers"),(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#application-image"},"Application image")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#resource-requirements"},"Resource Requirements")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#health-probes"},"Health Probes")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#lifecycle-hooks"},"Lifecycle Hooks")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#create-files"},"Create Files")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#customize-container-initialization"},"Customize container initialization")))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#configure-replicas"},"Configure Replicas")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#differences-between-service-and-job"},"Differences between Service and Job")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#workload-references"},"Workload References"))),(0,a.kt)("h2",{id:"import"},"Import"),(0,a.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,a.kt)("inlineCode",{parentName:"p"},"catalog")," package. For more details on KCL package import, please refer to the ",(0,a.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport kam.v1.workload.container.probe as p\nimport kam.v1.workload.container.lifecycle as lc\n")),(0,a.kt)("h2",{id:"types-of-workloads"},"Types of Workloads"),(0,a.kt)("p",null,"There are currently two types of workloads:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Service"),', representing a long-running, scalable workload type that should "never" go down and respond to short-lived latency-sensitive requests. This workload type is commonly used for web applications and services that expose APIs.'),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Job"),", representing batch tasks that take from a few seconds to days to complete and then stop. These are commonly used for batch processing that is less sensitive to short-term performance fluctuations.")),(0,a.kt)("p",null,"To instantiate a ",(0,a.kt)("inlineCode",{parentName:"p"},"Service"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {}\n}\n")),(0,a.kt)("p",null,"To instantiate a ",(0,a.kt)("inlineCode",{parentName:"p"},"Job"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Job {}\n}\n")),(0,a.kt)("p",null,"Of course, the ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instances above is not sufficient to describe an application. We still need to provide more details in the ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," section."),(0,a.kt)("h2",{id:"configure-containers"},"Configure containers"),(0,a.kt)("p",null,"Kusion is built on top of cloud-native philosophies. One of which is that applications should run as loosely coupled microservices on abstract and self-contained software units, such as containers."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"containers")," attribute in a workload instance is used to define the behavior for the containers that run application workload. The ",(0,a.kt)("inlineCode",{parentName:"p"},"containers")," attribute is a map, from the name of the container to the ",(0,a.kt)("inlineCode",{parentName:"p"},"catalog.models.schema.v1.workload.container.Container")," Object which includes the container configurations."),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"The name of the container is in the context of the configuration file, so you could refer to it later. It's not referring to the name of the container in the Kubernetes cluster (or any other runtime).")),(0,a.kt)("p",null,"Everything defined in the ",(0,a.kt)("inlineCode",{parentName:"p"},"containers")," attribute is considered an application container, as opposed to a sidecar container. Sidecar containers will be introduced in a different attribute in a future version."),(0,a.kt)("p",null,"In most of the cases, only one application container is needed. Ideally, we recommend mapping an ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance to a microservice in the microservice terminology."),(0,a.kt)("p",null,"We will walk through the details of configuring a container using an example of the ",(0,a.kt)("inlineCode",{parentName:"p"},"Service")," type."),(0,a.kt)("p",null,"To add an application container:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {}\n }\n }\n}\n')),(0,a.kt)("h3",{id:"application-image"},"Application image"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"image")," attribute in the ",(0,a.kt)("inlineCode",{parentName:"p"},"Container")," schema specifies the application image to run. This is the only required field in the ",(0,a.kt)("inlineCode",{parentName:"p"},"Container")," schema."),(0,a.kt)("p",null,"To specify an application image:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n }\n # ...\n }\n }\n}\n')),(0,a.kt)("h3",{id:"resource-requirements"},"Resource Requirements"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"resources")," attribute in the ",(0,a.kt)("inlineCode",{parentName:"p"},"Container")," schema specifies the application resource requirements such as cpu and memory."),(0,a.kt)("p",null,"You can specify an upper limit (which maps to resource limits only) or a range as the resource requirements (which maps to resource requests and limits in Kubernetes)."),(0,a.kt)("p",null,"To specify an upper bound (only resource limits):"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n # ...\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"To specify a range (both resource requests and limits):"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # Sets requests to cpu=250m and memory=256Mi\n # Sets limits to cpu=500m and memory=512Mi\n resources: {\n "cpu": "250m-500m"\n "memory": "256Mi-512Mi"\n }\n # ...\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"health-probes"},"Health Probes"),(0,a.kt)("p",null,"There are three types of ",(0,a.kt)("inlineCode",{parentName:"p"},"Probe")," defined in a ",(0,a.kt)("inlineCode",{parentName:"p"},"Container"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"livenessProbe")," - used to determine if the container is healthy and running"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"readinessProbe")," - used to determine if the container is ready to accept traffic"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"startupProbe")," - used to determine if the container has started properly. Liveness and readiness probes don't start until ",(0,a.kt)("inlineCode",{parentName:"li"},"startupProbe")," succeeds. Commonly used for containers that takes a while to start")),(0,a.kt)("p",null,"The probes are optional. You can only have one Probe of each kind for a given ",(0,a.kt)("inlineCode",{parentName:"p"},"Container"),"."),(0,a.kt)("p",null,"To configure a ",(0,a.kt)("inlineCode",{parentName:"p"},"Http")," type ",(0,a.kt)("inlineCode",{parentName:"p"},"readinessProbe")," that probes the health via HTTP request and a ",(0,a.kt)("inlineCode",{parentName:"p"},"Exec")," type ",(0,a.kt)("inlineCode",{parentName:"p"},"livenessProbe")," which executes a command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # ...\n # Configure an Http type readiness probe at /healthz\n readinessProbe: p.Probe {\n probeHandler: p.Http {\n url: "/healthz"\n }\n initialDelaySeconds: 10\n timeoutSeconds: 5\n periodSeconds: 15\n successThreshold: 3\n failureThreshold: 1\n }\n # Configure an Exec type liveness probe that executes probe.sh\n livenessProbe: p.Probe {\n probeHandler: p.Exec {\n command: ["probe.sh"]\n }\n initialDelaySeconds: 10\n }\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"lifecycle-hooks"},"Lifecycle Hooks"),(0,a.kt)("p",null,"You can also configure lifecycle hooks that triggers in response to container lifecycle events such as liveness/startup probe failure, preemption, resource contention, etc."),(0,a.kt)("p",null,"There are two types that is currently supported:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"PreStop")," - triggers before the container is terminated."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"PostStart")," - triggers after the container is initialized.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # ...\n # Configure lifecycle hooks\n lifecycle: lc.Lifecycle {\n # Configures an Exec type pre-stop hook that executes preStop.sh\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n # Configures an Http type pre-stop hook at /post-start\n postStart: p.Http {\n url: "/post-start"\n }\n }\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"create-files"},"Create Files"),(0,a.kt)("p",null,"You can also create files on-demand during the container initialization."),(0,a.kt)("p",null,"To create a custom file and mount it to ",(0,a.kt)("inlineCode",{parentName:"p"},"/home/admin/my-file")," when the container starts:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n }\n # ...\n # Creates a file during container startup\n files: {\n "/home/admin/my-file": c.FileSpec {\n content: "some file contents"\n mode: "0777"\n }\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"customize-container-initialization"},"Customize container initialization"),(0,a.kt)("p",null,"You can also customize the container entrypoint via ",(0,a.kt)("inlineCode",{parentName:"p"},"command"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"args"),", and ",(0,a.kt)("inlineCode",{parentName:"p"},"workingDir"),". These should ",(0,a.kt)("strong",{parentName:"p"},"most likely not be required"),". In most of the cases, the entrypoint details should be baked into the application image itself."),(0,a.kt)("p",null,"To customize the container entrypoint:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # ...\n # This command will overwrite the entrypoint set in the image Dockerfile\n command: ["/usr/local/bin/my-init-script.sh"]\n # Extra arguments append to command defined above\n args: [\n "--log-dir=/home/my-app/logs"\n "--timeout=60s"\n ]\n # Run the command as defined above, in the directory "/tmp"\n workingDir: "/tmp"\n }\n }\n }\n}\n')),(0,a.kt)("h2",{id:"configure-replicas"},"Configure Replicas"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"replicas")," field in the ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," instance describes the number of identical copies to run at the same time. It is generally recommended to have multiple replicas in production environments to eliminate any single point of failure. In Kubernetes, this corresponds to the ",(0,a.kt)("inlineCode",{parentName:"p"},"spec.replicas")," field in the relevant workload manifests."),(0,a.kt)("p",null,"To configure a workload to have a replica count of 3:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n # ...\n }\n replicas: 3\n # ...\n }\n # ...\n}\n")),(0,a.kt)("h2",{id:"differences-between-service-and-job"},"Differences between Service and Job"),(0,a.kt)("p",null,"The two types of workloads, namely ",(0,a.kt)("inlineCode",{parentName:"p"},"Service")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"Job"),", share a majority of the attributes with some minor differences."),(0,a.kt)("h3",{id:"exposure"},"Exposure"),(0,a.kt)("p",null,"A ",(0,a.kt)("inlineCode",{parentName:"p"},"Service")," usually represents a long-running, scalable workload that responds to short-lived latency-sensitive requests and never go down. Hence, a ",(0,a.kt)("inlineCode",{parentName:"p"},"Service")," has an additional attribute that determines how it is exposed and can be accessed. A ",(0,a.kt)("inlineCode",{parentName:"p"},"Job")," does NOT have the option to be exposed. We will explore more in the ",(0,a.kt)("a",{parentName:"p",href:"networking"},"application networking walkthrough"),"."),(0,a.kt)("h3",{id:"job-schedule"},"Job Schedule"),(0,a.kt)("p",null,"A ",(0,a.kt)("inlineCode",{parentName:"p"},"Job")," can be configured to run in a recurring manner. In this case, the job will have a cron-format schedule that represents its recurring schedule."),(0,a.kt)("p",null,"To configure a job to run at 21:00 every night:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myjob: ac.AppConfiguration {\n workload: wl.Job {\n containers: {\n "busybox": c.Container {\n image: "busybox:1.28"\n # Run the following command as defined\n command: ["/bin/sh", "-c", "echo hello"]\n }\n }\n # Run every hour.\n schedule: "0 * * * *"\n }\n}\n')),(0,a.kt)("h2",{id:"workload-references"},"Workload References"),(0,a.kt)("p",null,"You can find workload references ",(0,a.kt)("a",{parentName:"p",href:"../reference/modules/developer-schemas/workload/service"},"here"),"."),(0,a.kt)("p",null,"You can find workload schema source ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog/tree/main/models/schema/v1/workload"},"here"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1aa0cc2e.4ffe9435.js b/assets/js/1aa0cc2e.4ffe9435.js deleted file mode 100644 index be6c1c8909b..00000000000 --- a/assets/js/1aa0cc2e.4ffe9435.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[38],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var i=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=i.createContext({}),p=function(e){var t=i.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},c=function(e){var t=p(e.components);return i.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},d=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(n),m=a,k=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return n?i.createElement(k,r(r({ref:t},c),{},{components:n})):i.createElement(k,r({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,r=new Array(o);r[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,r[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>r,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var i=n(87462),a=(n(67294),n(3905));const o={id:"deploy-application"},r="Deploy Application",l={unversionedId:"user-guides/working-with-k8s/deploy-application",id:"user-guides/working-with-k8s/deploy-application",title:"Deploy Application",description:"This guide shows you how to use Kusion CLIs to complete the deployment of an application running in Kubernetes.",source:"@site/docs/kusion/5-user-guides/2-working-with-k8s/1-deploy-application.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/deploy-application",permalink:"/docs/next/user-guides/working-with-k8s/deploy-application",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/5-user-guides/2-working-with-k8s/1-deploy-application.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"deploy-application"},sidebar:"kusion",previous:{title:"Expose Application Service Deployed on CSP Kubernetes",permalink:"/docs/next/user-guides/cloud-resources/expose-service"},next:{title:"Configure Containers",permalink:"/docs/next/user-guides/working-with-k8s/container"}},s={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Initializing",id:"initializing",level:2},{value:"Initializing workspace configuration",id:"initializing-workspace-configuration",level:3},{value:"Initializing application configuration",id:"initializing-application-configuration",level:3},{value:"kcl.mod",id:"kclmod",level:4},{value:"main.k",id:"maink",level:4},{value:"Previewing",id:"previewing",level:2},{value:"Applying",id:"applying",level:2}],c={toc:p};function u(e){let{components:t,...o}=e;return(0,a.kt)("wrapper",(0,i.Z)({},c,o,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"deploy-application"},"Deploy Application"),(0,a.kt)("p",null,"This guide shows you how to use Kusion CLIs to complete the deployment of an application running in Kubernetes.\nWe call the abstraction of application operation and maintenance configuration as ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),", and its instance as ",(0,a.kt)("inlineCode",{parentName:"p"},"Application"),".\nIt is essentially a configuration model that describes an application. The complete definition can be seen ",(0,a.kt)("a",{parentName:"p",href:"../../reference/modules/developer-schemas/app-configuration"},"here"),"."),(0,a.kt)("p",null,"In production, the application generally includes minimally several k8s resources:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Namespace"),(0,a.kt)("li",{parentName:"ul"},"Deployment"),(0,a.kt)("li",{parentName:"ul"},"Service")),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"This guide requires you to have a basic understanding of Kubernetes.\nIf you are not familiar with the relevant concepts, please refer to the links below:"),(0,a.kt)("ul",{parentName:"admonition"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/tutorials/kubernetes-basics/"},"Learn Kubernetes Basics")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/"},"Namespace")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/concepts/workloads/controllers/deployment/"},"Deployment")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/concepts/services-networking/service/"},"Service")))),(0,a.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,a.kt)("p",null,"Before we start, we need to complete the following steps:"),(0,a.kt)("p",null,"1\u3001Install Kusion"),(0,a.kt)("p",null,"We recommend using HomeBrew(Mac), Scoop(Windows), or an installation shell script to download and install Kusion.\nSee ",(0,a.kt)("a",{parentName:"p",href:"../../getting-started/install-kusion"},"Download and Install")," for more details."),(0,a.kt)("p",null,"2\u3001Running Kubernetes cluster"),(0,a.kt)("p",null,"There must be a running and accessible Kubernetes cluster and a ",(0,a.kt)("a",{parentName:"p",href:"https://Kubernetes.io/docs/tasks/tools/#kubectl"},"kubectl")," command line tool.\nIf you don't have a cluster yet, you can use ",(0,a.kt)("a",{parentName:"p",href:"https://minikube.sigs.k8s.io/docs/tutorials/multi_node/"},"Minikube")," to start one of your own."),(0,a.kt)("h2",{id:"initializing"},"Initializing"),(0,a.kt)("p",null,"This guide is to deploy an app using Kusion, relying on the Kusion CLI and an existing Kubernetes cluster."),(0,a.kt)("h3",{id:"initializing-workspace-configuration"},"Initializing workspace configuration"),(0,a.kt)("p",null,"In version 0.10.0, we have introduced the new concept of ",(0,a.kt)("a",{parentName:"p",href:"../../concepts/workspace"},"workspaces"),', which is a logical layer whose configurations represent an opinionated set of defaults, often appointed by the platform team. In most cases workspaces are represented with an "environment" in traditional SDLC terms. These workspaces provide a means to separate the concerns between the ',(0,a.kt)("strong",{parentName:"p"},"application developers")," who wish to focus on business logic, and a group of ",(0,a.kt)("strong",{parentName:"p"},"platform engineers")," who wish to standardize the applications on the platform."),(0,a.kt)("p",null,"Driven by the discipline of Platform Engineering, management of the workspaces, including create/updating/deleting workspaces and their configurations should be done by dedicated platform engineers in a large software organizations to facilitate a more mature and scalable collaboration pattern."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"More on the collaboration pattern can be found in the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/design/collaboration/collaboration_paradigm.md"},"design doc"),".")),(0,a.kt)("p",null,"However, if that does NOT apply to your scenario, e.g. if you work in a smaller org without platform engineers or if you are an individual developer, we wish Kusion can still be a value tool to have when delivering an application. In this guide, we are NOT distinctively highlighting the different roles or what the best practices entails (the design doc above has all that) but rather the steps needed to get Kusion tool to work."),(0,a.kt)("p",null,"As of version 0.11.0, workspace configurations in Kusion can not only be managed on the local filesystem in the form of YAML files, but the remotely-managed workspaces have been supported as well."),(0,a.kt)("p",null,"To initialize the workspace configuration:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"~/playground$ touch ~/dev.yaml\n~/playground$ kusion workspace create dev -f ~/dev.yaml\ncreate workspace dev successfully\n")),(0,a.kt)("p",null,"To verify the workspace has been created properly:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"~/playground$ kusion workspace list\n- default\n- dev\n~/playground$ kusion workspace show dev\n{}\n")),(0,a.kt)("p",null,"Note that ",(0,a.kt)("inlineCode",{parentName:"p"},"show")," command tells us the workspace configuration is currently empty, which is expected because we created the ",(0,a.kt)("inlineCode",{parentName:"p"},"dev")," workspace with an empty YAML file. An empty workspace configuration will suffice in some cases, where no platform configurations are needed."),(0,a.kt)("p",null,"Kusion by default uses the ",(0,a.kt)("inlineCode",{parentName:"p"},"default")," workspace, thus we need to switch to the ",(0,a.kt)("inlineCode",{parentName:"p"},"dev")," workspace we have just created. "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"~/playground$ kusion workspace switch dev\n")),(0,a.kt)("p",null,"We will progressively add more workspace configurations throughout this user guide."),(0,a.kt)("h3",{id:"initializing-application-configuration"},"Initializing application configuration"),(0,a.kt)("p",null,"Now that workspaces are properly initialized, we can begin by initializing the application configuration:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"# Create a new directory and navigate into it. \nmkdir simple-service && cd simple-service\n\n# Initialize the demo project with the name of the current directory. \nkusion init\n")),(0,a.kt)("p",null,"The directory structure is as follows:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"simple-service/\n.\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n\n2 directories, 4 files\n")),(0,a.kt)("p",null,"The project directory has the following files that are automatically generated:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"project.yaml")," represents project-level configurations."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dev")," directory stores the customized stack configuration:",(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dev/main.k")," stores configurations in the ",(0,a.kt)("inlineCode",{parentName:"li"},"dev")," stack."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dev/stack.yaml")," stores stack-level configurations."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dev/kcl.mod")," stores stack-level dependencies.")))),(0,a.kt)("p",null,"In general, the ",(0,a.kt)("inlineCode",{parentName:"p"},".k")," files are the KCL source code that represents the application configuration, and the ",(0,a.kt)("inlineCode",{parentName:"p"},".yaml")," is the static configuration file that describes behavior at the project or stack level."),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"See ",(0,a.kt)("a",{parentName:"p",href:"../../concepts/project/overview"},"Project")," and ",(0,a.kt)("a",{parentName:"p",href:"../../concepts/stack/overview"},"Stack")," for more details about Project and Stack.")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init")," command will create a demo quickstart application, we may update the ",(0,a.kt)("inlineCode",{parentName:"p"},"dev/kcl.mod")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"dev/main.k")," later. "),(0,a.kt)("h4",{id:"kclmod"},"kcl.mod"),(0,a.kt)("p",null,"There should be a ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file generated automatically under the project directory. The ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file describes the dependency for the current project or stack. By default, it should contain a reference to the official ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kam"},(0,a.kt)("inlineCode",{parentName:"a"},"kam")," repository")," which holds the Kusion ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," and related workload model definitions that fits best practices. You can also create your own models library and reference that."),(0,a.kt)("p",null,"You can change the package name in ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," to ",(0,a.kt)("inlineCode",{parentName:"p"},"simple-service"),": "),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"dev/kcl.mod")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},'[package]\nname = "simple-service"\nversion = "0.1.0"\n\n[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\n\n[profile]\nentries = ["main.k"]\n')),(0,a.kt)("h4",{id:"maink"},"main.k"),(0,a.kt)("p",null,"The configuration file ",(0,a.kt)("inlineCode",{parentName:"p"},"main.k"),", usually written by the application developers, declare customized configurations for a specific stack, including an ",(0,a.kt)("inlineCode",{parentName:"p"},"Application")," instance of ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model. "),(0,a.kt)("p",null,"You can update the ",(0,a.kt)("inlineCode",{parentName:"p"},"main.k")," as follows: "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\n\n"helloworld": ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "helloworld": c.Container {\n image = "gcr.io/google-samples/gb-frontend:v4"\n }\n }\n replicas: 2\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n }\n}\n')),(0,a.kt)("h2",{id:"previewing"},"Previewing"),(0,a.kt)("p",null,"At this point, the project has been completely initialized.\nThe configuration is written in KCL, not JSON/YAML which Kubernetes recognizes, so it needs to be built to get the final output. And we can use the ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion preview")," cmd to preview the Kubernetes resources intended to deliver. "),(0,a.kt)("p",null,"Enter stack dir ",(0,a.kt)("inlineCode",{parentName:"p"},"simple-service/dev")," and preview:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cd simple-service/dev && kusion preview\n")),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"For instructions on the kusion command line tool, execute ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion -h"),", or refer to the tool's online ",(0,a.kt)("a",{parentName:"p",href:"../../reference/commands"},"documentation"),".")),(0,a.kt)("h2",{id:"applying"},"Applying"),(0,a.kt)("p",null,"Preview is now completed. We can apply the configuration as the next step. In the output from ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion preview"),", you can see 3 resources:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"a Namespace named ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service")),(0,a.kt)("li",{parentName:"ul"},"a Deployment named ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service-dev-helloworld")," in the ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service")," namespace"),(0,a.kt)("li",{parentName:"ul"},"a Service named ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service-dev-helloworld-private")," in the ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service")," namespace")),(0,a.kt)("p",null,"Execute command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kusion apply\n")),(0,a.kt)("p",null,"The output is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"}," \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service Create\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private Create\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Create\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS Create v1:Namespace:simple-service success \n SUCCESS Create v1:Service:simple-service:simple-service-dev-helloworld-private success \n SUCCESS Create apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \nCreate apps/v1:Deployment:simple-service:simple-service-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 3 created, 0 updated, 0 deleted.\n")),(0,a.kt)("p",null,"After the configuration applying successfully, you can use the ",(0,a.kt)("inlineCode",{parentName:"p"},"kubectl")," to check the actual status of these resources."),(0,a.kt)("p",null,"1\u3001 Check Namespace"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get ns\n")),(0,a.kt)("p",null,"The output is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"NAME STATUS AGE\ndefault Active 117d\nsimple-service Active 38s\nkube-system Active 117d\n...\n")),(0,a.kt)("p",null,"2\u3001Check Deployment"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get deploy -n simple-service\n")),(0,a.kt)("p",null,"The output is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"NAME READY UP-TO-DATE AVAILABLE AGE\nsimple-service-dev-helloworld 1/1 1 1 59s\n")),(0,a.kt)("p",null,"3\u3001Check Service"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get svc -n simple-service\n")),(0,a.kt)("p",null,"The output is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\nsimple-service-dev-helloworld-private ClusterIP 10.98.89.104 80/TCP 79s\n")),(0,a.kt)("p",null,"4\u3001Validate app"),(0,a.kt)("p",null,"Using the ",(0,a.kt)("inlineCode",{parentName:"p"},"kubectl")," tool, forward native port ",(0,a.kt)("inlineCode",{parentName:"p"},"30000")," to the service port ",(0,a.kt)("inlineCode",{parentName:"p"},"80"),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl port-forward svc/simple-service-dev-helloworld-private -n simple-service 30000:80\n")),(0,a.kt)("p",null,"Open browser and visit ",(0,a.kt)("a",{parentName:"p",href:"http://127.0.0.1:30000"},"http://127.0.0.1:30000"),"\uff1a"),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"app-preview",src:n(92287).Z,width:"1830",height:"330"})))}u.isMDXComponent=!0},92287:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/app-preview-de5274f4267fa725d2a65099e47c6c2c.png"}}]); \ No newline at end of file diff --git a/assets/js/1aa0cc2e.f9b61ca1.js b/assets/js/1aa0cc2e.f9b61ca1.js new file mode 100644 index 00000000000..d3771ac94b2 --- /dev/null +++ b/assets/js/1aa0cc2e.f9b61ca1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[38],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var i=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=i.createContext({}),p=function(e){var t=i.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},c=function(e){var t=p(e.components);return i.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},d=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(n),m=a,k=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return n?i.createElement(k,r(r({ref:t},c),{},{components:n})):i.createElement(k,r({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,r=new Array(o);r[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,r[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>r,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var i=n(87462),a=(n(67294),n(3905));const o={id:"deploy-application"},r="Deploy Application",l={unversionedId:"user-guides/working-with-k8s/deploy-application",id:"user-guides/working-with-k8s/deploy-application",title:"Deploy Application",description:"This guide shows you how to use Kusion CLIs to complete the deployment of an application running in Kubernetes.",source:"@site/docs/kusion/5-user-guides/2-working-with-k8s/1-deploy-application.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/deploy-application",permalink:"/docs/next/user-guides/working-with-k8s/deploy-application",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/5-user-guides/2-working-with-k8s/1-deploy-application.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"deploy-application"},sidebar:"kusion",previous:{title:"Expose Application Service Deployed on CSP Kubernetes",permalink:"/docs/next/user-guides/cloud-resources/expose-service"},next:{title:"Configure Containers",permalink:"/docs/next/user-guides/working-with-k8s/container"}},s={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Initializing",id:"initializing",level:2},{value:"Initializing workspace configuration",id:"initializing-workspace-configuration",level:3},{value:"Initializing application configuration",id:"initializing-application-configuration",level:3},{value:"kcl.mod",id:"kclmod",level:4},{value:"main.k",id:"maink",level:4},{value:"Previewing",id:"previewing",level:2},{value:"Applying",id:"applying",level:2}],c={toc:p};function u(e){let{components:t,...o}=e;return(0,a.kt)("wrapper",(0,i.Z)({},c,o,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"deploy-application"},"Deploy Application"),(0,a.kt)("p",null,"This guide shows you how to use Kusion CLIs to complete the deployment of an application running in Kubernetes.\nWe call the abstraction of application operation and maintenance configuration as ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),", and its instance as ",(0,a.kt)("inlineCode",{parentName:"p"},"Application"),".\nIt is essentially a configuration model that describes an application. The complete definition can be seen ",(0,a.kt)("a",{parentName:"p",href:"../../reference/modules/developer-schemas/app-configuration"},"here"),"."),(0,a.kt)("p",null,"In production, the application generally includes minimally several k8s resources:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Namespace"),(0,a.kt)("li",{parentName:"ul"},"Deployment"),(0,a.kt)("li",{parentName:"ul"},"Service")),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"This guide requires you to have a basic understanding of Kubernetes.\nIf you are not familiar with the relevant concepts, please refer to the links below:"),(0,a.kt)("ul",{parentName:"admonition"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/tutorials/kubernetes-basics/"},"Learn Kubernetes Basics")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/"},"Namespace")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/concepts/workloads/controllers/deployment/"},"Deployment")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/concepts/services-networking/service/"},"Service")))),(0,a.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,a.kt)("p",null,"Before we start, we need to complete the following steps:"),(0,a.kt)("p",null,"1\u3001Install Kusion"),(0,a.kt)("p",null,"We recommend using HomeBrew(Mac), Scoop(Windows), or an installation shell script to download and install Kusion.\nSee ",(0,a.kt)("a",{parentName:"p",href:"../../getting-started/install-kusion"},"Download and Install")," for more details."),(0,a.kt)("p",null,"2\u3001Running Kubernetes cluster"),(0,a.kt)("p",null,"There must be a running and accessible Kubernetes cluster and a ",(0,a.kt)("a",{parentName:"p",href:"https://Kubernetes.io/docs/tasks/tools/#kubectl"},"kubectl")," command line tool.\nIf you don't have a cluster yet, you can use ",(0,a.kt)("a",{parentName:"p",href:"https://minikube.sigs.k8s.io/docs/tutorials/multi_node/"},"Minikube")," to start one of your own."),(0,a.kt)("h2",{id:"initializing"},"Initializing"),(0,a.kt)("p",null,"This guide is to deploy an app using Kusion, relying on the Kusion CLI and an existing Kubernetes cluster."),(0,a.kt)("h3",{id:"initializing-workspace-configuration"},"Initializing workspace configuration"),(0,a.kt)("p",null,"In version 0.10.0, we have introduced the new concept of ",(0,a.kt)("a",{parentName:"p",href:"../../concepts/workspace"},"workspaces"),', which is a logical layer whose configurations represent an opinionated set of defaults, often appointed by the platform team. In most cases workspaces are represented with an "environment" in traditional SDLC terms. These workspaces provide a means to separate the concerns between the ',(0,a.kt)("strong",{parentName:"p"},"application developers")," who wish to focus on business logic, and a group of ",(0,a.kt)("strong",{parentName:"p"},"platform engineers")," who wish to standardize the applications on the platform."),(0,a.kt)("p",null,"Driven by the discipline of Platform Engineering, management of the workspaces, including create/updating/deleting workspaces and their configurations should be done by dedicated platform engineers in a large software organizations to facilitate a more mature and scalable collaboration pattern."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"More on the collaboration pattern can be found in the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/design/collaboration/collaboration_paradigm.md"},"design doc"),".")),(0,a.kt)("p",null,"However, if that does NOT apply to your scenario, e.g. if you work in a smaller org without platform engineers or if you are an individual developer, we wish Kusion can still be a value tool to have when delivering an application. In this guide, we are NOT distinctively highlighting the different roles or what the best practices entails (the design doc above has all that) but rather the steps needed to get Kusion tool to work."),(0,a.kt)("p",null,"As of version 0.11.0, workspace configurations in Kusion can not only be managed on the local filesystem in the form of YAML files, but the remotely-managed workspaces have been supported as well."),(0,a.kt)("p",null,"To initialize the workspace configuration:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"~/playground$ touch ~/dev.yaml\n~/playground$ kusion workspace create dev -f ~/dev.yaml\ncreate workspace dev successfully\n")),(0,a.kt)("p",null,"To verify the workspace has been created properly:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"~/playground$ kusion workspace list\n- default\n- dev\n~/playground$ kusion workspace show dev\n{}\n")),(0,a.kt)("p",null,"Note that ",(0,a.kt)("inlineCode",{parentName:"p"},"show")," command tells us the workspace configuration is currently empty, which is expected because we created the ",(0,a.kt)("inlineCode",{parentName:"p"},"dev")," workspace with an empty YAML file. An empty workspace configuration will suffice in some cases, where no platform configurations are needed."),(0,a.kt)("p",null,"Kusion by default uses the ",(0,a.kt)("inlineCode",{parentName:"p"},"default")," workspace, thus we need to switch to the ",(0,a.kt)("inlineCode",{parentName:"p"},"dev")," workspace we have just created. "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"~/playground$ kusion workspace switch dev\n")),(0,a.kt)("p",null,"We will progressively add more workspace configurations throughout this user guide."),(0,a.kt)("h3",{id:"initializing-application-configuration"},"Initializing application configuration"),(0,a.kt)("p",null,"Now that workspaces are properly initialized, we can begin by initializing the application configuration:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"# Create a new directory and navigate into it. \nmkdir simple-service && cd simple-service\n\n# Initialize the demo project with the name of the current directory. \nkusion init\n")),(0,a.kt)("p",null,"The directory structure is as follows:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"simple-service/\n.\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n\n2 directories, 4 files\n")),(0,a.kt)("p",null,"The project directory has the following files that are automatically generated:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"project.yaml")," represents project-level configurations."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dev")," directory stores the customized stack configuration:",(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dev/main.k")," stores configurations in the ",(0,a.kt)("inlineCode",{parentName:"li"},"dev")," stack."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dev/stack.yaml")," stores stack-level configurations."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dev/kcl.mod")," stores stack-level dependencies.")))),(0,a.kt)("p",null,"In general, the ",(0,a.kt)("inlineCode",{parentName:"p"},".k")," files are the KCL source code that represents the application configuration, and the ",(0,a.kt)("inlineCode",{parentName:"p"},".yaml")," is the static configuration file that describes behavior at the project or stack level."),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"See ",(0,a.kt)("a",{parentName:"p",href:"../../concepts/project/overview"},"Project")," and ",(0,a.kt)("a",{parentName:"p",href:"../../concepts/stack/overview"},"Stack")," for more details about Project and Stack.")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init")," command will create a demo quickstart application, we may update the ",(0,a.kt)("inlineCode",{parentName:"p"},"dev/kcl.mod")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"dev/main.k")," later. "),(0,a.kt)("h4",{id:"kclmod"},"kcl.mod"),(0,a.kt)("p",null,"There should be a ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file generated automatically under the project directory. The ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file describes the dependency for the current project or stack. By default, it should contain a reference to the official ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kam"},(0,a.kt)("inlineCode",{parentName:"a"},"kam")," repository")," which holds the Kusion ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," and related workload model definitions that fits best practices. You can also create your own models library and reference that."),(0,a.kt)("p",null,"You can change the package name in ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," to ",(0,a.kt)("inlineCode",{parentName:"p"},"simple-service"),": "),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"dev/kcl.mod")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},'[package]\nname = "simple-service"\nversion = "0.1.0"\n\n[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\n\n[profile]\nentries = ["main.k"]\n')),(0,a.kt)("h4",{id:"maink"},"main.k"),(0,a.kt)("p",null,"The configuration file ",(0,a.kt)("inlineCode",{parentName:"p"},"main.k"),", usually written by the application developers, declare customized configurations for a specific stack, including an ",(0,a.kt)("inlineCode",{parentName:"p"},"Application")," instance of ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model. "),(0,a.kt)("p",null,"You can update the ",(0,a.kt)("inlineCode",{parentName:"p"},"main.k")," as follows: "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\n\n"helloworld": ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "helloworld": c.Container {\n image = "gcr.io/google-samples/gb-frontend:v4"\n }\n }\n replicas: 2\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n }\n}\n')),(0,a.kt)("h2",{id:"previewing"},"Previewing"),(0,a.kt)("p",null,"At this point, the project has been completely initialized.\nThe configuration is written in KCL, not JSON/YAML which Kubernetes recognizes, so it needs to be built to get the final output. And we can use the ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion preview")," cmd to preview the Kubernetes resources intended to deliver. "),(0,a.kt)("p",null,"Enter stack dir ",(0,a.kt)("inlineCode",{parentName:"p"},"simple-service/dev")," and preview:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cd simple-service/dev && kusion preview\n")),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"For instructions on the kusion command line tool, execute ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion -h"),", or refer to the tool's online ",(0,a.kt)("a",{parentName:"p",href:"../../reference/commands"},"documentation"),".")),(0,a.kt)("h2",{id:"applying"},"Applying"),(0,a.kt)("p",null,"Preview is now completed. We can apply the configuration as the next step. In the output from ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion preview"),", you can see 3 resources:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"a Namespace named ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service")),(0,a.kt)("li",{parentName:"ul"},"a Deployment named ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service-dev-helloworld")," in the ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service")," namespace"),(0,a.kt)("li",{parentName:"ul"},"a Service named ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service-dev-helloworld-private")," in the ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service")," namespace")),(0,a.kt)("p",null,"Execute command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kusion apply\n")),(0,a.kt)("p",null,"The output is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"}," \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service Create\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private Create\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Create\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS Create v1:Namespace:simple-service success \n SUCCESS Create v1:Service:simple-service:simple-service-dev-helloworld-private success \n SUCCESS Create apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \nCreate apps/v1:Deployment:simple-service:simple-service-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 3 created, 0 updated, 0 deleted.\n")),(0,a.kt)("p",null,"After the configuration applying successfully, you can use the ",(0,a.kt)("inlineCode",{parentName:"p"},"kubectl")," to check the actual status of these resources."),(0,a.kt)("p",null,"1\u3001 Check Namespace"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get ns\n")),(0,a.kt)("p",null,"The output is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"NAME STATUS AGE\ndefault Active 117d\nsimple-service Active 38s\nkube-system Active 117d\n...\n")),(0,a.kt)("p",null,"2\u3001Check Deployment"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get deploy -n simple-service\n")),(0,a.kt)("p",null,"The output is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"NAME READY UP-TO-DATE AVAILABLE AGE\nsimple-service-dev-helloworld 1/1 1 1 59s\n")),(0,a.kt)("p",null,"3\u3001Check Service"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get svc -n simple-service\n")),(0,a.kt)("p",null,"The output is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\nsimple-service-dev-helloworld-private ClusterIP 10.98.89.104 80/TCP 79s\n")),(0,a.kt)("p",null,"4\u3001Validate app"),(0,a.kt)("p",null,"Using the ",(0,a.kt)("inlineCode",{parentName:"p"},"kubectl")," tool, forward native port ",(0,a.kt)("inlineCode",{parentName:"p"},"30000")," to the service port ",(0,a.kt)("inlineCode",{parentName:"p"},"80"),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl port-forward svc/simple-service-dev-helloworld-private -n simple-service 30000:80\n")),(0,a.kt)("p",null,"Open browser and visit ",(0,a.kt)("a",{parentName:"p",href:"http://127.0.0.1:30000"},"http://127.0.0.1:30000"),"\uff1a"),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"app-preview",src:n(92287).Z,width:"1830",height:"330"})))}u.isMDXComponent=!0},92287:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/app-preview-de5274f4267fa725d2a65099e47c6c2c.png"}}]); \ No newline at end of file diff --git a/assets/js/1b95d76e.03d4d1b3.js b/assets/js/1b95d76e.03d4d1b3.js deleted file mode 100644 index c2b584fb97c..00000000000 --- a/assets/js/1b95d76e.03d4d1b3.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7651],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>u});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),d=p(n),u=a,f=d["".concat(c,".").concat(u)]||d[u]||m[u]||o;return n?r.createElement(f,i(i({ref:t},s),{},{components:n})):r.createElement(f,i({ref:t},s))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=d;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const o={id:"project-stack-config-items",sidebar_label:"Project & Stack Config Items"},i="Project & Stack Config Items",l={unversionedId:"reference/model/project-stack-config-items",id:"version-v0.9/reference/model/project-stack-config-items",title:"Project & Stack Config Items",description:"In project.yaml and stack.yaml, users can add config items for their applications such as the project or stack names, generator types, Prometheus monitoring, etc. Below, we will provide the explanations for both config file.",source:"@site/docs_versioned_docs/version-v0.9/reference/model/project-stack-config-items.md",sourceDirName:"reference/model",slug:"/reference/model/project-stack-config-items",permalink:"/docs/v0.9/reference/model/project-stack-config-items",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/project-stack-config-items.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{id:"project-stack-config-items",sidebar_label:"Project & Stack Config Items"},sidebar:"kusion",previous:{title:"Naming Conventions",permalink:"/docs/v0.9/reference/model/naming-conventions"},next:{title:"Roadmap",permalink:"/docs/v0.9/reference/roadmap"}},c={},p=[{value:"project.yaml",id:"projectyaml",level:2},{value:"Backend Configuration",id:"backend-configuration",level:3},{value:"stack.yaml",id:"stackyaml",level:2}],s={toc:p};function m(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"project--stack-config-items"},"Project & Stack Config Items"),(0,a.kt)("p",null,"In ",(0,a.kt)("strong",{parentName:"p"},"project.yaml")," and ",(0,a.kt)("strong",{parentName:"p"},"stack.yaml"),", users can add config items for their applications such as the project or stack names, generator types, Prometheus monitoring, etc. Below, we will provide the explanations for both config file. "),(0,a.kt)("h2",{id:"projectyaml"},"project.yaml"),(0,a.kt)("p",null,"Here is an example of ",(0,a.kt)("inlineCode",{parentName:"p"},"project.yaml"),". "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},"# The project basic info\nname: helloworld\nprometheus:\n operatorMode: True\n monitorType: Service\n")),(0,a.kt)("p",null,"The config items in ",(0,a.kt)("inlineCode",{parentName:"p"},"project.yaml")," are explained below. "),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"name"),": The name of the project. "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"prometheus"),": ",(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"operatorMode"),": Decides whether Kusion runs Prometheus in ",(0,a.kt)("strong",{parentName:"li"},"Operator")," mode. Kusion will generate a ",(0,a.kt)("strong",{parentName:"li"},"Custom Resource")," if it is ",(0,a.kt)("strong",{parentName:"li"},"true"),", while generate some annotations if it is ",(0,a.kt)("strong",{parentName:"li"},"false"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"monitorType"),": The type of the monitored resource, which can be one of ",(0,a.kt)("inlineCode",{parentName:"li"},"Service")," or ",(0,a.kt)("inlineCode",{parentName:"li"},"Pod"),". ")))),(0,a.kt)("h3",{id:"backend-configuration"},"Backend Configuration"),(0,a.kt)("p",null,"Kusion supports configuring the storage of state through the ",(0,a.kt)("inlineCode",{parentName:"p"},"backend")," field in the ",(0,a.kt)("inlineCode",{parentName:"p"},"project.yaml")," file. Detailed instructions can be found in ",(0,a.kt)("a",{parentName:"p",href:"/docs/v0.9/reference/cli/backend/backend-configuration"},"Backend Configuration")),(0,a.kt)("h2",{id:"stackyaml"},"stack.yaml"),(0,a.kt)("p",null,"Here is an example of ",(0,a.kt)("inlineCode",{parentName:"p"},"stack.yaml"),". "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},"# The stack basic info\nname: dev\nkubeConfig: /Users/username/.kube/config\n")),(0,a.kt)("p",null,"The config items in ",(0,a.kt)("inlineCode",{parentName:"p"},"stack.yaml")," are explained below. "),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"name"),": The name of the stack, typically the environment of the project, e.g. ",(0,a.kt)("inlineCode",{parentName:"li"},"dev"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"pre")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"prod"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"kubeConfig"),": The kubeconfig file path for this stack. ")),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"The ",(0,a.kt)("inlineCode",{parentName:"p"},"kubeConfig")," field in the ",(0,a.kt)("inlineCode",{parentName:"p"},"stack.yaml")," file only supports ",(0,a.kt)("strong",{parentName:"p"},"absolute path")," and ",(0,a.kt)("strong",{parentName:"p"},"relative path")," with a dot (.) or double dots (..). Expansions for tilde (~) and $HOME are not supported yet. ")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1b95d76e.5e3ecc75.js b/assets/js/1b95d76e.5e3ecc75.js new file mode 100644 index 00000000000..2741052260c --- /dev/null +++ b/assets/js/1b95d76e.5e3ecc75.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7651],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>u});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),d=p(n),u=a,f=d["".concat(c,".").concat(u)]||d[u]||m[u]||o;return n?r.createElement(f,i(i({ref:t},s),{},{components:n})):r.createElement(f,i({ref:t},s))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=d;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const o={id:"project-stack-config-items",sidebar_label:"Project & Stack Config Items"},i="Project & Stack Config Items",l={unversionedId:"reference/model/project-stack-config-items",id:"version-v0.9/reference/model/project-stack-config-items",title:"Project & Stack Config Items",description:"In project.yaml and stack.yaml, users can add config items for their applications such as the project or stack names, generator types, Prometheus monitoring, etc. Below, we will provide the explanations for both config file.",source:"@site/docs_versioned_docs/version-v0.9/reference/model/project-stack-config-items.md",sourceDirName:"reference/model",slug:"/reference/model/project-stack-config-items",permalink:"/docs/v0.9/reference/model/project-stack-config-items",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/project-stack-config-items.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{id:"project-stack-config-items",sidebar_label:"Project & Stack Config Items"},sidebar:"kusion",previous:{title:"Naming Conventions",permalink:"/docs/v0.9/reference/model/naming-conventions"},next:{title:"Roadmap",permalink:"/docs/v0.9/reference/roadmap"}},c={},p=[{value:"project.yaml",id:"projectyaml",level:2},{value:"Backend Configuration",id:"backend-configuration",level:3},{value:"stack.yaml",id:"stackyaml",level:2}],s={toc:p};function m(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"project--stack-config-items"},"Project & Stack Config Items"),(0,a.kt)("p",null,"In ",(0,a.kt)("strong",{parentName:"p"},"project.yaml")," and ",(0,a.kt)("strong",{parentName:"p"},"stack.yaml"),", users can add config items for their applications such as the project or stack names, generator types, Prometheus monitoring, etc. Below, we will provide the explanations for both config file. "),(0,a.kt)("h2",{id:"projectyaml"},"project.yaml"),(0,a.kt)("p",null,"Here is an example of ",(0,a.kt)("inlineCode",{parentName:"p"},"project.yaml"),". "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},"# The project basic info\nname: helloworld\nprometheus:\n operatorMode: True\n monitorType: Service\n")),(0,a.kt)("p",null,"The config items in ",(0,a.kt)("inlineCode",{parentName:"p"},"project.yaml")," are explained below. "),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"name"),": The name of the project. "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"prometheus"),": ",(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"operatorMode"),": Decides whether Kusion runs Prometheus in ",(0,a.kt)("strong",{parentName:"li"},"Operator")," mode. Kusion will generate a ",(0,a.kt)("strong",{parentName:"li"},"Custom Resource")," if it is ",(0,a.kt)("strong",{parentName:"li"},"true"),", while generate some annotations if it is ",(0,a.kt)("strong",{parentName:"li"},"false"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"monitorType"),": The type of the monitored resource, which can be one of ",(0,a.kt)("inlineCode",{parentName:"li"},"Service")," or ",(0,a.kt)("inlineCode",{parentName:"li"},"Pod"),". ")))),(0,a.kt)("h3",{id:"backend-configuration"},"Backend Configuration"),(0,a.kt)("p",null,"Kusion supports configuring the storage of state through the ",(0,a.kt)("inlineCode",{parentName:"p"},"backend")," field in the ",(0,a.kt)("inlineCode",{parentName:"p"},"project.yaml")," file. Detailed instructions can be found in ",(0,a.kt)("a",{parentName:"p",href:"/docs/v0.9/reference/cli/backend/backend-configuration"},"Backend Configuration")),(0,a.kt)("h2",{id:"stackyaml"},"stack.yaml"),(0,a.kt)("p",null,"Here is an example of ",(0,a.kt)("inlineCode",{parentName:"p"},"stack.yaml"),". "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},"# The stack basic info\nname: dev\nkubeConfig: /Users/username/.kube/config\n")),(0,a.kt)("p",null,"The config items in ",(0,a.kt)("inlineCode",{parentName:"p"},"stack.yaml")," are explained below. "),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"name"),": The name of the stack, typically the environment of the project, e.g. ",(0,a.kt)("inlineCode",{parentName:"li"},"dev"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"pre")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"prod"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"kubeConfig"),": The kubeconfig file path for this stack. ")),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"The ",(0,a.kt)("inlineCode",{parentName:"p"},"kubeConfig")," field in the ",(0,a.kt)("inlineCode",{parentName:"p"},"stack.yaml")," file only supports ",(0,a.kt)("strong",{parentName:"p"},"absolute path")," and ",(0,a.kt)("strong",{parentName:"p"},"relative path")," with a dot (.) or double dots (..). Expansions for tilde (~) and $HOME are not supported yet. ")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1b9ff86e.1e420a8e.js b/assets/js/1b9ff86e.1e420a8e.js new file mode 100644 index 00000000000..72b5114a3b3 --- /dev/null +++ b/assets/js/1b9ff86e.1e420a8e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[340],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),m=l(n),d=o,f=m["".concat(c,".").concat(d)]||m[d]||u[d]||a;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=m;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={},i="Kusion Commands",s={unversionedId:"reference/commands/index",id:"version-v0.11/reference/commands/index",title:"Kusion Commands",description:"Kusion is the Platform Orchestrator of KusionStack",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/index.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/",permalink:"/docs/reference/commands/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/index.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Using Cloud Secrets Manager",permalink:"/docs/user-guides/secrets-management/using-cloud-secrets"},next:{title:"kusion apply",permalink:"/docs/reference/commands/kusion-apply"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-commands"},"Kusion Commands"),(0,o.kt)("p",null,"Kusion is the Platform Orchestrator of KusionStack"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"As a Platform Orchestrator, Kusion delivers user intentions to Kubernetes, Clouds and On-Premise resources. Also enables asynchronous cooperation between the development and the platform team and drives the separation of concerns."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion [flags]\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' -h, --help help for kusion\n --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-apply"},"kusion apply"),"\t - Apply the operational intent of various resources to multiple runtimes"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-config"},"kusion config"),"\t - Interact with the Kusion config"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-destroy"},"kusion destroy"),"\t - Destroy resources within the stack."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-generate"},"kusion generate"),"\t - Generate and print the resulting Spec resources of target Stack"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-init"},"kusion init"),"\t - Initialize the scaffolding for a demo project"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-mod"},"kusion mod"),"\t - Manage Kusion modules"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-options"},"kusion options"),"\t - Print the list of flags inherited by all commands"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-preview"},"kusion preview"),"\t - Preview a series of resource changes within the stack"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-project"},"kusion project"),"\t - Project is a folder that contains a project.yaml file and is linked to a Git repository"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-stack"},"kusion stack"),"\t - Stack is a folder that contains a stack.yaml file within the corresponding project directory"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-version"},"kusion version"),"\t - Print the Kusion version information for the current context"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1b9ff86e.f8a2e2b1.js b/assets/js/1b9ff86e.f8a2e2b1.js deleted file mode 100644 index 3ce88a3e2bf..00000000000 --- a/assets/js/1b9ff86e.f8a2e2b1.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[340],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),m=l(n),d=o,f=m["".concat(c,".").concat(d)]||m[d]||u[d]||a;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=m;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={},i="Kusion Commands",s={unversionedId:"reference/commands/index",id:"version-v0.11/reference/commands/index",title:"Kusion Commands",description:"Kusion is the Platform Orchestrator of KusionStack",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/index.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/",permalink:"/docs/reference/commands/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/index.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Using Cloud Secrets Manager",permalink:"/docs/user-guides/secrets-management/using-cloud-secrets"},next:{title:"kusion apply",permalink:"/docs/reference/commands/kusion-apply"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-commands"},"Kusion Commands"),(0,o.kt)("p",null,"Kusion is the Platform Orchestrator of KusionStack"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"As a Platform Orchestrator, Kusion delivers user intentions to Kubernetes, Clouds and On-Premise resources. Also enables asynchronous cooperation between the development and the platform team and drives the separation of concerns."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion [flags]\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' -h, --help help for kusion\n --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-apply"},"kusion apply"),"\t - Apply the operational intent of various resources to multiple runtimes"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-config"},"kusion config"),"\t - Interact with the Kusion config"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-destroy"},"kusion destroy"),"\t - Destroy resources within the stack."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-generate"},"kusion generate"),"\t - Generate and print the resulting Spec resources of target Stack"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-init"},"kusion init"),"\t - Initialize the scaffolding for a demo project"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-mod"},"kusion mod"),"\t - Manage Kusion modules"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-options"},"kusion options"),"\t - Print the list of flags inherited by all commands"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-preview"},"kusion preview"),"\t - Preview a series of resource changes within the stack"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-project"},"kusion project"),"\t - Project is a folder that contains a project.yaml file and is linked to a Git repository"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-stack"},"kusion stack"),"\t - Stack is a folder that contains a stack.yaml file within the corresponding project directory"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-version"},"kusion version"),"\t - Print the Kusion version information for the current context"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1bd21934.3f9288e7.js b/assets/js/1bd21934.3f9288e7.js new file mode 100644 index 00000000000..f725fd97e91 --- /dev/null +++ b/assets/js/1bd21934.3f9288e7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2530],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>u});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},d=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),m=p(r),u=a,k=m["".concat(c,".").concat(u)]||m[u]||s[u]||o;return r?n.createElement(k,l(l({ref:t},d),{},{components:r})):n.createElement(k,l({ref:t},d))}));function u(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=m;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>s,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var n=r(87462),a=(r(67294),r(3905));const o={},l="port",i={unversionedId:"reference/model/catalog_models/internal/network/doc_port",id:"version-v0.9/reference/model/catalog_models/internal/network/doc_port",title:"port",description:"Schema Port",source:"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/network/doc_port.md",sourceDirName:"reference/model/catalog_models/internal/network",slug:"/reference/model/catalog_models/internal/network/doc_port",permalink:"/docs/v0.9/reference/model/catalog_models/internal/network/doc_port",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/network/doc_port.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"common",permalink:"/docs/v0.9/reference/model/catalog_models/internal/doc_common"},next:{title:"secret",permalink:"/docs/v0.9/reference/model/catalog_models/internal/secret/doc_secret"}},c={},p=[{value:"Schema Port",id:"schema-port",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],d={toc:p};function s(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"port"},"port"),(0,a.kt)("h2",{id:"schema-port"},"Schema Port"),(0,a.kt)("p",null,"Port defines the exposed port of Service, which can be used to describe how the Service",(0,a.kt)("br",null),"get accessed."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"port"),(0,a.kt)("br",null),"The exposed port of the Service."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"80"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"targetPort"),(0,a.kt)("br",null),"The backend container port. If empty, set it the same as the port."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"protocol"),(0,a.kt)("br",null),"The protocol to access the port."),(0,a.kt)("td",{parentName:"tr",align:null},'"TCP" ',"|",' "UDP"'),(0,a.kt)("td",{parentName:"tr",align:null},'"TCP"'),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"public"),(0,a.kt)("br",null),"Public defines whether the port can be accessed through Internet."),(0,a.kt)("td",{parentName:"tr",align:null},"bool"),(0,a.kt)("td",{parentName:"tr",align:null},"False"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.network as n\n\nport = n.Port {\n port: 80\n targetPort: 8080\n protocol: "TCP"\n public: True\n}\n')))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1bd21934.d404b432.js b/assets/js/1bd21934.d404b432.js deleted file mode 100644 index 44100c0a6d5..00000000000 --- a/assets/js/1bd21934.d404b432.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2530],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>u});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},d=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),m=p(r),u=a,k=m["".concat(c,".").concat(u)]||m[u]||s[u]||o;return r?n.createElement(k,l(l({ref:t},d),{},{components:r})):n.createElement(k,l({ref:t},d))}));function u(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=m;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>s,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var n=r(87462),a=(r(67294),r(3905));const o={},l="port",i={unversionedId:"reference/model/catalog_models/internal/network/doc_port",id:"version-v0.9/reference/model/catalog_models/internal/network/doc_port",title:"port",description:"Schema Port",source:"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/network/doc_port.md",sourceDirName:"reference/model/catalog_models/internal/network",slug:"/reference/model/catalog_models/internal/network/doc_port",permalink:"/docs/v0.9/reference/model/catalog_models/internal/network/doc_port",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/network/doc_port.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"common",permalink:"/docs/v0.9/reference/model/catalog_models/internal/doc_common"},next:{title:"secret",permalink:"/docs/v0.9/reference/model/catalog_models/internal/secret/doc_secret"}},c={},p=[{value:"Schema Port",id:"schema-port",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],d={toc:p};function s(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"port"},"port"),(0,a.kt)("h2",{id:"schema-port"},"Schema Port"),(0,a.kt)("p",null,"Port defines the exposed port of Service, which can be used to describe how the Service",(0,a.kt)("br",null),"get accessed."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"port"),(0,a.kt)("br",null),"The exposed port of the Service."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"80"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"targetPort"),(0,a.kt)("br",null),"The backend container port. If empty, set it the same as the port."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"protocol"),(0,a.kt)("br",null),"The protocol to access the port."),(0,a.kt)("td",{parentName:"tr",align:null},'"TCP" ',"|",' "UDP"'),(0,a.kt)("td",{parentName:"tr",align:null},'"TCP"'),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"public"),(0,a.kt)("br",null),"Public defines whether the port can be accessed through Internet."),(0,a.kt)("td",{parentName:"tr",align:null},"bool"),(0,a.kt)("td",{parentName:"tr",align:null},"False"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.network as n\n\nport = n.Port {\n port: 80\n targetPort: 8080\n protocol: "TCP"\n public: True\n}\n')))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1ec179f1.70173c27.js b/assets/js/1ec179f1.70173c27.js new file mode 100644 index 00000000000..d37fd704eee --- /dev/null +++ b/assets/js/1ec179f1.70173c27.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6814],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),l=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=l(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),d=l(n),f=o,m=d["".concat(s,".").concat(f)]||d[f]||u[f]||a;return n?r.createElement(m,i(i({ref:t},c),{},{components:n})):r.createElement(m,i({ref:t},c))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=d;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p.mdxType="string"==typeof e?e:o,i[1]=p;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>p,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={},i="kusion apply",p={unversionedId:"reference/commands/kusion-apply",id:"version-v0.10/reference/commands/kusion-apply",title:"kusion apply",description:"Apply the operational intent of various resources to multiple runtimes",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-apply.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-apply",permalink:"/docs/v0.10/reference/commands/kusion-apply",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-apply.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Kusion Commands",permalink:"/docs/v0.10/reference/commands/"},next:{title:"kusion build",permalink:"/docs/v0.10/reference/commands/kusion-build"}},s={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],c={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-apply"},"kusion apply"),(0,o.kt)("p",null,"Apply the operational intent of various resources to multiple runtimes"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Apply a series of resource changes within the stack."),(0,o.kt)("p",null," Create, update or delete resources according to the operational intent within a stack. By default, Kusion will generate an execution plan and prompt for your approval before performing any actions. You can review the plan details and make a decision to proceed with the actions or abort them."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion apply [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Apply with specified work directory\n kusion apply -w /path/to/workdir\n \n # Apply with specified arguments\n kusion apply -D name=test -D age=18\n \n # Apply with specified intent file\n kusion apply --intent-file intent.yaml\n \n # Apply with specifying intent file\n kusion apply --intent-file intent.yaml\n \n # Skip interactive approval of plan details before applying\n kusion apply --yes\n \n # Apply without output style and color\n kusion apply --no-style=true\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -a, --all --detail Automatically show all plan details, combined use with flag --detail\n -D, --argument stringToString Specify the top-level argument (default [])\n -C, --backend-config strings backend-config config state storage backend\n --backend-type string backend-type specify state storage backend\n -d, --detail Automatically show plan details with interactive options\n --dry-run Preview the execution effect (always successful) without actually applying the changes\n -h, --help help for apply\n --ignore-fields strings Ignore differences of target fields\n --intent-file string Specify the intent file path as input, and the intent file must be located in the working directory or its subdirectories\n --no-style no-style sets to RawOutput mode and disables all of styling\n --operator string Specify the operator\n -o, --output string Specify the output format\n -Y, --setting strings Specify the command line setting files\n --watch After creating/updating/deleting the requested object, watch for changes\n -w, --workdir string Specify the work directory\n -y, --yes Automatically approve and perform the update after previewing it\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of KusionStack")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1ec179f1.ee7eaa9a.js b/assets/js/1ec179f1.ee7eaa9a.js deleted file mode 100644 index 62ec1ead1c1..00000000000 --- a/assets/js/1ec179f1.ee7eaa9a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6814],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),l=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},c=function(e){var t=l(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,s=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),d=l(n),f=o,m=d["".concat(s,".").concat(f)]||d[f]||u[f]||i;return n?r.createElement(m,a(a({ref:t},c),{},{components:n})):r.createElement(m,a({ref:t},c))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=d;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p.mdxType="string"==typeof e?e:o,a[1]=p;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>p,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const i={},a="kusion apply",p={unversionedId:"reference/commands/kusion-apply",id:"version-v0.10/reference/commands/kusion-apply",title:"kusion apply",description:"Apply the operational intent of various resources to multiple runtimes",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-apply.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-apply",permalink:"/docs/v0.10/reference/commands/kusion-apply",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-apply.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Kusion Commands",permalink:"/docs/v0.10/reference/commands/"},next:{title:"kusion build",permalink:"/docs/v0.10/reference/commands/kusion-build"}},s={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],c={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-apply"},"kusion apply"),(0,o.kt)("p",null,"Apply the operational intent of various resources to multiple runtimes"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Apply a series of resource changes within the stack."),(0,o.kt)("p",null," Create, update or delete resources according to the operational intent within a stack. By default, Kusion will generate an execution plan and prompt for your approval before performing any actions. You can review the plan details and make a decision to proceed with the actions or abort them."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion apply [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Apply with specified work directory\n kusion apply -w /path/to/workdir\n \n # Apply with specified arguments\n kusion apply -D name=test -D age=18\n \n # Apply with specified intent file\n kusion apply --intent-file intent.yaml\n \n # Apply with specifying intent file\n kusion apply --intent-file intent.yaml\n \n # Skip interactive approval of plan details before applying\n kusion apply --yes\n \n # Apply without output style and color\n kusion apply --no-style=true\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -a, --all --detail Automatically show all plan details, combined use with flag --detail\n -D, --argument stringToString Specify the top-level argument (default [])\n -C, --backend-config strings backend-config config state storage backend\n --backend-type string backend-type specify state storage backend\n -d, --detail Automatically show plan details with interactive options\n --dry-run Preview the execution effect (always successful) without actually applying the changes\n -h, --help help for apply\n --ignore-fields strings Ignore differences of target fields\n --intent-file string Specify the intent file path as input, and the intent file must be located in the working directory or its subdirectories\n --no-style no-style sets to RawOutput mode and disables all of styling\n --operator string Specify the operator\n -o, --output string Specify the output format\n -Y, --setting strings Specify the command line setting files\n --watch After creating/updating/deleting the requested object, watch for changes\n -w, --workdir string Specify the work directory\n -y, --yes Automatically approve and perform the update after previewing it\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of KusionStack")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1efb9d39.91c9b74d.js b/assets/js/1efb9d39.91c9b74d.js new file mode 100644 index 00000000000..e8bf6af1455 --- /dev/null +++ b/assets/js/1efb9d39.91c9b74d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3046],{3905:(e,r,t)=>{t.d(r,{Zo:()=>p,kt:()=>m});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function s(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var l=n.createContext({}),u=function(e){var r=n.useContext(l),t=r;return e&&(t="function"==typeof e?e(r):s(s({},r),e)),t},p=function(e){var r=u(e.components);return n.createElement(l.Provider,{value:r},e.children)},c={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},d=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=u(t),m=o,f=d["".concat(l,".").concat(m)]||d[m]||c[m]||a;return t?n.createElement(f,s(s({ref:r},p),{},{components:t})):n.createElement(f,s({ref:r},p))}));function m(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=t.length,s=new Array(a);s[0]=d;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var u=2;u{t.r(r),t.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>u});var n=t(87462),o=(t(67294),t(3905));const a={},s="Roadmap",i={unversionedId:"reference/roadmap",id:"version-v0.10/reference/roadmap",title:"Roadmap",description:"For a finer-grained view into our roadmap and what is being worked on for a release, please refer to the GitHub Issue Tracker",source:"@site/docs_versioned_docs/version-v0.10/6-reference/3-roadmap.md",sourceDirName:"6-reference",slug:"/reference/roadmap",permalink:"/docs/v0.10/reference/roadmap",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/3-roadmap.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{},sidebar:"kusion",previous:{title:"Resource Naming Conventions",permalink:"/docs/v0.10/reference/modules/naming-conventions"},next:{title:"Installation",permalink:"/docs/v0.10/faq/install-error"}},l={},u=[{value:"Resource Ecosystem",id:"resource-ecosystem",level:2},{value:"App Progressive Rollout",id:"app-progressive-rollout",level:2},{value:"Custom Pipelines",id:"custom-pipelines",level:2},{value:"Runtime Plugin",id:"runtime-plugin",level:2}],p={toc:u};function c(e){let{components:r,...t}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"roadmap"},"Roadmap"),(0,o.kt)("p",null,"For a finer-grained view into our roadmap and what is being worked on for a release, please refer to the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/issues"},"GitHub Issue Tracker")),(0,o.kt)("h2",{id:"resource-ecosystem"},"Resource Ecosystem"),(0,o.kt)("p",null,"We plan to expand the range of resource types that our platform can handle. This includes not only traditional cloud IaaS resources, but also popular cloud-native products such as Prometheus, istio and Argo. By supporting a wider variety of resources, we aim to address the heterogeneous needs of modern applications and allow users to harness the full power of the cloud-native technologies."),(0,o.kt)("h2",{id:"app-progressive-rollout"},"App Progressive Rollout"),(0,o.kt)("p",null,"One of the key challenges in delivering applications at scale is to balance the need for speed with the need for reliability. To help our users achieve this balance, we will introduce progressive rollout strategies, such as canary release, rolling release, and percentage release. These techniques enable users to test new features or versions on a small subset of their users or infrastructure before rolling them out to the entire system. By doing so, users can minimize the risk of downtime or errors caused by untested changes."),(0,o.kt)("h2",{id:"custom-pipelines"},"Custom Pipelines"),(0,o.kt)("p",null,"Thie current workflow of KusionStack is ",(0,o.kt)("inlineCode",{parentName:"p"},"write"),",",(0,o.kt)("inlineCode",{parentName:"p"},"preview")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"apply"),", but to handle more complex deployments we need to empower users to customize the deployment pipelines to fit their specific workflows and requirements. This includes the ability to define custom stages, add or remove steps, and integrate with third-party tools. With customizable pipelines, users can streamline their deployment process, automate repetitive tasks, and satisfy their own needs by themselves."),(0,o.kt)("h2",{id:"runtime-plugin"},"Runtime Plugin"),(0,o.kt)("p",null,"We have already supported IaaS cloud resources and Kubernetes resources, but we need a more flexible mechanism to support a broader range of on-premise infrastructure. By supporting a diverse set of infrastructures, we can help users avoid vendor lock-in, optimize their resource usage, and scale their applications across different regions and geographies."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1efb9d39.e674c412.js b/assets/js/1efb9d39.e674c412.js deleted file mode 100644 index ee097aec7fd..00000000000 --- a/assets/js/1efb9d39.e674c412.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3046],{3905:(e,r,t)=>{t.d(r,{Zo:()=>p,kt:()=>m});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function s(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var l=n.createContext({}),u=function(e){var r=n.useContext(l),t=r;return e&&(t="function"==typeof e?e(r):s(s({},r),e)),t},p=function(e){var r=u(e.components);return n.createElement(l.Provider,{value:r},e.children)},c={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},d=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=u(t),m=o,f=d["".concat(l,".").concat(m)]||d[m]||c[m]||a;return t?n.createElement(f,s(s({ref:r},p),{},{components:t})):n.createElement(f,s({ref:r},p))}));function m(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=t.length,s=new Array(a);s[0]=d;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var u=2;u{t.r(r),t.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>u});var n=t(87462),o=(t(67294),t(3905));const a={},s="Roadmap",i={unversionedId:"reference/roadmap",id:"version-v0.10/reference/roadmap",title:"Roadmap",description:"For a finer-grained view into our roadmap and what is being worked on for a release, please refer to the GitHub Issue Tracker",source:"@site/docs_versioned_docs/version-v0.10/6-reference/3-roadmap.md",sourceDirName:"6-reference",slug:"/reference/roadmap",permalink:"/docs/v0.10/reference/roadmap",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/3-roadmap.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{},sidebar:"kusion",previous:{title:"Resource Naming Conventions",permalink:"/docs/v0.10/reference/modules/naming-conventions"},next:{title:"Installation",permalink:"/docs/v0.10/faq/install-error"}},l={},u=[{value:"Resource Ecosystem",id:"resource-ecosystem",level:2},{value:"App Progressive Rollout",id:"app-progressive-rollout",level:2},{value:"Custom Pipelines",id:"custom-pipelines",level:2},{value:"Runtime Plugin",id:"runtime-plugin",level:2}],p={toc:u};function c(e){let{components:r,...t}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"roadmap"},"Roadmap"),(0,o.kt)("p",null,"For a finer-grained view into our roadmap and what is being worked on for a release, please refer to the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/issues"},"GitHub Issue Tracker")),(0,o.kt)("h2",{id:"resource-ecosystem"},"Resource Ecosystem"),(0,o.kt)("p",null,"We plan to expand the range of resource types that our platform can handle. This includes not only traditional cloud IaaS resources, but also popular cloud-native products such as Prometheus, istio and Argo. By supporting a wider variety of resources, we aim to address the heterogeneous needs of modern applications and allow users to harness the full power of the cloud-native technologies."),(0,o.kt)("h2",{id:"app-progressive-rollout"},"App Progressive Rollout"),(0,o.kt)("p",null,"One of the key challenges in delivering applications at scale is to balance the need for speed with the need for reliability. To help our users achieve this balance, we will introduce progressive rollout strategies, such as canary release, rolling release, and percentage release. These techniques enable users to test new features or versions on a small subset of their users or infrastructure before rolling them out to the entire system. By doing so, users can minimize the risk of downtime or errors caused by untested changes."),(0,o.kt)("h2",{id:"custom-pipelines"},"Custom Pipelines"),(0,o.kt)("p",null,"Thie current workflow of KusionStack is ",(0,o.kt)("inlineCode",{parentName:"p"},"write"),",",(0,o.kt)("inlineCode",{parentName:"p"},"preview")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"apply"),", but to handle more complex deployments we need to empower users to customize the deployment pipelines to fit their specific workflows and requirements. This includes the ability to define custom stages, add or remove steps, and integrate with third-party tools. With customizable pipelines, users can streamline their deployment process, automate repetitive tasks, and satisfy their own needs by themselves."),(0,o.kt)("h2",{id:"runtime-plugin"},"Runtime Plugin"),(0,o.kt)("p",null,"We have already supported IaaS cloud resources and Kubernetes resources, but we need a more flexible mechanism to support a broader range of on-premise infrastructure. By supporting a diverse set of infrastructures, we can help users avoid vendor lock-in, optimize their resource usage, and scale their applications across different regions and geographies."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1f997fd4.89e6fc1e.js b/assets/js/1f997fd4.55636f89.js similarity index 52% rename from assets/js/1f997fd4.89e6fc1e.js rename to assets/js/1f997fd4.55636f89.js index 51216d98084..4fa8aa096e8 100644 --- a/assets/js/1f997fd4.89e6fc1e.js +++ b/assets/js/1f997fd4.55636f89.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7717],{3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>d});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function s(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var l=r.createContext({}),c=function(e){var n=r.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},u=function(e){var n=c(e.components);return r.createElement(l.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,u=a(e,["components","mdxType","originalType","parentName"]),f=c(t),d=o,m=f["".concat(l,".").concat(d)]||f[d]||p[d]||i;return t?r.createElement(m,s(s({ref:n},u),{},{components:t})):r.createElement(m,s({ref:n},u))}));function d(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,s=new Array(i);s[0]=f;var a={};for(var l in n)hasOwnProperty.call(n,l)&&(a[l]=n[l]);a.originalType=e,a.mdxType="string"==typeof e?e:o,s[1]=a;for(var c=2;c{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>s,default:()=>p,frontMatter:()=>i,metadata:()=>a,toc:()=>c});var r=t(87462),o=(t(67294),t(3905));const i={},s="Kusion Commands",a={unversionedId:"reference/cli/kusion/index",id:"version-v0.9/reference/cli/kusion/index",title:"Kusion Commands",description:"Kusion is the platform engineering engine of KusionStack",source:"@site/docs_versioned_docs/version-v0.9/reference/cli/kusion/index.md",sourceDirName:"reference/cli/kusion",slug:"/reference/cli/kusion/",permalink:"/docs/v0.9/reference/cli/kusion/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/cli/kusion/index.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Command Line Tools",permalink:"/docs/v0.9/reference/cli/"},next:{title:"kusion apply",permalink:"/docs/v0.9/reference/cli/kusion/kusion_apply"}},l={},c=[{value:"Synopsis",id:"synopsis",level:2},{value:"Options",id:"options",level:2},{value:"SEE ALSO",id:"see-also",level:2},{value:"Auto generated by spf13/cobra on 15-Jul-2023",id:"auto-generated-by-spf13cobra-on-15-jul-2023",level:6}],u={toc:c};function p(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-commands"},"Kusion Commands"),(0,o.kt)("p",null,"Kusion is the platform engineering engine of KusionStack"),(0,o.kt)("h2",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Kusion is the platform engineering engine of KusionStack. It delivers intentions to Kubernetes, Clouds, and On-Premise resources."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion [flags]\n")),(0,o.kt)("h2",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for kusion\n")),(0,o.kt)("h2",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.9/reference/cli/kusion/kusion_apply"},"kusion apply"),"\t - Apply the operation intents of various resources to multiple runtimes"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.9/reference/cli/kusion/kusion_compile"},"kusion compile"),"\t - Compile KCL into YAML"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.9/reference/cli/kusion/kusion_destroy"},"kusion destroy"),"\t - Delete the specified resources in runtime"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.9/reference/cli/kusion/kusion_init"},"kusion init"),"\t - Initialize the scaffolding for a project"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.9/reference/cli/kusion/kusion_preview"},"kusion preview"),"\t - Preview a series of resource changes within the stack"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.9/reference/cli/kusion/kusion_version"},"kusion version"),"\t - Print the Kusion version information for the current context")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-15-jul-2023"},"Auto generated by spf13/cobra on 15-Jul-2023"))}p.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7717],{3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>d});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function s(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var l=r.createContext({}),c=function(e){var n=r.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},u=function(e){var n=c(e.components);return r.createElement(l.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,u=a(e,["components","mdxType","originalType","parentName"]),f=c(t),d=o,m=f["".concat(l,".").concat(d)]||f[d]||p[d]||i;return t?r.createElement(m,s(s({ref:n},u),{},{components:t})):r.createElement(m,s({ref:n},u))}));function d(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,s=new Array(i);s[0]=f;var a={};for(var l in n)hasOwnProperty.call(n,l)&&(a[l]=n[l]);a.originalType=e,a.mdxType="string"==typeof e?e:o,s[1]=a;for(var c=2;c{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>s,default:()=>p,frontMatter:()=>i,metadata:()=>a,toc:()=>c});var r=t(87462),o=(t(67294),t(3905));const i={},s="Kusion Commands",a={unversionedId:"reference/cli/kusion/index",id:"version-v0.9/reference/cli/kusion/index",title:"Kusion Commands",description:"Kusion is the platform engineering engine of KusionStack",source:"@site/docs_versioned_docs/version-v0.9/reference/cli/kusion/index.md",sourceDirName:"reference/cli/kusion",slug:"/reference/cli/kusion/",permalink:"/docs/v0.9/reference/cli/kusion/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/cli/kusion/index.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Command Line Tools",permalink:"/docs/v0.9/reference/cli/"},next:{title:"kusion apply",permalink:"/docs/v0.9/reference/cli/kusion/kusion_apply"}},l={},c=[{value:"Synopsis",id:"synopsis",level:2},{value:"Options",id:"options",level:2},{value:"SEE ALSO",id:"see-also",level:2},{value:"Auto generated by spf13/cobra on 15-Jul-2023",id:"auto-generated-by-spf13cobra-on-15-jul-2023",level:6}],u={toc:c};function p(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-commands"},"Kusion Commands"),(0,o.kt)("p",null,"Kusion is the platform engineering engine of KusionStack"),(0,o.kt)("h2",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Kusion is the platform engineering engine of KusionStack. It delivers intentions to Kubernetes, Clouds, and On-Premise resources."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion [flags]\n")),(0,o.kt)("h2",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for kusion\n")),(0,o.kt)("h2",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.9/reference/cli/kusion/kusion_apply"},"kusion apply"),"\t - Apply the operation intents of various resources to multiple runtimes"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.9/reference/cli/kusion/kusion_compile"},"kusion compile"),"\t - Compile KCL into YAML"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.9/reference/cli/kusion/kusion_destroy"},"kusion destroy"),"\t - Delete the specified resources in runtime"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.9/reference/cli/kusion/kusion_init"},"kusion init"),"\t - Initialize the scaffolding for a project"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.9/reference/cli/kusion/kusion_preview"},"kusion preview"),"\t - Preview a series of resource changes within the stack"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.9/reference/cli/kusion/kusion_version"},"kusion version"),"\t - Print the Kusion version information for the current context")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-15-jul-2023"},"Auto generated by spf13/cobra on 15-Jul-2023"))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1fe4756a.40e4c2a7.js b/assets/js/1fe4756a.40e4c2a7.js new file mode 100644 index 00000000000..f92db9907cb --- /dev/null +++ b/assets/js/1fe4756a.40e4c2a7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4147],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},l=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),f=p(n),m=a,u=f["".concat(c,".").concat(m)]||f[m]||d[m]||o;return n?r.createElement(u,i(i({ref:t},l),{},{components:n})):r.createElement(u,i({ref:t},l))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=f;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const o={sidebar_label:"Overview",id:"overview"},i="Overview",s={unversionedId:"concepts/stack/overview",id:"version-v0.11/concepts/stack/overview",title:"Overview",description:"A stack in Kusion is defined as a folder within the project directory that contains a stack.yaml file. Stacks provide a mechanism to isolate multiple sets of different configurations in the same project. It is also the smallest unit of operation that can be configured and deployed independently.",source:"@site/docs_versioned_docs/version-v0.11/3-concepts/2-stack/1-overview.md",sourceDirName:"3-concepts/2-stack",slug:"/concepts/stack/overview",permalink:"/docs/concepts/stack/overview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/3-concepts/2-stack/1-overview.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_label:"Overview",id:"overview"},sidebar:"kusion",previous:{title:"Project file reference",permalink:"/docs/concepts/project/configuration"},next:{title:"Stack file reference",permalink:"/docs/concepts/stack/configuration"}},c={},p=[{value:"High Level Schema",id:"high-level-schema",level:2}],l={toc:p};function d(e){let{components:t,...o}=e;return(0,a.kt)("wrapper",(0,r.Z)({},l,o,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"overview"},"Overview"),(0,a.kt)("p",null,"A stack in Kusion is defined as a folder within the project directory that contains a ",(0,a.kt)("inlineCode",{parentName:"p"},"stack.yaml")," file. Stacks provide a mechanism to isolate multiple sets of different configurations in the same project. It is also the smallest unit of operation that can be configured and deployed independently. "),(0,a.kt)("p",null,"The most common way to leverage stacks is to denote different phases of the software development lifecycle, such as ",(0,a.kt)("inlineCode",{parentName:"p"},"development"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"staging"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"production"),", etc. For instance, in the case where the image and resource requirements for an application workload might be different across different phases in the SDLC, they can be represented by different stacks in the same project, namely ",(0,a.kt)("inlineCode",{parentName:"p"},"dev"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"stage")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"prod"),"."),(0,a.kt)("p",null,'To distinguish this from the deploy-time concept of a "target environment" - which Kusion defines as ',(0,a.kt)("inlineCode",{parentName:"p"},"workspaces"),", ",(0,a.kt)("strong",{parentName:"p"},"stack")," is a development-time concept for application developers to manage different configurations. One way to illustrate the difference is that you can easily be deploying the ",(0,a.kt)("inlineCode",{parentName:"p"},"prod")," stack to multiple target environments, for example, ",(0,a.kt)("inlineCode",{parentName:"p"},"aws-prod-us-east"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"aws-prod-us-east-2")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"azure-prod-westus"),"."),(0,a.kt)("h2",{id:"high-level-schema"},"High Level Schema"),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"High_Level_Schema",src:n(4994).Z,width:"2390",height:"1487"})))}d.isMDXComponent=!0},4994:(e,t,n)=>{n.d(t,{Z:()=>r});const r=n.p+"assets/images/high-level-schema-ba34668ea6879003a582f15496c3ab6e.png"}}]); \ No newline at end of file diff --git a/assets/js/1fe4756a.ca0c0f84.js b/assets/js/1fe4756a.ca0c0f84.js deleted file mode 100644 index 72bd22f6f2c..00000000000 --- a/assets/js/1fe4756a.ca0c0f84.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4147],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},l=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),f=p(n),m=i,u=f["".concat(c,".").concat(m)]||f[m]||d[m]||o;return n?r.createElement(u,a(a({ref:t},l),{},{components:n})):r.createElement(u,a({ref:t},l))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,a=new Array(o);a[0]=f;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:i,a[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var r=n(87462),i=(n(67294),n(3905));const o={sidebar_label:"Overview",id:"overview"},a="Overview",s={unversionedId:"concepts/stack/overview",id:"version-v0.11/concepts/stack/overview",title:"Overview",description:"A stack in Kusion is defined as a folder within the project directory that contains a stack.yaml file. Stacks provide a mechanism to isolate multiple sets of different configurations in the same project. It is also the smallest unit of operation that can be configured and deployed independently.",source:"@site/docs_versioned_docs/version-v0.11/3-concepts/2-stack/1-overview.md",sourceDirName:"3-concepts/2-stack",slug:"/concepts/stack/overview",permalink:"/docs/concepts/stack/overview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/3-concepts/2-stack/1-overview.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_label:"Overview",id:"overview"},sidebar:"kusion",previous:{title:"Project file reference",permalink:"/docs/concepts/project/configuration"},next:{title:"Stack file reference",permalink:"/docs/concepts/stack/configuration"}},c={},p=[{value:"High Level Schema",id:"high-level-schema",level:2}],l={toc:p};function d(e){let{components:t,...o}=e;return(0,i.kt)("wrapper",(0,r.Z)({},l,o,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"overview"},"Overview"),(0,i.kt)("p",null,"A stack in Kusion is defined as a folder within the project directory that contains a ",(0,i.kt)("inlineCode",{parentName:"p"},"stack.yaml")," file. Stacks provide a mechanism to isolate multiple sets of different configurations in the same project. It is also the smallest unit of operation that can be configured and deployed independently. "),(0,i.kt)("p",null,"The most common way to leverage stacks is to denote different phases of the software development lifecycle, such as ",(0,i.kt)("inlineCode",{parentName:"p"},"development"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"staging"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"production"),", etc. For instance, in the case where the image and resource requirements for an application workload might be different across different phases in the SDLC, they can be represented by different stacks in the same project, namely ",(0,i.kt)("inlineCode",{parentName:"p"},"dev"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"stage")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"prod"),"."),(0,i.kt)("p",null,'To distinguish this from the deploy-time concept of a "target environment" - which Kusion defines as ',(0,i.kt)("inlineCode",{parentName:"p"},"workspaces"),", ",(0,i.kt)("strong",{parentName:"p"},"stack")," is a development-time concept for application developers to manage different configurations. One way to illustrate the difference is that you can easily be deploying the ",(0,i.kt)("inlineCode",{parentName:"p"},"prod")," stack to multiple target environments, for example, ",(0,i.kt)("inlineCode",{parentName:"p"},"aws-prod-us-east"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"aws-prod-us-east-2")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"azure-prod-westus"),"."),(0,i.kt)("h2",{id:"high-level-schema"},"High Level Schema"),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"High_Level_Schema",src:n(4994).Z,width:"2390",height:"1487"})))}d.isMDXComponent=!0},4994:(e,t,n)=>{n.d(t,{Z:()=>r});const r=n.p+"assets/images/high-level-schema-ba34668ea6879003a582f15496c3ab6e.png"}}]); \ No newline at end of file diff --git a/assets/js/20db72b2.3748d1e5.js b/assets/js/20db72b2.3748d1e5.js deleted file mode 100644 index cf4230490d9..00000000000 --- a/assets/js/20db72b2.3748d1e5.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8037],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>u});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),d=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=d(e.components);return r.createElement(c.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),p=d(n),u=a,k=p["".concat(c,".").concat(u)]||p[u]||m[u]||o;return n?r.createElement(k,l(l({ref:t},s),{},{components:n})):r.createElement(k,l({ref:t},s))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=p;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var r=n(87462),a=(n(67294),n(3905));const o={},l="common",i={unversionedId:"reference/model/catalog_models/internal/doc_common",id:"version-v0.9/reference/model/catalog_models/internal/doc_common",title:"common",description:"Schema WorkloadBase",source:"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/doc_common.md",sourceDirName:"reference/model/catalog_models/internal",slug:"/reference/model/catalog_models/internal/doc_common",permalink:"/docs/v0.9/reference/model/catalog_models/internal/doc_common",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/doc_common.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"probe",permalink:"/docs/v0.9/reference/model/catalog_models/internal/container/probe/doc_probe"},next:{title:"port",permalink:"/docs/v0.9/reference/model/catalog_models/internal/network/doc_port"}},c={},d=[{value:"Schema WorkloadBase",id:"schema-workloadbase",level:2},{value:"Attributes",id:"attributes",level:3}],s={toc:d};function m(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"common"},"common"),(0,a.kt)("h2",{id:"schema-workloadbase"},"Schema WorkloadBase"),(0,a.kt)("p",null,"WorkloadBase defines set of attributes shared by different workload profile, e.g Service",(0,a.kt)("br",null),"and Job. You can inherit this Schema to reuse these common attributes."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"containers"),(0,a.kt)("br",null),"Containers defines the templates of containers to be ran.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers"},"https://kubernetes.io/docs/concepts/containers")),(0,a.kt)("td",{parentName:"tr",align:null},"{str: ",(0,a.kt)("a",{parentName:"td",href:"/docs/v0.9/reference/model/catalog_models/internal/container/doc_container#schema-container"},"container.Container"),"}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"secrets")),(0,a.kt)("td",{parentName:"tr",align:null},"{str: ",(0,a.kt)("a",{parentName:"td",href:"/docs/v0.9/reference/model/catalog_models/internal/secret/doc_secret#schema-secret"},"secret.Secret"),"}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"replicas"),(0,a.kt)("br",null),"Number of container replicas based on this configuration that should be ran."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"2"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels"),(0,a.kt)("br",null),"Labels are key/value pairs that are attached to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations"),(0,a.kt)("br",null),"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/20db72b2.64bf6dd5.js b/assets/js/20db72b2.64bf6dd5.js new file mode 100644 index 00000000000..de3b3518fa5 --- /dev/null +++ b/assets/js/20db72b2.64bf6dd5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8037],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>u});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),d=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=d(e.components);return r.createElement(c.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),p=d(n),u=a,k=p["".concat(c,".").concat(u)]||p[u]||m[u]||o;return n?r.createElement(k,l(l({ref:t},s),{},{components:n})):r.createElement(k,l({ref:t},s))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=p;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var r=n(87462),a=(n(67294),n(3905));const o={},l="common",i={unversionedId:"reference/model/catalog_models/internal/doc_common",id:"version-v0.9/reference/model/catalog_models/internal/doc_common",title:"common",description:"Schema WorkloadBase",source:"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/doc_common.md",sourceDirName:"reference/model/catalog_models/internal",slug:"/reference/model/catalog_models/internal/doc_common",permalink:"/docs/v0.9/reference/model/catalog_models/internal/doc_common",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/doc_common.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"probe",permalink:"/docs/v0.9/reference/model/catalog_models/internal/container/probe/doc_probe"},next:{title:"port",permalink:"/docs/v0.9/reference/model/catalog_models/internal/network/doc_port"}},c={},d=[{value:"Schema WorkloadBase",id:"schema-workloadbase",level:2},{value:"Attributes",id:"attributes",level:3}],s={toc:d};function m(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"common"},"common"),(0,a.kt)("h2",{id:"schema-workloadbase"},"Schema WorkloadBase"),(0,a.kt)("p",null,"WorkloadBase defines set of attributes shared by different workload profile, e.g Service",(0,a.kt)("br",null),"and Job. You can inherit this Schema to reuse these common attributes."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"containers"),(0,a.kt)("br",null),"Containers defines the templates of containers to be ran.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers"},"https://kubernetes.io/docs/concepts/containers")),(0,a.kt)("td",{parentName:"tr",align:null},"{str: ",(0,a.kt)("a",{parentName:"td",href:"/docs/v0.9/reference/model/catalog_models/internal/container/doc_container#schema-container"},"container.Container"),"}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"secrets")),(0,a.kt)("td",{parentName:"tr",align:null},"{str: ",(0,a.kt)("a",{parentName:"td",href:"/docs/v0.9/reference/model/catalog_models/internal/secret/doc_secret#schema-secret"},"secret.Secret"),"}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"replicas"),(0,a.kt)("br",null),"Number of container replicas based on this configuration that should be ran."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"2"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels"),(0,a.kt)("br",null),"Labels are key/value pairs that are attached to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations"),(0,a.kt)("br",null),"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2115f1af.266e19d6.js b/assets/js/2115f1af.4814f939.js similarity index 51% rename from assets/js/2115f1af.266e19d6.js rename to assets/js/2115f1af.4814f939.js index 89e87d699ba..bf73699a02f 100644 --- a/assets/js/2115f1af.266e19d6.js +++ b/assets/js/2115f1af.4814f939.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8989],{3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),c=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},u=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},l={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=c(r),f=o,m=d["".concat(i,".").concat(f)]||d[f]||l[f]||a;return r?n.createElement(m,p(p({ref:t},u),{},{components:r})):n.createElement(m,p({ref:t},u))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=d;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:o,p[1]=s;for(var c=2;c{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>p,default:()=>l,frontMatter:()=>a,metadata:()=>s,toc:()=>c});var n=r(87462),o=(r(67294),r(3905));const a={},p="kusion workspace update",s={unversionedId:"reference/commands/kusion-workspace-update",id:"reference/commands/kusion-workspace-update",title:"kusion workspace update",description:"Update a workspace configuration",source:"@site/docs/kusion/6-reference/1-commands/kusion-workspace-update.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-update",permalink:"/docs/next/reference/commands/kusion-workspace-update",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-workspace-update.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace switch",permalink:"/docs/next/reference/commands/kusion-workspace-switch"},next:{title:"kusion workspace",permalink:"/docs/next/reference/commands/kusion-workspace"}},i={},c=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],u={toc:c};function l(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-update"},"kusion workspace update"),(0,o.kt)("p",null,"Update a workspace configuration"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command updates a workspace configuration with specified configuration file, where the file must be in the YAML format."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace update\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Update the current workspace\n kusion workspace update -f dev.yaml\n \n # Update a specified workspace and set as current\n kusion workspace update dev -f dev.yaml --current\n \n # Update a specified workspace in a specified backend\n kusion workspace update prod -f prod.yaml --backend oss-prod\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string the backend name\n --current set the creating workspace as current\n -f, --file string the path of workspace configuration file\n -h, --help help for update\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}l.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8989],{3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),c=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},u=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},l={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=c(r),f=o,m=d["".concat(i,".").concat(f)]||d[f]||l[f]||a;return r?n.createElement(m,p(p({ref:t},u),{},{components:r})):n.createElement(m,p({ref:t},u))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=d;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:o,p[1]=s;for(var c=2;c{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>p,default:()=>l,frontMatter:()=>a,metadata:()=>s,toc:()=>c});var n=r(87462),o=(r(67294),r(3905));const a={},p="kusion workspace update",s={unversionedId:"reference/commands/kusion-workspace-update",id:"reference/commands/kusion-workspace-update",title:"kusion workspace update",description:"Update a workspace configuration",source:"@site/docs/kusion/6-reference/1-commands/kusion-workspace-update.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-update",permalink:"/docs/next/reference/commands/kusion-workspace-update",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-workspace-update.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace switch",permalink:"/docs/next/reference/commands/kusion-workspace-switch"},next:{title:"kusion workspace",permalink:"/docs/next/reference/commands/kusion-workspace"}},i={},c=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],u={toc:c};function l(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-update"},"kusion workspace update"),(0,o.kt)("p",null,"Update a workspace configuration"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command updates a workspace configuration with specified configuration file, where the file must be in the YAML format."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace update\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Update the current workspace\n kusion workspace update -f dev.yaml\n \n # Update a specified workspace and set as current\n kusion workspace update dev -f dev.yaml --current\n \n # Update a specified workspace in a specified backend\n kusion workspace update prod -f prod.yaml --backend oss-prod\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string the backend name\n --current set the creating workspace as current\n -f, --file string the path of workspace configuration file\n -h, --help help for update\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}l.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/21746641.a22d74e2.js b/assets/js/21746641.a22d74e2.js new file mode 100644 index 00000000000..1bd8cd34252 --- /dev/null +++ b/assets/js/21746641.a22d74e2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3571],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function r(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=a.createContext({}),s=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):r(r({},n),e)),t},c=function(e){var n=s(e.components);return a.createElement(p.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(t),m=o,k=u["".concat(p,".").concat(m)]||u[m]||d[m]||i;return t?a.createElement(k,r(r({ref:n},c),{},{components:t})):a.createElement(k,r({ref:n},c))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,r=new Array(i);r[0]=u;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:o,r[1]=l;for(var s=2;s{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>r,default:()=>d,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var a=t(87462),o=(t(67294),t(3905));const i={},r="Workload",l={unversionedId:"configuration-walkthrough/workload",id:"version-v0.10/configuration-walkthrough/workload",title:"Workload",description:"The workload attribute in the AppConfiguration instance is used to describe the specification for the application workload. The application workload generally represents the computing component for the application.",source:"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/4-workload.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/workload",permalink:"/docs/v0.10/configuration-walkthrough/workload",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/4-workload.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:4,frontMatter:{},sidebar:"kusion",previous:{title:"Base and Override",permalink:"/docs/v0.10/configuration-walkthrough/base-override"},next:{title:"Application Networking",permalink:"/docs/v0.10/configuration-walkthrough/networking"}},p={},s=[{value:"Table of Content",id:"table-of-content",level:2},{value:"Import",id:"import",level:2},{value:"Types of Workloads",id:"types-of-workloads",level:2},{value:"Configure containers",id:"configure-containers",level:2},{value:"Application image",id:"application-image",level:3},{value:"Resource Requirements",id:"resource-requirements",level:3},{value:"Health Probes",id:"health-probes",level:3},{value:"Lifecycle Hooks",id:"lifecycle-hooks",level:3},{value:"Create Files",id:"create-files",level:3},{value:"Customize container initialization",id:"customize-container-initialization",level:3},{value:"Configure Replicas",id:"configure-replicas",level:2},{value:"Differences between Service and Job",id:"differences-between-service-and-job",level:2},{value:"Exposure",id:"exposure",level:3},{value:"Job Schedule",id:"job-schedule",level:3},{value:"Workload References",id:"workload-references",level:2}],c={toc:s};function d(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"workload"},"Workload"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"workload")," attribute in the ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance is used to describe the specification for the application workload. The application workload generally represents the computing component for the application."),(0,o.kt)("p",null,"A ",(0,o.kt)("inlineCode",{parentName:"p"},"workload")," maps to an ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance 1:1. If there are more than one workload, they should be considered different applications."),(0,o.kt)("h2",{id:"table-of-content"},"Table of Content"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#import"},"Import")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#types-of-workloads"},"Types of workloads")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#configure-containers"},"Configure containers"),(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#application-image"},"Application image")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#resource-requirements"},"Resource Requirements")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#health-probes"},"Health Probes")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#lifecycle-hooks"},"Lifecycle Hooks")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#create-files"},"Create Files")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#customize-container-initialization"},"Customize container initialization")))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#configure-replicas"},"Configure Replicas")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#differences-between-service-and-job"},"Differences between Service and Job")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#workload-references"},"Workload References"))),(0,o.kt)("h2",{id:"import"},"Import"),(0,o.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,o.kt)("inlineCode",{parentName:"p"},"catalog")," package. For more details on KCL package import, please refer to the ",(0,o.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.container.lifecycle as lc\n")),(0,o.kt)("h2",{id:"types-of-workloads"},"Types of Workloads"),(0,o.kt)("p",null,"There are currently two types of workloads:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"Service"),', representing a long-running, scalable workload type that should "never" go down and respond to short-lived latency-sensitive requests. This workload type is commonly used for web applications and services that expose APIs.'),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"Job"),", representing batch tasks that take from a few seconds to days to complete and then stop. These are commonly used for batch processing that is less sensitive to short-term performance fluctuations.")),(0,o.kt)("p",null,"To instantiate a ",(0,o.kt)("inlineCode",{parentName:"p"},"Service"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {}\n}\n")),(0,o.kt)("p",null,"To instantiate a ",(0,o.kt)("inlineCode",{parentName:"p"},"Job"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Job {}\n}\n")),(0,o.kt)("p",null,"Of course, the ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instances above is not sufficient to describe an application. We still need to provide more details in the ",(0,o.kt)("inlineCode",{parentName:"p"},"workload")," section."),(0,o.kt)("h2",{id:"configure-containers"},"Configure containers"),(0,o.kt)("p",null,"Kusion is built on top of cloud-native philosophies. One of which is that applications should run as loosely coupled microservices on abstract and self-contained software units, such as containers."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"containers")," attribute in a workload instance is used to define the behavior for the containers that run application workload. The ",(0,o.kt)("inlineCode",{parentName:"p"},"containers")," attribute is a map, from the name of the container to the ",(0,o.kt)("inlineCode",{parentName:"p"},"catalog.models.schema.v1.workload.container.Container")," Object which includes the container configurations."),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"The name of the container is in the context of the configuration file, so you could refer to it later. It's not referring to the name of the container in the Kubernetes cluster (or any other runtime).")),(0,o.kt)("p",null,"Everything defined in the ",(0,o.kt)("inlineCode",{parentName:"p"},"containers")," attribute is considered an application container, as opposed to a sidecar container. Sidecar containers will be introduced in a different attribute in a future version."),(0,o.kt)("p",null,"In most of the cases, only one application container is needed. Ideally, we recommend mapping an ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance to a microservice in the microservice terminology."),(0,o.kt)("p",null,"We will walk through the details of configuring a container using an example of the ",(0,o.kt)("inlineCode",{parentName:"p"},"Service")," type."),(0,o.kt)("p",null,"To add an application container:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {}\n }\n }\n}\n')),(0,o.kt)("h3",{id:"application-image"},"Application image"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"image")," attribute in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Container")," schema specifies the application image to run. This is the only required field in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Container")," schema."),(0,o.kt)("p",null,"To specify an application image:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n }\n # ...\n }\n }\n}\n')),(0,o.kt)("h3",{id:"resource-requirements"},"Resource Requirements"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"resources")," attribute in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Container")," schema specifies the application resource requirements such as cpu and memory."),(0,o.kt)("p",null,"You can specify an upper limit (which maps to resource limits only) or a range as the resource requirements (which maps to resource requests and limits in Kubernetes)."),(0,o.kt)("p",null,"To specify an upper bound (only resource limits):"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n # ...\n }\n }\n }\n}\n')),(0,o.kt)("p",null,"To specify a range (both resource requests and limits):"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # Sets requests to cpu=250m and memory=256Mi\n # Sets limits to cpu=500m and memory=512Mi\n resources: {\n "cpu": "250m-500m"\n "memory": "256Mi-512Mi"\n }\n # ...\n }\n }\n }\n}\n')),(0,o.kt)("h3",{id:"health-probes"},"Health Probes"),(0,o.kt)("p",null,"There are three types of ",(0,o.kt)("inlineCode",{parentName:"p"},"Probe")," defined in a ",(0,o.kt)("inlineCode",{parentName:"p"},"Container"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"livenessProbe")," - used to determine if the container is healthy and running"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"readinessProbe")," - used to determine if the container is ready to accept traffic"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"startupProbe")," - used to determine if the container has started properly. Liveness and readiness probes don't start until ",(0,o.kt)("inlineCode",{parentName:"li"},"startupProbe")," succeeds. Commonly used for containers that takes a while to start")),(0,o.kt)("p",null,"The probes are optional. You can only have one Probe of each kind for a given ",(0,o.kt)("inlineCode",{parentName:"p"},"Container"),"."),(0,o.kt)("p",null,"To configure a ",(0,o.kt)("inlineCode",{parentName:"p"},"Http")," type ",(0,o.kt)("inlineCode",{parentName:"p"},"readinessProbe")," that probes the health via HTTP request and a ",(0,o.kt)("inlineCode",{parentName:"p"},"Exec")," type ",(0,o.kt)("inlineCode",{parentName:"p"},"livenessProbe")," which executes a command:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # ...\n # Configure an Http type readiness probe at /healthz\n readinessProbe: p.Probe {\n probeHandler: p.Http {\n url: "/healthz"\n }\n initialDelaySeconds: 10\n timeoutSeconds: 5\n periodSeconds: 15\n successThreshold: 3\n failureThreshold: 1\n }\n # Configure an Exec type liveness probe that executes probe.sh\n livenessProbe: p.Probe {\n probeHandler: p.Exec {\n command: ["probe.sh"]\n }\n initialDelaySeconds: 10\n }\n }\n }\n }\n}\n')),(0,o.kt)("h3",{id:"lifecycle-hooks"},"Lifecycle Hooks"),(0,o.kt)("p",null,"You can also configure lifecycle hooks that triggers in response to container lifecycle events such as liveness/startup probe failure, preemption, resource contention, etc."),(0,o.kt)("p",null,"There are two types that is currently supported:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"PreStop")," - triggers before the container is terminated."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"PostStart")," - triggers after the container is initialized.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # ...\n # Configure lifecycle hooks\n lifecycle: lc.Lifecycle {\n # Configures an Exec type pre-stop hook that executes preStop.sh\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n # Configures an Http type pre-stop hook at /post-start\n postStart: p.Http {\n url: "/post-start"\n }\n }\n }\n }\n }\n}\n')),(0,o.kt)("h3",{id:"create-files"},"Create Files"),(0,o.kt)("p",null,"You can also create files on-demand during the container initialization."),(0,o.kt)("p",null,"To create a custom file and mount it to ",(0,o.kt)("inlineCode",{parentName:"p"},"/home/admin/my-file")," when the container starts:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n }\n # ...\n # Creates a file during container startup\n files: {\n "/home/admin/my-file": c.FileSpec {\n content: "some file contents"\n mode: "0777"\n }\n }\n }\n }\n}\n')),(0,o.kt)("h3",{id:"customize-container-initialization"},"Customize container initialization"),(0,o.kt)("p",null,"You can also customize the container entrypoint via ",(0,o.kt)("inlineCode",{parentName:"p"},"command"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"args"),", and ",(0,o.kt)("inlineCode",{parentName:"p"},"workingDir"),". These should ",(0,o.kt)("strong",{parentName:"p"},"most likely not be required"),". In most of the cases, the entrypoint details should be baked into the application image itself."),(0,o.kt)("p",null,"To customize the container entrypoint:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # ...\n # This command will overwrite the entrypoint set in the image Dockerfile\n command: ["/usr/local/bin/my-init-script.sh"]\n # Extra arguments append to command defined above\n args: [\n "--log-dir=/home/my-app/logs"\n "--timeout=60s"\n ]\n # Run the command as defined above, in the directory "/tmp"\n workingDir: "/tmp"\n }\n }\n }\n}\n')),(0,o.kt)("h2",{id:"configure-replicas"},"Configure Replicas"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"replicas")," field in the ",(0,o.kt)("inlineCode",{parentName:"p"},"workload")," instance describes the number of identical copies to run at the same time. It is generally recommended to have multiple replicas in production environments to eliminate any single point of failure. In Kubernetes, this corresponds to the ",(0,o.kt)("inlineCode",{parentName:"p"},"spec.replicas")," field in the relevant workload manifests."),(0,o.kt)("p",null,"To configure a workload to have a replica count of 3:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n # ...\n }\n replicas: 3\n # ...\n }\n # ...\n}\n")),(0,o.kt)("h2",{id:"differences-between-service-and-job"},"Differences between Service and Job"),(0,o.kt)("p",null,"The two types of workloads, namely ",(0,o.kt)("inlineCode",{parentName:"p"},"Service")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Job"),", share a majority of the attributes with some minor differences."),(0,o.kt)("h3",{id:"exposure"},"Exposure"),(0,o.kt)("p",null,"A ",(0,o.kt)("inlineCode",{parentName:"p"},"Service")," usually represents a long-running, scalable workload that responds to short-lived latency-sensitive requests and never go down. Hence, a ",(0,o.kt)("inlineCode",{parentName:"p"},"Service")," has an additional attribute that determines how it is exposed and can be accessed. A ",(0,o.kt)("inlineCode",{parentName:"p"},"Job")," does NOT have the option to be exposed. We will explore more in the ",(0,o.kt)("a",{parentName:"p",href:"networking"},"application networking walkthrough"),"."),(0,o.kt)("h3",{id:"job-schedule"},"Job Schedule"),(0,o.kt)("p",null,"A ",(0,o.kt)("inlineCode",{parentName:"p"},"Job")," can be configured to run in a recurring manner. In this case, the job will have a cron-format schedule that represents its recurring schedule."),(0,o.kt)("p",null,"To configure a job to run at 21:00 every night:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: wl.Job {\n containers: {\n # ...\n }\n schedule: "0 21 * * *"\n }\n')),(0,o.kt)("h2",{id:"workload-references"},"Workload References"),(0,o.kt)("p",null,"You can find workload references ",(0,o.kt)("a",{parentName:"p",href:"../reference/modules/catalog-models/workload/service"},"here"),"."),(0,o.kt)("p",null,"You can find workload schema source ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog/tree/main/models/schema/v1/workload"},"here"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/21746641.ddb36f72.js b/assets/js/21746641.ddb36f72.js deleted file mode 100644 index d838ea2cbc5..00000000000 --- a/assets/js/21746641.ddb36f72.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3571],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function r(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=a.createContext({}),s=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):r(r({},n),e)),t},c=function(e){var n=s(e.components);return a.createElement(p.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(t),m=o,k=u["".concat(p,".").concat(m)]||u[m]||d[m]||i;return t?a.createElement(k,r(r({ref:n},c),{},{components:t})):a.createElement(k,r({ref:n},c))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,r=new Array(i);r[0]=u;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:o,r[1]=l;for(var s=2;s{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>r,default:()=>d,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var a=t(87462),o=(t(67294),t(3905));const i={},r="Workload",l={unversionedId:"configuration-walkthrough/workload",id:"version-v0.10/configuration-walkthrough/workload",title:"Workload",description:"The workload attribute in the AppConfiguration instance is used to describe the specification for the application workload. The application workload generally represents the computing component for the application.",source:"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/4-workload.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/workload",permalink:"/docs/v0.10/configuration-walkthrough/workload",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/4-workload.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:4,frontMatter:{},sidebar:"kusion",previous:{title:"Base and Override",permalink:"/docs/v0.10/configuration-walkthrough/base-override"},next:{title:"Application Networking",permalink:"/docs/v0.10/configuration-walkthrough/networking"}},p={},s=[{value:"Table of Content",id:"table-of-content",level:2},{value:"Import",id:"import",level:2},{value:"Types of Workloads",id:"types-of-workloads",level:2},{value:"Configure containers",id:"configure-containers",level:2},{value:"Application image",id:"application-image",level:3},{value:"Resource Requirements",id:"resource-requirements",level:3},{value:"Health Probes",id:"health-probes",level:3},{value:"Lifecycle Hooks",id:"lifecycle-hooks",level:3},{value:"Create Files",id:"create-files",level:3},{value:"Customize container initialization",id:"customize-container-initialization",level:3},{value:"Configure Replicas",id:"configure-replicas",level:2},{value:"Differences between Service and Job",id:"differences-between-service-and-job",level:2},{value:"Exposure",id:"exposure",level:3},{value:"Job Schedule",id:"job-schedule",level:3},{value:"Workload References",id:"workload-references",level:2}],c={toc:s};function d(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"workload"},"Workload"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"workload")," attribute in the ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance is used to describe the specification for the application workload. The application workload generally represents the computing component for the application."),(0,o.kt)("p",null,"A ",(0,o.kt)("inlineCode",{parentName:"p"},"workload")," maps to an ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance 1:1. If there are more than one workload, they should be considered different applications."),(0,o.kt)("h2",{id:"table-of-content"},"Table of Content"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#import"},"Import")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#types-of-workloads"},"Types of workloads")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#configure-containers"},"Configure containers"),(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#application-image"},"Application image")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#resource-requirements"},"Resource Requirements")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#health-probes"},"Health Probes")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#lifecycle-hooks"},"Lifecycle Hooks")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#create-files"},"Create Files")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#customize-container-initialization"},"Customize container initialization")))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#configure-replicas"},"Configure Replicas")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#differences-between-service-and-job"},"Differences between Service and Job")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"#workload-references"},"Workload References"))),(0,o.kt)("h2",{id:"import"},"Import"),(0,o.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,o.kt)("inlineCode",{parentName:"p"},"catalog")," package. For more details on KCL package import, please refer to the ",(0,o.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.container.lifecycle as lc\n")),(0,o.kt)("h2",{id:"types-of-workloads"},"Types of Workloads"),(0,o.kt)("p",null,"There are currently two types of workloads:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"Service"),', representing a long-running, scalable workload type that should "never" go down and respond to short-lived latency-sensitive requests. This workload type is commonly used for web applications and services that expose APIs.'),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"Job"),", representing batch tasks that take from a few seconds to days to complete and then stop. These are commonly used for batch processing that is less sensitive to short-term performance fluctuations.")),(0,o.kt)("p",null,"To instantiate a ",(0,o.kt)("inlineCode",{parentName:"p"},"Service"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {}\n}\n")),(0,o.kt)("p",null,"To instantiate a ",(0,o.kt)("inlineCode",{parentName:"p"},"Job"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Job {}\n}\n")),(0,o.kt)("p",null,"Of course, the ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instances above is not sufficient to describe an application. We still need to provide more details in the ",(0,o.kt)("inlineCode",{parentName:"p"},"workload")," section."),(0,o.kt)("h2",{id:"configure-containers"},"Configure containers"),(0,o.kt)("p",null,"Kusion is built on top of cloud-native philosophies. One of which is that applications should run as loosely coupled microservices on abstract and self-contained software units, such as containers."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"containers")," attribute in a workload instance is used to define the behavior for the containers that run application workload. The ",(0,o.kt)("inlineCode",{parentName:"p"},"containers")," attribute is a map, from the name of the container to the ",(0,o.kt)("inlineCode",{parentName:"p"},"catalog.models.schema.v1.workload.container.Container")," Object which includes the container configurations."),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"The name of the container is in the context of the configuration file, so you could refer to it later. It's not referring to the name of the container in the Kubernetes cluster (or any other runtime).")),(0,o.kt)("p",null,"Everything defined in the ",(0,o.kt)("inlineCode",{parentName:"p"},"containers")," attribute is considered an application container, as opposed to a sidecar container. Sidecar containers will be introduced in a different attribute in a future version."),(0,o.kt)("p",null,"In most of the cases, only one application container is needed. Ideally, we recommend mapping an ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance to a microservice in the microservice terminology."),(0,o.kt)("p",null,"We will walk through the details of configuring a container using an example of the ",(0,o.kt)("inlineCode",{parentName:"p"},"Service")," type."),(0,o.kt)("p",null,"To add an application container:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {}\n }\n }\n}\n')),(0,o.kt)("h3",{id:"application-image"},"Application image"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"image")," attribute in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Container")," schema specifies the application image to run. This is the only required field in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Container")," schema."),(0,o.kt)("p",null,"To specify an application image:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n }\n # ...\n }\n }\n}\n')),(0,o.kt)("h3",{id:"resource-requirements"},"Resource Requirements"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"resources")," attribute in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Container")," schema specifies the application resource requirements such as cpu and memory."),(0,o.kt)("p",null,"You can specify an upper limit (which maps to resource limits only) or a range as the resource requirements (which maps to resource requests and limits in Kubernetes)."),(0,o.kt)("p",null,"To specify an upper bound (only resource limits):"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n # ...\n }\n }\n }\n}\n')),(0,o.kt)("p",null,"To specify a range (both resource requests and limits):"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # Sets requests to cpu=250m and memory=256Mi\n # Sets limits to cpu=500m and memory=512Mi\n resources: {\n "cpu": "250m-500m"\n "memory": "256Mi-512Mi"\n }\n # ...\n }\n }\n }\n}\n')),(0,o.kt)("h3",{id:"health-probes"},"Health Probes"),(0,o.kt)("p",null,"There are three types of ",(0,o.kt)("inlineCode",{parentName:"p"},"Probe")," defined in a ",(0,o.kt)("inlineCode",{parentName:"p"},"Container"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"livenessProbe")," - used to determine if the container is healthy and running"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"readinessProbe")," - used to determine if the container is ready to accept traffic"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"startupProbe")," - used to determine if the container has started properly. Liveness and readiness probes don't start until ",(0,o.kt)("inlineCode",{parentName:"li"},"startupProbe")," succeeds. Commonly used for containers that takes a while to start")),(0,o.kt)("p",null,"The probes are optional. You can only have one Probe of each kind for a given ",(0,o.kt)("inlineCode",{parentName:"p"},"Container"),"."),(0,o.kt)("p",null,"To configure a ",(0,o.kt)("inlineCode",{parentName:"p"},"Http")," type ",(0,o.kt)("inlineCode",{parentName:"p"},"readinessProbe")," that probes the health via HTTP request and a ",(0,o.kt)("inlineCode",{parentName:"p"},"Exec")," type ",(0,o.kt)("inlineCode",{parentName:"p"},"livenessProbe")," which executes a command:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # ...\n # Configure an Http type readiness probe at /healthz\n readinessProbe: p.Probe {\n probeHandler: p.Http {\n url: "/healthz"\n }\n initialDelaySeconds: 10\n timeoutSeconds: 5\n periodSeconds: 15\n successThreshold: 3\n failureThreshold: 1\n }\n # Configure an Exec type liveness probe that executes probe.sh\n livenessProbe: p.Probe {\n probeHandler: p.Exec {\n command: ["probe.sh"]\n }\n initialDelaySeconds: 10\n }\n }\n }\n }\n}\n')),(0,o.kt)("h3",{id:"lifecycle-hooks"},"Lifecycle Hooks"),(0,o.kt)("p",null,"You can also configure lifecycle hooks that triggers in response to container lifecycle events such as liveness/startup probe failure, preemption, resource contention, etc."),(0,o.kt)("p",null,"There are two types that is currently supported:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"PreStop")," - triggers before the container is terminated."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"PostStart")," - triggers after the container is initialized.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # ...\n # Configure lifecycle hooks\n lifecycle: lc.Lifecycle {\n # Configures an Exec type pre-stop hook that executes preStop.sh\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n # Configures an Http type pre-stop hook at /post-start\n postStart: p.Http {\n url: "/post-start"\n }\n }\n }\n }\n }\n}\n')),(0,o.kt)("h3",{id:"create-files"},"Create Files"),(0,o.kt)("p",null,"You can also create files on-demand during the container initialization."),(0,o.kt)("p",null,"To create a custom file and mount it to ",(0,o.kt)("inlineCode",{parentName:"p"},"/home/admin/my-file")," when the container starts:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n }\n # ...\n # Creates a file during container startup\n files: {\n "/home/admin/my-file": c.FileSpec {\n content: "some file contents"\n mode: "0777"\n }\n }\n }\n }\n}\n')),(0,o.kt)("h3",{id:"customize-container-initialization"},"Customize container initialization"),(0,o.kt)("p",null,"You can also customize the container entrypoint via ",(0,o.kt)("inlineCode",{parentName:"p"},"command"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"args"),", and ",(0,o.kt)("inlineCode",{parentName:"p"},"workingDir"),". These should ",(0,o.kt)("strong",{parentName:"p"},"most likely not be required"),". In most of the cases, the entrypoint details should be baked into the application image itself."),(0,o.kt)("p",null,"To customize the container entrypoint:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # ...\n # This command will overwrite the entrypoint set in the image Dockerfile\n command: ["/usr/local/bin/my-init-script.sh"]\n # Extra arguments append to command defined above\n args: [\n "--log-dir=/home/my-app/logs"\n "--timeout=60s"\n ]\n # Run the command as defined above, in the directory "/tmp"\n workingDir: "/tmp"\n }\n }\n }\n}\n')),(0,o.kt)("h2",{id:"configure-replicas"},"Configure Replicas"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"replicas")," field in the ",(0,o.kt)("inlineCode",{parentName:"p"},"workload")," instance describes the number of identical copies to run at the same time. It is generally recommended to have multiple replicas in production environments to eliminate any single point of failure. In Kubernetes, this corresponds to the ",(0,o.kt)("inlineCode",{parentName:"p"},"spec.replicas")," field in the relevant workload manifests."),(0,o.kt)("p",null,"To configure a workload to have a replica count of 3:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n # ...\n }\n replicas: 3\n # ...\n }\n # ...\n}\n")),(0,o.kt)("h2",{id:"differences-between-service-and-job"},"Differences between Service and Job"),(0,o.kt)("p",null,"The two types of workloads, namely ",(0,o.kt)("inlineCode",{parentName:"p"},"Service")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Job"),", share a majority of the attributes with some minor differences."),(0,o.kt)("h3",{id:"exposure"},"Exposure"),(0,o.kt)("p",null,"A ",(0,o.kt)("inlineCode",{parentName:"p"},"Service")," usually represents a long-running, scalable workload that responds to short-lived latency-sensitive requests and never go down. Hence, a ",(0,o.kt)("inlineCode",{parentName:"p"},"Service")," has an additional attribute that determines how it is exposed and can be accessed. A ",(0,o.kt)("inlineCode",{parentName:"p"},"Job")," does NOT have the option to be exposed. We will explore more in the ",(0,o.kt)("a",{parentName:"p",href:"networking"},"application networking walkthrough"),"."),(0,o.kt)("h3",{id:"job-schedule"},"Job Schedule"),(0,o.kt)("p",null,"A ",(0,o.kt)("inlineCode",{parentName:"p"},"Job")," can be configured to run in a recurring manner. In this case, the job will have a cron-format schedule that represents its recurring schedule."),(0,o.kt)("p",null,"To configure a job to run at 21:00 every night:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'myapp: wl.Job {\n containers: {\n # ...\n }\n schedule: "0 21 * * *"\n }\n')),(0,o.kt)("h2",{id:"workload-references"},"Workload References"),(0,o.kt)("p",null,"You can find workload references ",(0,o.kt)("a",{parentName:"p",href:"../reference/modules/catalog-models/workload/service"},"here"),"."),(0,o.kt)("p",null,"You can find workload schema source ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog/tree/main/models/schema/v1/workload"},"here"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/21778a34.af0d4491.js b/assets/js/21778a34.af0d4491.js new file mode 100644 index 00000000000..399d354ec76 --- /dev/null +++ b/assets/js/21778a34.af0d4491.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7921],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=r.createContext({}),s=function(e){var n=r.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},c=function(e){var n=s(e.components);return r.createElement(p.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(t),m=o,h=u["".concat(p,".").concat(m)]||u[m]||d[m]||a;return t?r.createElement(h,i(i({ref:n},c),{},{components:t})):r.createElement(h,i({ref:n},c))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=u;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var s=2;s{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>l,toc:()=>s});var r=t(87462),o=(t(67294),t(3905));const a={},i="Configure Containers",l={unversionedId:"guides/working-with-k8s/container",id:"version-v0.9/guides/working-with-k8s/container",title:"Configure Containers",description:"You can manage container-level configurations in the AppConfiguration model via the containers field (under the workload schemas). By default, everything defined in the containers field will be treated as application containers. Sidecar containers will be supported in a future version of kusion.",source:"@site/docs_versioned_docs/version-v0.9/guides/working-with-k8s/2-container.md",sourceDirName:"guides/working-with-k8s",slug:"/guides/working-with-k8s/container",permalink:"/docs/v0.9/guides/working-with-k8s/container",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/guides/working-with-k8s/2-container.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{},sidebar:"kusion",previous:{title:"Deploy Application",permalink:"/docs/v0.9/guides/working-with-k8s/deploy-application"},next:{title:"Expose Service",permalink:"/docs/v0.9/guides/working-with-k8s/service"}},p={},s=[{value:"Pre-requisite",id:"pre-requisite",level:2},{value:"Example",id:"example",level:2},{value:"Apply",id:"apply",level:2},{value:"Validation",id:"validation",level:2}],c={toc:s};function d(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"configure-containers"},"Configure Containers"),(0,o.kt)("p",null,"You can manage container-level configurations in the ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model via the ",(0,o.kt)("inlineCode",{parentName:"p"},"containers")," field (under the ",(0,o.kt)("inlineCode",{parentName:"p"},"workload")," schemas). By default, everything defined in the ",(0,o.kt)("inlineCode",{parentName:"p"},"containers")," field will be treated as application containers. Sidecar containers will be supported in a future version of kusion."),(0,o.kt)("p",null,"For the full ",(0,o.kt)("inlineCode",{parentName:"p"},"Container")," schema reference, please see ",(0,o.kt)("a",{parentName:"p",href:"../../reference/model/catalog_models/workload/doc_service#schema-container"},"here")," for more details."),(0,o.kt)("h2",{id:"pre-requisite"},"Pre-requisite"),(0,o.kt)("p",null,"Please refer to the ",(0,o.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,o.kt)("p",null,"The example below also requires you to have ",(0,o.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will generate a ",(0,o.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,o.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,o.kt)("h2",{id:"example"},"Example"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"helloworld/dev/main.k"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-py"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.network as n\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "helloworld": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v4"\n env: {\n "env1": "VALUE"\n "env2": "VALUE2"\n }\n resources: {\n "cpu": "500m"\n "memory": "512M"\n }\n # Configure an HTTP readiness probe\n readinessProbe: p.Probe {\n probeHandler: p.Http {\n url: "http://localhost:80"\n }\n initialDelaySeconds: 10\n }\n }\n }\n replicas: 2\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n}\n')),(0,o.kt)("h2",{id:"apply"},"Apply"),(0,o.kt)("p",null,"Re-run steps in ",(0,o.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", new container configuration can be applied."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:helloworld UnChanged\n* \u251c\u2500 v1:Service:helloworld:helloworld-dev-helloworld-private UnChanged\n* \u2514\u2500 apps/v1:Deployment:helloworld:helloworld-dev-helloworld Update\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:helloworld, skip \n SUCCESS UnChanged v1:Service:helloworld:helloworld-dev-helloworld-private, skip \n SUCCESS Update apps/v1:Deployment:helloworld:helloworld-dev-helloworld success \nUpdate apps/v1:Deployment:helloworld:helloworld-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,o.kt)("h2",{id:"validation"},"Validation"),(0,o.kt)("p",null,"We can verify the container (in the deployment template) now has the updated attributes as defined in the container configuration:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"$ kubectl get deployment -n helloworld -o yaml\n...\n template:\n ...\n spec:\n containers:\n - env:\n - name: env1\n value: VALUE\n - name: env2\n value: VALUE2\n image: gcr.io/google-samples/gb-frontend:v4\n imagePullPolicy: IfNotPresent\n name: helloworld\n readinessProbe:\n failureThreshold: 3\n httpGet:\n host: localhost\n path: /\n port: 80\n scheme: HTTP\n initialDelaySeconds: 10\n periodSeconds: 10\n successThreshold: 1\n timeoutSeconds: 1\n resources:\n limits:\n cpu: 500m\n memory: 512M\n...\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/21778a34.e8ceb514.js b/assets/js/21778a34.e8ceb514.js deleted file mode 100644 index a9eb686ff9c..00000000000 --- a/assets/js/21778a34.e8ceb514.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7921],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=r.createContext({}),s=function(e){var n=r.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},c=function(e){var n=s(e.components);return r.createElement(p.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(t),m=o,h=u["".concat(p,".").concat(m)]||u[m]||d[m]||a;return t?r.createElement(h,i(i({ref:n},c),{},{components:t})):r.createElement(h,i({ref:n},c))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=u;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var s=2;s{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>l,toc:()=>s});var r=t(87462),o=(t(67294),t(3905));const a={},i="Configure Containers",l={unversionedId:"guides/working-with-k8s/container",id:"version-v0.9/guides/working-with-k8s/container",title:"Configure Containers",description:"You can manage container-level configurations in the AppConfiguration model via the containers field (under the workload schemas). By default, everything defined in the containers field will be treated as application containers. Sidecar containers will be supported in a future version of kusion.",source:"@site/docs_versioned_docs/version-v0.9/guides/working-with-k8s/2-container.md",sourceDirName:"guides/working-with-k8s",slug:"/guides/working-with-k8s/container",permalink:"/docs/v0.9/guides/working-with-k8s/container",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/guides/working-with-k8s/2-container.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{},sidebar:"kusion",previous:{title:"Deploy Application",permalink:"/docs/v0.9/guides/working-with-k8s/deploy-application"},next:{title:"Expose Service",permalink:"/docs/v0.9/guides/working-with-k8s/service"}},p={},s=[{value:"Pre-requisite",id:"pre-requisite",level:2},{value:"Example",id:"example",level:2},{value:"Apply",id:"apply",level:2},{value:"Validation",id:"validation",level:2}],c={toc:s};function d(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"configure-containers"},"Configure Containers"),(0,o.kt)("p",null,"You can manage container-level configurations in the ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model via the ",(0,o.kt)("inlineCode",{parentName:"p"},"containers")," field (under the ",(0,o.kt)("inlineCode",{parentName:"p"},"workload")," schemas). By default, everything defined in the ",(0,o.kt)("inlineCode",{parentName:"p"},"containers")," field will be treated as application containers. Sidecar containers will be supported in a future version of kusion."),(0,o.kt)("p",null,"For the full ",(0,o.kt)("inlineCode",{parentName:"p"},"Container")," schema reference, please see ",(0,o.kt)("a",{parentName:"p",href:"../../reference/model/catalog_models/workload/doc_service#schema-container"},"here")," for more details."),(0,o.kt)("h2",{id:"pre-requisite"},"Pre-requisite"),(0,o.kt)("p",null,"Please refer to the ",(0,o.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,o.kt)("p",null,"The example below also requires you to have ",(0,o.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will generate a ",(0,o.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,o.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,o.kt)("h2",{id:"example"},"Example"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"helloworld/dev/main.k"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-py"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.network as n\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "helloworld": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v4"\n env: {\n "env1": "VALUE"\n "env2": "VALUE2"\n }\n resources: {\n "cpu": "500m"\n "memory": "512M"\n }\n # Configure an HTTP readiness probe\n readinessProbe: p.Probe {\n probeHandler: p.Http {\n url: "http://localhost:80"\n }\n initialDelaySeconds: 10\n }\n }\n }\n replicas: 2\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n}\n')),(0,o.kt)("h2",{id:"apply"},"Apply"),(0,o.kt)("p",null,"Re-run steps in ",(0,o.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", new container configuration can be applied."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:helloworld UnChanged\n* \u251c\u2500 v1:Service:helloworld:helloworld-dev-helloworld-private UnChanged\n* \u2514\u2500 apps/v1:Deployment:helloworld:helloworld-dev-helloworld Update\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:helloworld, skip \n SUCCESS UnChanged v1:Service:helloworld:helloworld-dev-helloworld-private, skip \n SUCCESS Update apps/v1:Deployment:helloworld:helloworld-dev-helloworld success \nUpdate apps/v1:Deployment:helloworld:helloworld-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,o.kt)("h2",{id:"validation"},"Validation"),(0,o.kt)("p",null,"We can verify the container (in the deployment template) now has the updated attributes as defined in the container configuration:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"$ kubectl get deployment -n helloworld -o yaml\n...\n template:\n ...\n spec:\n containers:\n - env:\n - name: env1\n value: VALUE\n - name: env2\n value: VALUE2\n image: gcr.io/google-samples/gb-frontend:v4\n imagePullPolicy: IfNotPresent\n name: helloworld\n readinessProbe:\n failureThreshold: 3\n httpGet:\n host: localhost\n path: /\n port: 80\n scheme: HTTP\n initialDelaySeconds: 10\n periodSeconds: 10\n successThreshold: 1\n timeoutSeconds: 1\n resources:\n limits:\n cpu: 500m\n memory: 512M\n...\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2326e64e.695057c6.js b/assets/js/2326e64e.695057c6.js deleted file mode 100644 index d0fa548f346..00000000000 --- a/assets/js/2326e64e.695057c6.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9556],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(n),d=o,g=u["".concat(s,".").concat(d)]||u[d]||m[d]||a;return n?r.createElement(g,i(i({ref:t},c),{},{components:n})):r.createElement(g,i({ref:t},c))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>l,toc:()=>p});var r=n(87462),o=(n(67294),n(3905));const a={},i="monitoring",l={unversionedId:"reference/modules/workspace-configs/monitoring/prometheus",id:"version-v0.11/reference/modules/workspace-configs/monitoring/prometheus",title:"monitoring",description:"monitoring can be used to define workspace-level monitoring configurations.",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/monitoring/prometheus.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/monitoring",slug:"/reference/modules/workspace-configs/monitoring/prometheus",permalink:"/docs/reference/modules/workspace-configs/monitoring/prometheus",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/monitoring/prometheus.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"postgres",permalink:"/docs/reference/modules/workspace-configs/database/postgres"},next:{title:"network",permalink:"/docs/reference/modules/workspace-configs/networking/network"}},s={},p=[{value:"Attributes",id:"attributes",level:2},{value:"Examples",id:"examples",level:3}],c={toc:p};function m(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"monitoring"},"monitoring"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"monitoring")," can be used to define workspace-level monitoring configurations."),(0,o.kt)("h2",{id:"attributes"},"Attributes"),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,o.kt)("th",{parentName:"tr",align:null},"Type"),(0,o.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,o.kt)("th",{parentName:"tr",align:null},"Required"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"operatorMode"),(0,o.kt)("br",null),"Whether the Prometheus instance installed in the cluster runs as a Kubernetes operator or not. This determines the different kinds of resources Kusion manages."),(0,o.kt)("td",{parentName:"tr",align:null},"true ","|"," false"),(0,o.kt)("td",{parentName:"tr",align:null},"false"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"monitorType"),(0,o.kt)("br",null),"The kind of monitor to create. It only applies when operatorMode is set to True."),(0,o.kt)("td",{parentName:"tr",align:null},'"Service" ',"|",' "Pod"'),(0,o.kt)("td",{parentName:"tr",align:null},'"Service"'),(0,o.kt)("td",{parentName:"tr",align:null},"optional")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"interval"),(0,o.kt)("br",null),"The time interval which Prometheus scrapes metrics data. Only applicable when operator mode is set to true.",(0,o.kt)("br",null),"When operator mode is set to false, the scraping interval can only be set in the scraping job configuration, which kusion does not have permission to manage directly."),(0,o.kt)("td",{parentName:"tr",align:null},"str"),(0,o.kt)("td",{parentName:"tr",align:null},"30s"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"timeout"),(0,o.kt)("br",null),"The timeout when Prometheus scrapes metrics data. Only applicable when operator mode is set to true.",(0,o.kt)("br",null),"When operator mode is set to false, the scraping timeout can only be set in the scraping job configuration, which kusion does not have permission to manage directly."),(0,o.kt)("td",{parentName:"tr",align:null},"str"),(0,o.kt)("td",{parentName:"tr",align:null},"15s"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"scheme"),(0,o.kt)("br",null),"The scheme to scrape metrics from. Possible values are http and https."),(0,o.kt)("td",{parentName:"tr",align:null},'"http" ',"|",' "https"'),(0,o.kt)("td",{parentName:"tr",align:null},"http"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")))),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n kusionstack/monitoring@0.1.0:\n default:\n operatorMode: True\n monitorType: Pod\n scheme: http\n interval: 30s\n timeout: 15s\n low_frequency:\n operatorMode: False\n interval: 2m\n timeout: 1m\n projectSelector:\n - foo\n - bar\n high_frequency:\n monitorType: Service\n interval: 10s\n timeout: 5s\n projectSelector:\n - helloworld\n - wordpress\n - prometheus-sample-app\n")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2326e64e.77b416b7.js b/assets/js/2326e64e.77b416b7.js new file mode 100644 index 00000000000..0d621ce70b2 --- /dev/null +++ b/assets/js/2326e64e.77b416b7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9556],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(n),d=o,g=u["".concat(s,".").concat(d)]||u[d]||m[d]||a;return n?r.createElement(g,i(i({ref:t},c),{},{components:n})):r.createElement(g,i({ref:t},c))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>l,toc:()=>p});var r=n(87462),o=(n(67294),n(3905));const a={},i="monitoring",l={unversionedId:"reference/modules/workspace-configs/monitoring/prometheus",id:"version-v0.11/reference/modules/workspace-configs/monitoring/prometheus",title:"monitoring",description:"monitoring can be used to define workspace-level monitoring configurations.",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/monitoring/prometheus.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/monitoring",slug:"/reference/modules/workspace-configs/monitoring/prometheus",permalink:"/docs/reference/modules/workspace-configs/monitoring/prometheus",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/monitoring/prometheus.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"postgres",permalink:"/docs/reference/modules/workspace-configs/database/postgres"},next:{title:"network",permalink:"/docs/reference/modules/workspace-configs/networking/network"}},s={},p=[{value:"Attributes",id:"attributes",level:2},{value:"Examples",id:"examples",level:3}],c={toc:p};function m(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"monitoring"},"monitoring"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"monitoring")," can be used to define workspace-level monitoring configurations."),(0,o.kt)("h2",{id:"attributes"},"Attributes"),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,o.kt)("th",{parentName:"tr",align:null},"Type"),(0,o.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,o.kt)("th",{parentName:"tr",align:null},"Required"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"operatorMode"),(0,o.kt)("br",null),"Whether the Prometheus instance installed in the cluster runs as a Kubernetes operator or not. This determines the different kinds of resources Kusion manages."),(0,o.kt)("td",{parentName:"tr",align:null},"true ","|"," false"),(0,o.kt)("td",{parentName:"tr",align:null},"false"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"monitorType"),(0,o.kt)("br",null),"The kind of monitor to create. It only applies when operatorMode is set to True."),(0,o.kt)("td",{parentName:"tr",align:null},'"Service" ',"|",' "Pod"'),(0,o.kt)("td",{parentName:"tr",align:null},'"Service"'),(0,o.kt)("td",{parentName:"tr",align:null},"optional")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"interval"),(0,o.kt)("br",null),"The time interval which Prometheus scrapes metrics data. Only applicable when operator mode is set to true.",(0,o.kt)("br",null),"When operator mode is set to false, the scraping interval can only be set in the scraping job configuration, which kusion does not have permission to manage directly."),(0,o.kt)("td",{parentName:"tr",align:null},"str"),(0,o.kt)("td",{parentName:"tr",align:null},"30s"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"timeout"),(0,o.kt)("br",null),"The timeout when Prometheus scrapes metrics data. Only applicable when operator mode is set to true.",(0,o.kt)("br",null),"When operator mode is set to false, the scraping timeout can only be set in the scraping job configuration, which kusion does not have permission to manage directly."),(0,o.kt)("td",{parentName:"tr",align:null},"str"),(0,o.kt)("td",{parentName:"tr",align:null},"15s"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"scheme"),(0,o.kt)("br",null),"The scheme to scrape metrics from. Possible values are http and https."),(0,o.kt)("td",{parentName:"tr",align:null},'"http" ',"|",' "https"'),(0,o.kt)("td",{parentName:"tr",align:null},"http"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")))),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n kusionstack/monitoring@0.1.0:\n default:\n operatorMode: True\n monitorType: Pod\n scheme: http\n interval: 30s\n timeout: 15s\n low_frequency:\n operatorMode: False\n interval: 2m\n timeout: 1m\n projectSelector:\n - foo\n - bar\n high_frequency:\n monitorType: Service\n interval: 10s\n timeout: 5s\n projectSelector:\n - helloworld\n - wordpress\n - prometheus-sample-app\n")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/24657d42.b0fcf53c.js b/assets/js/24657d42.b0fcf53c.js deleted file mode 100644 index c384f327ecc..00000000000 --- a/assets/js/24657d42.b0fcf53c.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8018],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),l=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},p=function(e){var n=l(e.components);return r.createElement(c.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=l(t),m=o,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||a;return t?r.createElement(f,i(i({ref:n},p),{},{components:t})):r.createElement(f,i({ref:n},p))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=u;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=t(87462),o=(t(67294),t(3905));const a={id:"base-override"},i="Base and Override",s={unversionedId:"configuration-walkthrough/base-override",id:"version-v0.10/configuration-walkthrough/base-override",title:"Base and Override",description:"In practice, what we have observed for production-grade applications is that they usually need to be deployed to a wide range of different targets, be it different environments in the SDLC, or different clouds, regions or runtimes for cost/regulation/performance or disaster recovery related reasons.",source:"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/3-base-override.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/base-override",permalink:"/docs/v0.10/configuration-walkthrough/base-override",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/3-base-override.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{id:"base-override"},sidebar:"kusion",previous:{title:"KCL Basics",permalink:"/docs/v0.10/configuration-walkthrough/kcl-basics"},next:{title:"Workload",permalink:"/docs/v0.10/configuration-walkthrough/workload"}},c={},l=[],p={toc:l};function d(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"base-and-override"},"Base and Override"),(0,o.kt)("p",null,"In practice, what we have observed for production-grade applications is that they usually need to be deployed to a wide range of different targets, be it different environments in the SDLC, or different clouds, regions or runtimes for cost/regulation/performance or disaster recovery related reasons."),(0,o.kt)("p",null,"In that context, we advocate for a pattern where you can leverage some Kusion and KCL features to minimize the amount of duplicate configurations, by separating the common base application configuration and environment-specific ones."),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"The file names in the below examples don't matter as long as they are called out and appear in the correct order in the ",(0,o.kt)("inlineCode",{parentName:"p"},"entries")," field (the field is a list) in ",(0,o.kt)("inlineCode",{parentName:"p"},"kcl.mod"),". The files with common configurations should appear first in the list and stack-specific ones last. The latter one takes precedence."),(0,o.kt)("p",{parentName:"admonition"},"The configurations also don't have be placed into a single ",(0,o.kt)("inlineCode",{parentName:"p"},".k")," file. For complex projects, they can be broken down into smaller organized ",(0,o.kt)("inlineCode",{parentName:"p"},".k")," files for better readability. ")),(0,o.kt)("p",null,"Base configuration defined in ",(0,o.kt)("inlineCode",{parentName:"p"},"base/base.k"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.network as n\nimport catalog.models.schema.v1.workload.container as c\n\nmyapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: ""\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n}\n')),(0,o.kt)("p",null,"Environment-specific configuration defined in ",(0,o.kt)("inlineCode",{parentName:"p"},"dev/main.k"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\n\n# main.k declares customized configurations for dev stack.\nmyapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n # dev stack has different app configuration from the base\n image = "gcr.io/google-samples/gb-frontend:v5"\n resources = {\n "cpu": "250m"\n "memory": "256Mi"\n }\n }\n }\n replicas = 2\n }\n}\n')),(0,o.kt)("p",null,"Alternatively, you could locate a specific property (in this case below, the ",(0,o.kt)("inlineCode",{parentName:"p"},"Container")," object) in the ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," object using the dot selector shorthand(such as ",(0,o.kt)("inlineCode",{parentName:"p"},"workload.containers.myapp")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"workload.replicas")," below):"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\n\n# main.k declares customized configurations for dev stack.\nmyapp: ac.AppConfiguration {\n workload.replicas = 2\n workload.containers.myapp: {\n # dev stack has different app configuration\n image = "gcr.io/google-samples/gb-frontend:v5"\n resources = {\n "cpu": "250m"\n "memory": "256Mi"\n }\n }\n}\n')),(0,o.kt)("p",null,"This is especially useful when the application configuration is complex but the override is relatively straightforward."),(0,o.kt)("p",null,"The two examples above are equivalent when overriding the base."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/24657d42.d0dbc8c0.js b/assets/js/24657d42.d0dbc8c0.js new file mode 100644 index 00000000000..4b06f837426 --- /dev/null +++ b/assets/js/24657d42.d0dbc8c0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8018],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),l=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},p=function(e){var n=l(e.components);return r.createElement(c.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=l(t),m=o,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||a;return t?r.createElement(f,i(i({ref:n},p),{},{components:t})):r.createElement(f,i({ref:n},p))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=u;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=t(87462),o=(t(67294),t(3905));const a={id:"base-override"},i="Base and Override",s={unversionedId:"configuration-walkthrough/base-override",id:"version-v0.10/configuration-walkthrough/base-override",title:"Base and Override",description:"In practice, what we have observed for production-grade applications is that they usually need to be deployed to a wide range of different targets, be it different environments in the SDLC, or different clouds, regions or runtimes for cost/regulation/performance or disaster recovery related reasons.",source:"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/3-base-override.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/base-override",permalink:"/docs/v0.10/configuration-walkthrough/base-override",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/3-base-override.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{id:"base-override"},sidebar:"kusion",previous:{title:"KCL Basics",permalink:"/docs/v0.10/configuration-walkthrough/kcl-basics"},next:{title:"Workload",permalink:"/docs/v0.10/configuration-walkthrough/workload"}},c={},l=[],p={toc:l};function d(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"base-and-override"},"Base and Override"),(0,o.kt)("p",null,"In practice, what we have observed for production-grade applications is that they usually need to be deployed to a wide range of different targets, be it different environments in the SDLC, or different clouds, regions or runtimes for cost/regulation/performance or disaster recovery related reasons."),(0,o.kt)("p",null,"In that context, we advocate for a pattern where you can leverage some Kusion and KCL features to minimize the amount of duplicate configurations, by separating the common base application configuration and environment-specific ones."),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"The file names in the below examples don't matter as long as they are called out and appear in the correct order in the ",(0,o.kt)("inlineCode",{parentName:"p"},"entries")," field (the field is a list) in ",(0,o.kt)("inlineCode",{parentName:"p"},"kcl.mod"),". The files with common configurations should appear first in the list and stack-specific ones last. The latter one takes precedence."),(0,o.kt)("p",{parentName:"admonition"},"The configurations also don't have be placed into a single ",(0,o.kt)("inlineCode",{parentName:"p"},".k")," file. For complex projects, they can be broken down into smaller organized ",(0,o.kt)("inlineCode",{parentName:"p"},".k")," files for better readability. ")),(0,o.kt)("p",null,"Base configuration defined in ",(0,o.kt)("inlineCode",{parentName:"p"},"base/base.k"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.network as n\nimport catalog.models.schema.v1.workload.container as c\n\nmyapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: ""\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n}\n')),(0,o.kt)("p",null,"Environment-specific configuration defined in ",(0,o.kt)("inlineCode",{parentName:"p"},"dev/main.k"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\n\n# main.k declares customized configurations for dev stack.\nmyapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n # dev stack has different app configuration from the base\n image = "gcr.io/google-samples/gb-frontend:v5"\n resources = {\n "cpu": "250m"\n "memory": "256Mi"\n }\n }\n }\n replicas = 2\n }\n}\n')),(0,o.kt)("p",null,"Alternatively, you could locate a specific property (in this case below, the ",(0,o.kt)("inlineCode",{parentName:"p"},"Container")," object) in the ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," object using the dot selector shorthand(such as ",(0,o.kt)("inlineCode",{parentName:"p"},"workload.containers.myapp")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"workload.replicas")," below):"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\n\n# main.k declares customized configurations for dev stack.\nmyapp: ac.AppConfiguration {\n workload.replicas = 2\n workload.containers.myapp: {\n # dev stack has different app configuration\n image = "gcr.io/google-samples/gb-frontend:v5"\n resources = {\n "cpu": "250m"\n "memory": "256Mi"\n }\n }\n}\n')),(0,o.kt)("p",null,"This is especially useful when the application configuration is complex but the override is relatively straightforward."),(0,o.kt)("p",null,"The two examples above are equivalent when overriding the base."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/252357e3.2f60bfc3.js b/assets/js/252357e3.fcce83b6.js similarity index 81% rename from assets/js/252357e3.2f60bfc3.js rename to assets/js/252357e3.fcce83b6.js index 654b812a9d2..c9bd9a00ec7 100644 --- a/assets/js/252357e3.2f60bfc3.js +++ b/assets/js/252357e3.fcce83b6.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6349],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>d});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),f=l(r),d=o,m=f["".concat(s,".").concat(d)]||f[d]||u[d]||a;return r?n.createElement(m,i(i({ref:t},p),{},{components:r})):n.createElement(m,i({ref:t},p))}));function d(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:o,i[1]=c;for(var l=2;l{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:2},i="KCL",c={unversionedId:"faq/kcl",id:"version-v0.11/faq/kcl",title:"KCL",description:"Visit the KCL website for more documents.",source:"@site/docs_versioned_docs/version-v0.11/7-faq/2-kcl.md",sourceDirName:"7-faq",slug:"/faq/kcl",permalink:"/docs/faq/kcl",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/7-faq/2-kcl.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"kusion",previous:{title:"Installation",permalink:"/docs/faq/install-error"}},s={},l=[],p={toc:l};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kcl"},"KCL"),(0,o.kt)("p",null,"Visit the ",(0,o.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/user_docs/support/faq-kcl"},"KCL website")," for more documents."))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6349],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>d});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),f=l(r),d=o,m=f["".concat(s,".").concat(d)]||f[d]||u[d]||a;return r?n.createElement(m,i(i({ref:t},p),{},{components:r})):n.createElement(m,i({ref:t},p))}));function d(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:o,i[1]=c;for(var l=2;l{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:2},i="KCL",c={unversionedId:"faq/kcl",id:"version-v0.11/faq/kcl",title:"KCL",description:"Visit the KCL website for more documents.",source:"@site/docs_versioned_docs/version-v0.11/7-faq/2-kcl.md",sourceDirName:"7-faq",slug:"/faq/kcl",permalink:"/docs/faq/kcl",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/7-faq/2-kcl.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"kusion",previous:{title:"Installation",permalink:"/docs/faq/install-error"}},s={},l=[],p={toc:l};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kcl"},"KCL"),(0,o.kt)("p",null,"Visit the ",(0,o.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/user_docs/support/faq-kcl"},"KCL website")," for more documents."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/27e25305.4faae2d3.js b/assets/js/27e25305.4faae2d3.js new file mode 100644 index 00000000000..f36604d8fd9 --- /dev/null +++ b/assets/js/27e25305.4faae2d3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7234],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(67294);function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(l[n]=e[n]);return l}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,l=e.mdxType,o=e.originalType,p=e.parentName,c=r(e,["components","mdxType","originalType","parentName"]),u=s(n),m=l,k=u["".concat(p,".").concat(m)]||u[m]||d[m]||o;return n?a.createElement(k,i(i({ref:t},c),{},{components:n})):a.createElement(k,i({ref:t},c))}));function m(e,t){var n=arguments,l=t&&t.mdxType;if("string"==typeof e||l){var o=n.length,i=new Array(o);i[0]=u;var r={};for(var p in t)hasOwnProperty.call(t,p)&&(r[p]=t[p]);r.originalType=e,r.mdxType="string"==typeof e?e:l,i[1]=r;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>r,toc:()=>s});var a=n(87462),l=(n(67294),n(3905));const o={},i="Deploy Application",r={unversionedId:"guides/working-with-k8s/deploy-application",id:"version-v0.9/guides/working-with-k8s/deploy-application",title:"Deploy Application",description:"This guide shows you how to use Kusion CLIs to complete the deployment of an application running in Kubernetes.",source:"@site/docs_versioned_docs/version-v0.9/guides/working-with-k8s/1-deploy-application.md",sourceDirName:"guides/working-with-k8s",slug:"/guides/working-with-k8s/deploy-application",permalink:"/docs/v0.9/guides/working-with-k8s/deploy-application",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/guides/working-with-k8s/1-deploy-application.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{},sidebar:"kusion",previous:{title:"Kubernetes",permalink:"/docs/v0.9/guides/working-with-k8s/"},next:{title:"Configure Containers",permalink:"/docs/v0.9/guides/working-with-k8s/container"}},p={},s=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Initializing",id:"initializing",level:2},{value:"kcl.mod",id:"kclmod",level:3},{value:"Compiling",id:"compiling",level:2},{value:"Applying",id:"applying",level:2}],c={toc:s};function d(e){let{components:t,...o}=e;return(0,l.kt)("wrapper",(0,a.Z)({},c,o,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("h1",{id:"deploy-application"},"Deploy Application"),(0,l.kt)("p",null,"This guide shows you how to use Kusion CLIs to complete the deployment of an application running in Kubernetes.\nWe call the abstraction of application operation and maintenance configuration as ",(0,l.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),", and its instance as ",(0,l.kt)("inlineCode",{parentName:"p"},"Application"),".\nIt is essentially an configuration model that describes an application. The complete definition can be seen ",(0,l.kt)("a",{parentName:"p",href:"../../reference/model/catalog_models/doc_app_configuration"},"here"),"."),(0,l.kt)("p",null,"In production, the application generally includes minimally several k8s resources:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Namespace"),(0,l.kt)("li",{parentName:"ul"},"Deployment"),(0,l.kt)("li",{parentName:"ul"},"Service")),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"This guide requires you to have a basic understanding of Kubernetes.\nIf you are not familiar with the relevant concepts, please refer to the links below:"),(0,l.kt)("ul",{parentName:"admonition"},(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/tutorials/kubernetes-basics/"},"Learn Kubernetes Basics")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/"},"Namespace")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/concepts/workloads/controllers/deployment/"},"Deployment")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/concepts/services-networking/service/"},"Service")))),(0,l.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,l.kt)("p",null,"Before we start, we need to complete the following steps:"),(0,l.kt)("p",null,"1\u3001Install Kusion"),(0,l.kt)("p",null,"We recommend using HomeBrew(Mac), Scoop(Windows), or an installation shell script to download and install Kusion.\nSee ",(0,l.kt)("a",{parentName:"p",href:"../../getting-started/install-kusion"},"Download and Install")," for more details."),(0,l.kt)("p",null,"2\u3001Running Kubernetes cluster"),(0,l.kt)("p",null,"There must be a running Kubernetes cluster and a ",(0,l.kt)("a",{parentName:"p",href:"https://Kubernetes.io/docs/tasks/tools/#kubectl"},"kubectl")," command line tool.\nIf you don't have a cluster yet, you can use ",(0,l.kt)("a",{parentName:"p",href:"https://minikube.sigs.k8s.io/docs/tutorials/multi_node/"},"Minikube")," to start one of your own."),(0,l.kt)("h2",{id:"initializing"},"Initializing"),(0,l.kt)("p",null,"This guide is to deploy an app using Kusion, relying on the Kusion CLI and a Kubernetes cluster."),(0,l.kt)("p",null,"To initialize the application configuration:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"kusion init\n")),(0,l.kt)("p",null,"The ",(0,l.kt)("inlineCode",{parentName:"p"},"kusion init")," command will prompt you to enter required parameters, such as project name, project description, image address, etc.\nYou can keep pressing ",(0,l.kt)("em",{parentName:"p"},"Enter")," all the way to use the default values."),(0,l.kt)("p",null,"The output is similar to:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"\u2714 single-stack-sample A minimal kusion project of single stack\nThis command will walk you through creating a new kusion project.\n\nEnter a value or leave blank to accept the (default), and press .\nPress ^C at any time to quit.\n\nProject Config:\n\u2714 Project Name: helloworld\n\u2714 AppName: helloworld\n\u2714 ProjectName: helloworld\nStack Config: dev\n\u2714 Image: gcr.io/google-samples/gb-frontend:v4\n\nCreated project 'helloworld'\n")),(0,l.kt)("p",null,"Now, we have successfully initialized a project ",(0,l.kt)("inlineCode",{parentName:"p"},"helloworld")," using the ",(0,l.kt)("inlineCode",{parentName:"p"},"single-stack-sample")," template, which contains a ",(0,l.kt)("inlineCode",{parentName:"p"},"dev")," stack. "),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"AppName")," represents the name of the sample application, which is recorded in the generated ",(0,l.kt)("inlineCode",{parentName:"li"},"main.k")," as the name of the ",(0,l.kt)("inlineCode",{parentName:"li"},"AppConfiguration")," instance."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"ProjectName")," and ",(0,l.kt)("inlineCode",{parentName:"li"},"Project Name")," represent the name of the sample project, which is used as the generated folder name and then recorded in the generated ",(0,l.kt)("inlineCode",{parentName:"li"},"project.yaml"),"."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"Image")," represents the image address of the application container.")),(0,l.kt)("admonition",{type:"info"},(0,l.kt)("p",{parentName:"admonition"},"See ",(0,l.kt)("a",{parentName:"p",href:"../../concepts/glossary"},"Project&Stack")," for more details about Project and Stack.")),(0,l.kt)("p",null,"The directory structure is as follows:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"helloworld\n \u251c\u2500\u2500 README.md\n \u251c\u2500\u2500 dev\n \u2502 \u251c\u2500\u2500 main.k\n \u2502 \u251c\u2500\u2500 kcl.mod\n \u2502 \u251c\u2500\u2500 kcl.mod.lock\n \u2502 \u2514\u2500\u2500 stack.yaml\n \u2514\u2500\u2500 project.yaml\n\n1 directory, 6 files\n")),(0,l.kt)("p",null,"The project directory has the following files that are automatically generated:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"README.md")," contains the generated README from a template."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"project.yaml")," represents project-level configurations."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"dev")," directory stores the customized stack configuration:",(0,l.kt)("ul",{parentName:"li"},(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"dev/main.k")," stores configurations in the ",(0,l.kt)("inlineCode",{parentName:"li"},"dev")," stack."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"dev/stack.yaml")," stores stack-level configurations."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"dev/kcl.mod")," stores stack-level dependencies."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"dev/kcl.mod.lock")," stores version-sensitive dependencies.")))),(0,l.kt)("p",null,"In general, the ",(0,l.kt)("inlineCode",{parentName:"p"},".k")," files are the KCL source code that represents the application configuration, and the ",(0,l.kt)("inlineCode",{parentName:"p"},".yaml")," is the static configuration file that describes behavior at the project or stack level."),(0,l.kt)("h3",{id:"kclmod"},"kcl.mod"),(0,l.kt)("p",null,"There should be a ",(0,l.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file generated automatically under the project directory. The ",(0,l.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file describes the dependency for the current project or stack. By default, it should contain a reference to the official ",(0,l.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},(0,l.kt)("inlineCode",{parentName:"a"},"catalog")," repository")," which holds some common model definitions that fits best practices. You can also create your own models library and reference that."),(0,l.kt)("h2",{id:"compiling"},"Compiling"),(0,l.kt)("p",null,"At this point, the project has been initialized with the Kusion built-in template.\nThe configuration is written in KCL, not JSON/YAML which Kubernetes recognizes, so it needs to be compiled to get the final output."),(0,l.kt)("p",null,"Enter stack dir ",(0,l.kt)("inlineCode",{parentName:"p"},"helloworld/dev")," and compile:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"cd helloworld/dev && kusion compile\n")),(0,l.kt)("p",null,"The output is printed to ",(0,l.kt)("inlineCode",{parentName:"p"},"stdout")," by default. You can save it to a file using the ",(0,l.kt)("inlineCode",{parentName:"p"},"-o/--output")," flag when running ",(0,l.kt)("inlineCode",{parentName:"p"},"kusion compile"),"."),(0,l.kt)("p",null,"The output of ",(0,l.kt)("inlineCode",{parentName:"p"},"kusion compile")," is the spec format."),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"For instructions on the kusion command line tool, execute ",(0,l.kt)("inlineCode",{parentName:"p"},"kusion -h"),", or refer to the tool's online ",(0,l.kt)("a",{parentName:"p",href:"../../reference/cli/kusion"},"documentation"),".")),(0,l.kt)("h2",{id:"applying"},"Applying"),(0,l.kt)("p",null,"Compilation is now completed. We can apply the configuration as the next step. In the output from ",(0,l.kt)("inlineCode",{parentName:"p"},"kusion compile"),", you can see 3 resources:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"a Namespace named ",(0,l.kt)("inlineCode",{parentName:"li"},"helloworld")),(0,l.kt)("li",{parentName:"ul"},"a Deployment named ",(0,l.kt)("inlineCode",{parentName:"li"},"helloworld-dev-helloworld")," in the ",(0,l.kt)("inlineCode",{parentName:"li"},"helloworld")," namespace"),(0,l.kt)("li",{parentName:"ul"},"a Service named ",(0,l.kt)("inlineCode",{parentName:"li"},"helloworld-dev-helloworld-private")," in the ",(0,l.kt)("inlineCode",{parentName:"li"},"helloworld")," namespace")),(0,l.kt)("p",null,"Execute command:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"kusion apply\n")),(0,l.kt)("p",null,"The output is similar to:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"}," \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:helloworld Create\n* \u251c\u2500 v1:Service:helloworld:helloworld-dev-helloworld-private Create\n* \u2514\u2500 apps/v1:Deployment:helloworld:helloworld-dev-helloworld Create\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS Create v1:Namespace:helloworld success \n SUCCESS Create v1:Service:helloworld:helloworld-dev-helloworld-private success \n SUCCESS Create apps/v1:Deployment:helloworld:helloworld-dev-helloworld success \nCreate apps/v1:Deployment:helloworld:helloworld-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 3 created, 0 updated, 0 deleted.\n")),(0,l.kt)("p",null,"After the configuration applying successfully, you can use the ",(0,l.kt)("inlineCode",{parentName:"p"},"kubectl")," to check the actual status of these resources."),(0,l.kt)("p",null,"1\u3001 Check Namespace"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get ns\n")),(0,l.kt)("p",null,"The output is similar to:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"NAME STATUS AGE\ndefault Active 117d\nhelloworld Active 63s\nkube-system Active 117d\n...\n")),(0,l.kt)("p",null,"2\u3001Check Deployment"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get deploy -n helloworld\n")),(0,l.kt)("p",null,"The output is similar to:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"NAME READY UP-TO-DATE AVAILABLE AGE\nhelloworld-dev-helloworld 2/2 2 2 111s\n")),(0,l.kt)("p",null,"3\u3001Check Service"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get svc -n helloworld\n")),(0,l.kt)("p",null,"The output is similar to:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\nhelloworld-dev-helloworld-private ClusterIP 10.111.183.0 80/TCP 2m6s\n")),(0,l.kt)("p",null,"4\u3001Validate app"),(0,l.kt)("p",null,"Using the ",(0,l.kt)("inlineCode",{parentName:"p"},"kubectl")," tool, forward native port ",(0,l.kt)("inlineCode",{parentName:"p"},"30000")," to the service port ",(0,l.kt)("inlineCode",{parentName:"p"},"80"),"."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl port-forward svc/helloworld-dev-helloworld-private -n helloworld 30000:80\n")),(0,l.kt)("p",null,"Open browser and visit ",(0,l.kt)("a",{parentName:"p",href:"http://127.0.0.1:30000"},"http://127.0.0.1:30000"),"\uff1a"),(0,l.kt)("p",null,(0,l.kt)("img",{alt:"app-preview",src:n(92287).Z,width:"1830",height:"330"})))}d.isMDXComponent=!0},92287:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/app-preview-de5274f4267fa725d2a65099e47c6c2c.png"}}]); \ No newline at end of file diff --git a/assets/js/27e25305.8b7d4e57.js b/assets/js/27e25305.8b7d4e57.js deleted file mode 100644 index fa50a752b64..00000000000 --- a/assets/js/27e25305.8b7d4e57.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7234],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(67294);function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(l[n]=e[n]);return l}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(l[n]=e[n])}return l}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,l=e.mdxType,o=e.originalType,p=e.parentName,c=r(e,["components","mdxType","originalType","parentName"]),u=s(n),m=l,k=u["".concat(p,".").concat(m)]||u[m]||d[m]||o;return n?a.createElement(k,i(i({ref:t},c),{},{components:n})):a.createElement(k,i({ref:t},c))}));function m(e,t){var n=arguments,l=t&&t.mdxType;if("string"==typeof e||l){var o=n.length,i=new Array(o);i[0]=u;var r={};for(var p in t)hasOwnProperty.call(t,p)&&(r[p]=t[p]);r.originalType=e,r.mdxType="string"==typeof e?e:l,i[1]=r;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>r,toc:()=>s});var a=n(87462),l=(n(67294),n(3905));const o={},i="Deploy Application",r={unversionedId:"guides/working-with-k8s/deploy-application",id:"version-v0.9/guides/working-with-k8s/deploy-application",title:"Deploy Application",description:"This guide shows you how to use Kusion CLIs to complete the deployment of an application running in Kubernetes.",source:"@site/docs_versioned_docs/version-v0.9/guides/working-with-k8s/1-deploy-application.md",sourceDirName:"guides/working-with-k8s",slug:"/guides/working-with-k8s/deploy-application",permalink:"/docs/v0.9/guides/working-with-k8s/deploy-application",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/guides/working-with-k8s/1-deploy-application.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{},sidebar:"kusion",previous:{title:"Kubernetes",permalink:"/docs/v0.9/guides/working-with-k8s/"},next:{title:"Configure Containers",permalink:"/docs/v0.9/guides/working-with-k8s/container"}},p={},s=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Initializing",id:"initializing",level:2},{value:"kcl.mod",id:"kclmod",level:3},{value:"Compiling",id:"compiling",level:2},{value:"Applying",id:"applying",level:2}],c={toc:s};function d(e){let{components:t,...o}=e;return(0,l.kt)("wrapper",(0,a.Z)({},c,o,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("h1",{id:"deploy-application"},"Deploy Application"),(0,l.kt)("p",null,"This guide shows you how to use Kusion CLIs to complete the deployment of an application running in Kubernetes.\nWe call the abstraction of application operation and maintenance configuration as ",(0,l.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),", and its instance as ",(0,l.kt)("inlineCode",{parentName:"p"},"Application"),".\nIt is essentially an configuration model that describes an application. The complete definition can be seen ",(0,l.kt)("a",{parentName:"p",href:"../../reference/model/catalog_models/doc_app_configuration"},"here"),"."),(0,l.kt)("p",null,"In production, the application generally includes minimally several k8s resources:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Namespace"),(0,l.kt)("li",{parentName:"ul"},"Deployment"),(0,l.kt)("li",{parentName:"ul"},"Service")),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"This guide requires you to have a basic understanding of Kubernetes.\nIf you are not familiar with the relevant concepts, please refer to the links below:"),(0,l.kt)("ul",{parentName:"admonition"},(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/tutorials/kubernetes-basics/"},"Learn Kubernetes Basics")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/"},"Namespace")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/concepts/workloads/controllers/deployment/"},"Deployment")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/concepts/services-networking/service/"},"Service")))),(0,l.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,l.kt)("p",null,"Before we start, we need to complete the following steps:"),(0,l.kt)("p",null,"1\u3001Install Kusion"),(0,l.kt)("p",null,"We recommend using HomeBrew(Mac), Scoop(Windows), or an installation shell script to download and install Kusion.\nSee ",(0,l.kt)("a",{parentName:"p",href:"../../getting-started/install-kusion"},"Download and Install")," for more details."),(0,l.kt)("p",null,"2\u3001Running Kubernetes cluster"),(0,l.kt)("p",null,"There must be a running Kubernetes cluster and a ",(0,l.kt)("a",{parentName:"p",href:"https://Kubernetes.io/docs/tasks/tools/#kubectl"},"kubectl")," command line tool.\nIf you don't have a cluster yet, you can use ",(0,l.kt)("a",{parentName:"p",href:"https://minikube.sigs.k8s.io/docs/tutorials/multi_node/"},"Minikube")," to start one of your own."),(0,l.kt)("h2",{id:"initializing"},"Initializing"),(0,l.kt)("p",null,"This guide is to deploy an app using Kusion, relying on the Kusion CLI and a Kubernetes cluster."),(0,l.kt)("p",null,"To initialize the application configuration:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"kusion init\n")),(0,l.kt)("p",null,"The ",(0,l.kt)("inlineCode",{parentName:"p"},"kusion init")," command will prompt you to enter required parameters, such as project name, project description, image address, etc.\nYou can keep pressing ",(0,l.kt)("em",{parentName:"p"},"Enter")," all the way to use the default values."),(0,l.kt)("p",null,"The output is similar to:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"\u2714 single-stack-sample A minimal kusion project of single stack\nThis command will walk you through creating a new kusion project.\n\nEnter a value or leave blank to accept the (default), and press .\nPress ^C at any time to quit.\n\nProject Config:\n\u2714 Project Name: helloworld\n\u2714 AppName: helloworld\n\u2714 ProjectName: helloworld\nStack Config: dev\n\u2714 Image: gcr.io/google-samples/gb-frontend:v4\n\nCreated project 'helloworld'\n")),(0,l.kt)("p",null,"Now, we have successfully initialized a project ",(0,l.kt)("inlineCode",{parentName:"p"},"helloworld")," using the ",(0,l.kt)("inlineCode",{parentName:"p"},"single-stack-sample")," template, which contains a ",(0,l.kt)("inlineCode",{parentName:"p"},"dev")," stack. "),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"AppName")," represents the name of the sample application, which is recorded in the generated ",(0,l.kt)("inlineCode",{parentName:"li"},"main.k")," as the name of the ",(0,l.kt)("inlineCode",{parentName:"li"},"AppConfiguration")," instance."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"ProjectName")," and ",(0,l.kt)("inlineCode",{parentName:"li"},"Project Name")," represent the name of the sample project, which is used as the generated folder name and then recorded in the generated ",(0,l.kt)("inlineCode",{parentName:"li"},"project.yaml"),"."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"Image")," represents the image address of the application container.")),(0,l.kt)("admonition",{type:"info"},(0,l.kt)("p",{parentName:"admonition"},"See ",(0,l.kt)("a",{parentName:"p",href:"../../concepts/glossary"},"Project&Stack")," for more details about Project and Stack.")),(0,l.kt)("p",null,"The directory structure is as follows:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"helloworld\n \u251c\u2500\u2500 README.md\n \u251c\u2500\u2500 dev\n \u2502 \u251c\u2500\u2500 main.k\n \u2502 \u251c\u2500\u2500 kcl.mod\n \u2502 \u251c\u2500\u2500 kcl.mod.lock\n \u2502 \u2514\u2500\u2500 stack.yaml\n \u2514\u2500\u2500 project.yaml\n\n1 directory, 6 files\n")),(0,l.kt)("p",null,"The project directory has the following files that are automatically generated:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"README.md")," contains the generated README from a template."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"project.yaml")," represents project-level configurations."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"dev")," directory stores the customized stack configuration:",(0,l.kt)("ul",{parentName:"li"},(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"dev/main.k")," stores configurations in the ",(0,l.kt)("inlineCode",{parentName:"li"},"dev")," stack."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"dev/stack.yaml")," stores stack-level configurations."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"dev/kcl.mod")," stores stack-level dependencies."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"dev/kcl.mod.lock")," stores version-sensitive dependencies.")))),(0,l.kt)("p",null,"In general, the ",(0,l.kt)("inlineCode",{parentName:"p"},".k")," files are the KCL source code that represents the application configuration, and the ",(0,l.kt)("inlineCode",{parentName:"p"},".yaml")," is the static configuration file that describes behavior at the project or stack level."),(0,l.kt)("h3",{id:"kclmod"},"kcl.mod"),(0,l.kt)("p",null,"There should be a ",(0,l.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file generated automatically under the project directory. The ",(0,l.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file describes the dependency for the current project or stack. By default, it should contain a reference to the official ",(0,l.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},(0,l.kt)("inlineCode",{parentName:"a"},"catalog")," repository")," which holds some common model definitions that fits best practices. You can also create your own models library and reference that."),(0,l.kt)("h2",{id:"compiling"},"Compiling"),(0,l.kt)("p",null,"At this point, the project has been initialized with the Kusion built-in template.\nThe configuration is written in KCL, not JSON/YAML which Kubernetes recognizes, so it needs to be compiled to get the final output."),(0,l.kt)("p",null,"Enter stack dir ",(0,l.kt)("inlineCode",{parentName:"p"},"helloworld/dev")," and compile:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"cd helloworld/dev && kusion compile\n")),(0,l.kt)("p",null,"The output is printed to ",(0,l.kt)("inlineCode",{parentName:"p"},"stdout")," by default. You can save it to a file using the ",(0,l.kt)("inlineCode",{parentName:"p"},"-o/--output")," flag when running ",(0,l.kt)("inlineCode",{parentName:"p"},"kusion compile"),"."),(0,l.kt)("p",null,"The output of ",(0,l.kt)("inlineCode",{parentName:"p"},"kusion compile")," is the spec format."),(0,l.kt)("admonition",{type:"tip"},(0,l.kt)("p",{parentName:"admonition"},"For instructions on the kusion command line tool, execute ",(0,l.kt)("inlineCode",{parentName:"p"},"kusion -h"),", or refer to the tool's online ",(0,l.kt)("a",{parentName:"p",href:"../../reference/cli/kusion"},"documentation"),".")),(0,l.kt)("h2",{id:"applying"},"Applying"),(0,l.kt)("p",null,"Compilation is now completed. We can apply the configuration as the next step. In the output from ",(0,l.kt)("inlineCode",{parentName:"p"},"kusion compile"),", you can see 3 resources:"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"a Namespace named ",(0,l.kt)("inlineCode",{parentName:"li"},"helloworld")),(0,l.kt)("li",{parentName:"ul"},"a Deployment named ",(0,l.kt)("inlineCode",{parentName:"li"},"helloworld-dev-helloworld")," in the ",(0,l.kt)("inlineCode",{parentName:"li"},"helloworld")," namespace"),(0,l.kt)("li",{parentName:"ul"},"a Service named ",(0,l.kt)("inlineCode",{parentName:"li"},"helloworld-dev-helloworld-private")," in the ",(0,l.kt)("inlineCode",{parentName:"li"},"helloworld")," namespace")),(0,l.kt)("p",null,"Execute command:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"kusion apply\n")),(0,l.kt)("p",null,"The output is similar to:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"}," \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:helloworld Create\n* \u251c\u2500 v1:Service:helloworld:helloworld-dev-helloworld-private Create\n* \u2514\u2500 apps/v1:Deployment:helloworld:helloworld-dev-helloworld Create\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS Create v1:Namespace:helloworld success \n SUCCESS Create v1:Service:helloworld:helloworld-dev-helloworld-private success \n SUCCESS Create apps/v1:Deployment:helloworld:helloworld-dev-helloworld success \nCreate apps/v1:Deployment:helloworld:helloworld-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 3 created, 0 updated, 0 deleted.\n")),(0,l.kt)("p",null,"After the configuration applying successfully, you can use the ",(0,l.kt)("inlineCode",{parentName:"p"},"kubectl")," to check the actual status of these resources."),(0,l.kt)("p",null,"1\u3001 Check Namespace"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get ns\n")),(0,l.kt)("p",null,"The output is similar to:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"NAME STATUS AGE\ndefault Active 117d\nhelloworld Active 63s\nkube-system Active 117d\n...\n")),(0,l.kt)("p",null,"2\u3001Check Deployment"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get deploy -n helloworld\n")),(0,l.kt)("p",null,"The output is similar to:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"NAME READY UP-TO-DATE AVAILABLE AGE\nhelloworld-dev-helloworld 2/2 2 2 111s\n")),(0,l.kt)("p",null,"3\u3001Check Service"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get svc -n helloworld\n")),(0,l.kt)("p",null,"The output is similar to:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\nhelloworld-dev-helloworld-private ClusterIP 10.111.183.0 80/TCP 2m6s\n")),(0,l.kt)("p",null,"4\u3001Validate app"),(0,l.kt)("p",null,"Using the ",(0,l.kt)("inlineCode",{parentName:"p"},"kubectl")," tool, forward native port ",(0,l.kt)("inlineCode",{parentName:"p"},"30000")," to the service port ",(0,l.kt)("inlineCode",{parentName:"p"},"80"),"."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl port-forward svc/helloworld-dev-helloworld-private -n helloworld 30000:80\n")),(0,l.kt)("p",null,"Open browser and visit ",(0,l.kt)("a",{parentName:"p",href:"http://127.0.0.1:30000"},"http://127.0.0.1:30000"),"\uff1a"),(0,l.kt)("p",null,(0,l.kt)("img",{alt:"app-preview",src:n(92287).Z,width:"1830",height:"330"})))}d.isMDXComponent=!0},92287:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/app-preview-de5274f4267fa725d2a65099e47c6c2c.png"}}]); \ No newline at end of file diff --git a/assets/js/28530a7a.1a12b246.js b/assets/js/28530a7a.1a12b246.js deleted file mode 100644 index 6f05cbdb750..00000000000 --- a/assets/js/28530a7a.1a12b246.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1222],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),m=p(n),d=o,f=m["".concat(l,".").concat(d)]||m[d]||u[d]||i;return n?r.createElement(f,a(a({ref:t},c),{},{components:n})):r.createElement(f,a({ref:t},c))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=m;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>p});var r=n(87462),o=(n(67294),n(3905));const i={},a="kusion options",s={unversionedId:"reference/commands/kusion-options",id:"reference/commands/kusion-options",title:"kusion options",description:"Print the list of flags inherited by all commands",source:"@site/docs/kusion/6-reference/1-commands/kusion-options.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-options",permalink:"/docs/next/reference/commands/kusion-options",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-options.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion mod",permalink:"/docs/next/reference/commands/kusion-mod"},next:{title:"kusion preview",permalink:"/docs/next/reference/commands/kusion-preview"}},l={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-options"},"kusion options"),(0,o.kt)("p",null,"Print the list of flags inherited by all commands"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Print the list of flags inherited by all commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion options [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Print flags inherited by all commands\n kubectl options\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for options\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/28530a7a.96fe6330.js b/assets/js/28530a7a.96fe6330.js new file mode 100644 index 00000000000..fe2bc8e330a --- /dev/null +++ b/assets/js/28530a7a.96fe6330.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1222],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),l=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},c=function(e){var t=l(e.components);return r.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),m=l(n),d=o,f=m["".concat(p,".").concat(d)]||m[d]||u[d]||i;return n?r.createElement(f,a(a({ref:t},c),{},{components:n})):r.createElement(f,a({ref:t},c))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=m;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const i={},a="kusion options",s={unversionedId:"reference/commands/kusion-options",id:"reference/commands/kusion-options",title:"kusion options",description:"Print the list of flags inherited by all commands",source:"@site/docs/kusion/6-reference/1-commands/kusion-options.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-options",permalink:"/docs/next/reference/commands/kusion-options",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-options.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion mod",permalink:"/docs/next/reference/commands/kusion-mod"},next:{title:"kusion preview",permalink:"/docs/next/reference/commands/kusion-preview"}},p={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],c={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-options"},"kusion options"),(0,o.kt)("p",null,"Print the list of flags inherited by all commands"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Print the list of flags inherited by all commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion options [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Print flags inherited by all commands\n kubectl options\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for options\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2871ff48.b82416e1.js b/assets/js/2871ff48.3f6c40f3.js similarity index 67% rename from assets/js/2871ff48.b82416e1.js rename to assets/js/2871ff48.3f6c40f3.js index 95c0a605be4..4ce75db858f 100644 --- a/assets/js/2871ff48.b82416e1.js +++ b/assets/js/2871ff48.3f6c40f3.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5004],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),l=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),d=l(n),f=a,m=d["".concat(s,".").concat(f)]||d[f]||u[f]||o;return n?r.createElement(m,i(i({ref:t},p),{},{components:n})):r.createElement(m,i({ref:t},p))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=d;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>u,frontMatter:()=>o,metadata:()=>c,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const o={id:"configuration",sidebar_label:"Stack Configuration"},i="Stack Configuration",c={unversionedId:"concepts/stack/configuration",id:"version-v0.10/concepts/stack/configuration",title:"Stack Configuration",description:"Users can add config items of the stack in stack.yaml, such as the stack name, etc.",source:"@site/docs_versioned_docs/version-v0.10/3-concepts/2-stack/2-configuration.md",sourceDirName:"3-concepts/2-stack",slug:"/concepts/stack/configuration",permalink:"/docs/v0.10/concepts/stack/configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/3-concepts/2-stack/2-configuration.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"configuration",sidebar_label:"Stack Configuration"},sidebar:"kusion",previous:{title:"Overview",permalink:"/docs/v0.10/concepts/stack/overview"},next:{title:"Kusion Module",permalink:"/docs/v0.10/concepts/kusion-module"}},s={},l=[],p={toc:l};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"stack-configuration"},"Stack Configuration"),(0,a.kt)("p",null,"Users can add config items of the stack in ",(0,a.kt)("inlineCode",{parentName:"p"},"stack.yaml"),", such as the stack name, etc."),(0,a.kt)("p",null,"Here is an example of ",(0,a.kt)("inlineCode",{parentName:"p"},"stack.yaml"),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},"# The stack basic info\nname: dev\n")),(0,a.kt)("p",null,"The config items in ",(0,a.kt)("inlineCode",{parentName:"p"},"stack.yaml")," are explained below."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"name"),": The name of the stack, should be same as the workspace name, such as ",(0,a.kt)("inlineCode",{parentName:"li"},"dev"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"pre")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"prod"),".")))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5004],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),l=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),d=l(n),f=a,m=d["".concat(s,".").concat(f)]||d[f]||u[f]||o;return n?r.createElement(m,i(i({ref:t},p),{},{components:n})):r.createElement(m,i({ref:t},p))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=d;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,i[1]=c;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>u,frontMatter:()=>o,metadata:()=>c,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const o={id:"configuration",sidebar_label:"Stack Configuration"},i="Stack Configuration",c={unversionedId:"concepts/stack/configuration",id:"version-v0.10/concepts/stack/configuration",title:"Stack Configuration",description:"Users can add config items of the stack in stack.yaml, such as the stack name, etc.",source:"@site/docs_versioned_docs/version-v0.10/3-concepts/2-stack/2-configuration.md",sourceDirName:"3-concepts/2-stack",slug:"/concepts/stack/configuration",permalink:"/docs/v0.10/concepts/stack/configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/3-concepts/2-stack/2-configuration.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"configuration",sidebar_label:"Stack Configuration"},sidebar:"kusion",previous:{title:"Overview",permalink:"/docs/v0.10/concepts/stack/overview"},next:{title:"Kusion Module",permalink:"/docs/v0.10/concepts/kusion-module"}},s={},l=[],p={toc:l};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"stack-configuration"},"Stack Configuration"),(0,a.kt)("p",null,"Users can add config items of the stack in ",(0,a.kt)("inlineCode",{parentName:"p"},"stack.yaml"),", such as the stack name, etc."),(0,a.kt)("p",null,"Here is an example of ",(0,a.kt)("inlineCode",{parentName:"p"},"stack.yaml"),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},"# The stack basic info\nname: dev\n")),(0,a.kt)("p",null,"The config items in ",(0,a.kt)("inlineCode",{parentName:"p"},"stack.yaml")," are explained below."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"name"),": The name of the stack, should be same as the workspace name, such as ",(0,a.kt)("inlineCode",{parentName:"li"},"dev"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"pre")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"prod"),".")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2a719713.4ab3dc05.js b/assets/js/2a719713.4ab3dc05.js deleted file mode 100644 index 7195a16fe42..00000000000 --- a/assets/js/2a719713.4ab3dc05.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8468],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var i=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=i.createContext({}),p=function(e){var t=i.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},c=function(e){var t=p(e.components);return i.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},d=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(n),m=a,k=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return n?i.createElement(k,r(r({ref:t},c),{},{components:n})):i.createElement(k,r({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,r=new Array(o);r[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,r[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>r,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var i=n(87462),a=(n(67294),n(3905));const o={id:"deploy-application"},r="Deploy Application",l={unversionedId:"user-guides/working-with-k8s/deploy-application",id:"version-v0.11/user-guides/working-with-k8s/deploy-application",title:"Deploy Application",description:"This guide shows you how to use Kusion CLIs to complete the deployment of an application running in Kubernetes.",source:"@site/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/1-deploy-application.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/deploy-application",permalink:"/docs/user-guides/working-with-k8s/deploy-application",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/1-deploy-application.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"deploy-application"},sidebar:"kusion",previous:{title:"Expose Application Service Deployed on CSP Kubernetes",permalink:"/docs/user-guides/cloud-resources/expose-service"},next:{title:"Configure Containers",permalink:"/docs/user-guides/working-with-k8s/container"}},s={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Initializing",id:"initializing",level:2},{value:"Initializing workspace configuration",id:"initializing-workspace-configuration",level:3},{value:"Initializing application configuration",id:"initializing-application-configuration",level:3},{value:"kcl.mod",id:"kclmod",level:4},{value:"main.k",id:"maink",level:4},{value:"Previewing",id:"previewing",level:2},{value:"Applying",id:"applying",level:2}],c={toc:p};function u(e){let{components:t,...o}=e;return(0,a.kt)("wrapper",(0,i.Z)({},c,o,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"deploy-application"},"Deploy Application"),(0,a.kt)("p",null,"This guide shows you how to use Kusion CLIs to complete the deployment of an application running in Kubernetes.\nWe call the abstraction of application operation and maintenance configuration as ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),", and its instance as ",(0,a.kt)("inlineCode",{parentName:"p"},"Application"),".\nIt is essentially a configuration model that describes an application. The complete definition can be seen ",(0,a.kt)("a",{parentName:"p",href:"../../reference/modules/developer-schemas/app-configuration"},"here"),"."),(0,a.kt)("p",null,"In production, the application generally includes minimally several k8s resources:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Namespace"),(0,a.kt)("li",{parentName:"ul"},"Deployment"),(0,a.kt)("li",{parentName:"ul"},"Service")),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"This guide requires you to have a basic understanding of Kubernetes.\nIf you are not familiar with the relevant concepts, please refer to the links below:"),(0,a.kt)("ul",{parentName:"admonition"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/tutorials/kubernetes-basics/"},"Learn Kubernetes Basics")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/"},"Namespace")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/concepts/workloads/controllers/deployment/"},"Deployment")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/concepts/services-networking/service/"},"Service")))),(0,a.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,a.kt)("p",null,"Before we start, we need to complete the following steps:"),(0,a.kt)("p",null,"1\u3001Install Kusion"),(0,a.kt)("p",null,"We recommend using HomeBrew(Mac), Scoop(Windows), or an installation shell script to download and install Kusion.\nSee ",(0,a.kt)("a",{parentName:"p",href:"../../getting-started/install-kusion"},"Download and Install")," for more details."),(0,a.kt)("p",null,"2\u3001Running Kubernetes cluster"),(0,a.kt)("p",null,"There must be a running and accessible Kubernetes cluster and a ",(0,a.kt)("a",{parentName:"p",href:"https://Kubernetes.io/docs/tasks/tools/#kubectl"},"kubectl")," command line tool.\nIf you don't have a cluster yet, you can use ",(0,a.kt)("a",{parentName:"p",href:"https://minikube.sigs.k8s.io/docs/tutorials/multi_node/"},"Minikube")," to start one of your own."),(0,a.kt)("h2",{id:"initializing"},"Initializing"),(0,a.kt)("p",null,"This guide is to deploy an app using Kusion, relying on the Kusion CLI and an existing Kubernetes cluster."),(0,a.kt)("h3",{id:"initializing-workspace-configuration"},"Initializing workspace configuration"),(0,a.kt)("p",null,"In version 0.10.0, we have introduced the new concept of ",(0,a.kt)("a",{parentName:"p",href:"../../concepts/workspace"},"workspaces"),', which is a logical layer whose configurations represent an opinionated set of defaults, often appointed by the platform team. In most cases workspaces are represented with an "environment" in traditional SDLC terms. These workspaces provide a means to separate the concerns between the ',(0,a.kt)("strong",{parentName:"p"},"application developers")," who wish to focus on business logic, and a group of ",(0,a.kt)("strong",{parentName:"p"},"platform engineers")," who wish to standardize the applications on the platform."),(0,a.kt)("p",null,"Driven by the discipline of Platform Engineering, management of the workspaces, including create/updating/deleting workspaces and their configurations should be done by dedicated platform engineers in a large software organizations to facilitate a more mature and scalable collaboration pattern."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"More on the collaboration pattern can be found in the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/design/collaboration/collaboration_paradigm.md"},"design doc"),".")),(0,a.kt)("p",null,"However, if that does NOT apply to your scenario, e.g. if you work in a smaller org without platform engineers or if you are an individual developer, we wish Kusion can still be a value tool to have when delivering an application. In this guide, we are NOT distinctively highlighting the different roles or what the best practices entails (the design doc above has all that) but rather the steps needed to get Kusion tool to work."),(0,a.kt)("p",null,"As of version 0.11.0, workspace configurations in Kusion can not only be managed on the local filesystem in the form of YAML files, but the remotely-managed workspaces have been supported as well."),(0,a.kt)("p",null,"To initialize the workspace configuration:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"~/playground$ touch ~/dev.yaml\n~/playground$ kusion workspace create dev -f ~/dev.yaml\ncreate workspace dev successfully\n")),(0,a.kt)("p",null,"To verify the workspace has been created properly:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"~/playground$ kusion workspace list\n- default\n- dev\n~/playground$ kusion workspace show dev\n{}\n")),(0,a.kt)("p",null,"Note that ",(0,a.kt)("inlineCode",{parentName:"p"},"show")," command tells us the workspace configuration is currently empty, which is expected because we created the ",(0,a.kt)("inlineCode",{parentName:"p"},"dev")," workspace with an empty YAML file. An empty workspace configuration will suffice in some cases, where no platform configurations are needed."),(0,a.kt)("p",null,"Kusion by default uses the ",(0,a.kt)("inlineCode",{parentName:"p"},"default")," workspace, thus we need to switch to the ",(0,a.kt)("inlineCode",{parentName:"p"},"dev")," workspace we have just created. "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"~/playground$ kusion workspace switch dev\n")),(0,a.kt)("p",null,"We will progressively add more workspace configurations throughout this user guide."),(0,a.kt)("h3",{id:"initializing-application-configuration"},"Initializing application configuration"),(0,a.kt)("p",null,"Now that workspaces are properly initialized, we can begin by initializing the application configuration:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"# Create a new directory and navigate into it. \nmkdir simple-service && cd simple-service\n\n# Initialize the demo project with the name of the current directory. \nkusion init\n")),(0,a.kt)("p",null,"The directory structure is as follows:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"simple-service/\n.\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n\n2 directories, 4 files\n")),(0,a.kt)("p",null,"The project directory has the following files that are automatically generated:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"project.yaml")," represents project-level configurations."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dev")," directory stores the customized stack configuration:",(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dev/main.k")," stores configurations in the ",(0,a.kt)("inlineCode",{parentName:"li"},"dev")," stack."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dev/stack.yaml")," stores stack-level configurations."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dev/kcl.mod")," stores stack-level dependencies.")))),(0,a.kt)("p",null,"In general, the ",(0,a.kt)("inlineCode",{parentName:"p"},".k")," files are the KCL source code that represents the application configuration, and the ",(0,a.kt)("inlineCode",{parentName:"p"},".yaml")," is the static configuration file that describes behavior at the project or stack level."),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"See ",(0,a.kt)("a",{parentName:"p",href:"../../concepts/project/overview"},"Project")," and ",(0,a.kt)("a",{parentName:"p",href:"../../concepts/stack/overview"},"Stack")," for more details about Project and Stack.")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init")," command will create a demo quickstart application, we may update the ",(0,a.kt)("inlineCode",{parentName:"p"},"dev/kcl.mod")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"dev/main.k")," later. "),(0,a.kt)("h4",{id:"kclmod"},"kcl.mod"),(0,a.kt)("p",null,"There should be a ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file generated automatically under the project directory. The ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file describes the dependency for the current project or stack. By default, it should contain a reference to the official ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kam"},(0,a.kt)("inlineCode",{parentName:"a"},"kam")," repository")," which holds the Kusion ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," and related workload model definitions that fits best practices. You can also create your own models library and reference that."),(0,a.kt)("p",null,"You can change the package name in ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," to ",(0,a.kt)("inlineCode",{parentName:"p"},"simple-service"),": "),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"dev/kcl.mod")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},'[package]\nname = "simple-service"\nversion = "0.1.0"\n\n[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\n\n[profile]\nentries = ["main.k"]\n')),(0,a.kt)("h4",{id:"maink"},"main.k"),(0,a.kt)("p",null,"The configuration file ",(0,a.kt)("inlineCode",{parentName:"p"},"main.k"),", usually written by the application developers, declare customized configurations for a specific stack, including an ",(0,a.kt)("inlineCode",{parentName:"p"},"Application")," instance of ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model. "),(0,a.kt)("p",null,"You can update the ",(0,a.kt)("inlineCode",{parentName:"p"},"main.k")," as follows: "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\n\n"helloworld": ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "helloworld": c.Container {\n image = "gcr.io/google-samples/gb-frontend:v4"\n }\n }\n replicas: 2\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n }\n}\n')),(0,a.kt)("h2",{id:"previewing"},"Previewing"),(0,a.kt)("p",null,"At this point, the project has been completely initialized.\nThe configuration is written in KCL, not JSON/YAML which Kubernetes recognizes, so it needs to be built to get the final output. And we can use the ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion preview")," cmd to preview the Kubernetes resources intended to deliver. "),(0,a.kt)("p",null,"Enter stack dir ",(0,a.kt)("inlineCode",{parentName:"p"},"simple-service/dev")," and preview:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cd simple-service/dev && kusion preview\n")),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"For instructions on the kusion command line tool, execute ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion -h"),", or refer to the tool's online ",(0,a.kt)("a",{parentName:"p",href:"../../reference/commands"},"documentation"),".")),(0,a.kt)("h2",{id:"applying"},"Applying"),(0,a.kt)("p",null,"Preview is now completed. We can apply the configuration as the next step. In the output from ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion preview"),", you can see 3 resources:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"a Namespace named ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service")),(0,a.kt)("li",{parentName:"ul"},"a Deployment named ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service-dev-helloworld")," in the ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service")," namespace"),(0,a.kt)("li",{parentName:"ul"},"a Service named ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service-dev-helloworld-private")," in the ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service")," namespace")),(0,a.kt)("p",null,"Execute command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kusion apply\n")),(0,a.kt)("p",null,"The output is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"}," \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service Create\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private Create\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Create\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS Create v1:Namespace:simple-service success \n SUCCESS Create v1:Service:simple-service:simple-service-dev-helloworld-private success \n SUCCESS Create apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \nCreate apps/v1:Deployment:simple-service:simple-service-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 3 created, 0 updated, 0 deleted.\n")),(0,a.kt)("p",null,"After the configuration applying successfully, you can use the ",(0,a.kt)("inlineCode",{parentName:"p"},"kubectl")," to check the actual status of these resources."),(0,a.kt)("p",null,"1\u3001 Check Namespace"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get ns\n")),(0,a.kt)("p",null,"The output is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"NAME STATUS AGE\ndefault Active 117d\nsimple-service Active 38s\nkube-system Active 117d\n...\n")),(0,a.kt)("p",null,"2\u3001Check Deployment"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get deploy -n simple-service\n")),(0,a.kt)("p",null,"The output is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"NAME READY UP-TO-DATE AVAILABLE AGE\nsimple-service-dev-helloworld 1/1 1 1 59s\n")),(0,a.kt)("p",null,"3\u3001Check Service"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get svc -n simple-service\n")),(0,a.kt)("p",null,"The output is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\nsimple-service-dev-helloworld-private ClusterIP 10.98.89.104 80/TCP 79s\n")),(0,a.kt)("p",null,"4\u3001Validate app"),(0,a.kt)("p",null,"Using the ",(0,a.kt)("inlineCode",{parentName:"p"},"kubectl")," tool, forward native port ",(0,a.kt)("inlineCode",{parentName:"p"},"30000")," to the service port ",(0,a.kt)("inlineCode",{parentName:"p"},"80"),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl port-forward svc/simple-service-dev-helloworld-private -n simple-service 30000:80\n")),(0,a.kt)("p",null,"Open browser and visit ",(0,a.kt)("a",{parentName:"p",href:"http://127.0.0.1:30000"},"http://127.0.0.1:30000"),"\uff1a"),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"app-preview",src:n(92287).Z,width:"1830",height:"330"})))}u.isMDXComponent=!0},92287:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/app-preview-de5274f4267fa725d2a65099e47c6c2c.png"}}]); \ No newline at end of file diff --git a/assets/js/2a719713.ff0653df.js b/assets/js/2a719713.ff0653df.js new file mode 100644 index 00000000000..4bdc35fcfed --- /dev/null +++ b/assets/js/2a719713.ff0653df.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8468],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var i=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=i.createContext({}),p=function(e){var t=i.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},c=function(e){var t=p(e.components);return i.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},d=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(n),m=a,k=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return n?i.createElement(k,r(r({ref:t},c),{},{components:n})):i.createElement(k,r({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,r=new Array(o);r[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,r[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>r,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var i=n(87462),a=(n(67294),n(3905));const o={id:"deploy-application"},r="Deploy Application",l={unversionedId:"user-guides/working-with-k8s/deploy-application",id:"version-v0.11/user-guides/working-with-k8s/deploy-application",title:"Deploy Application",description:"This guide shows you how to use Kusion CLIs to complete the deployment of an application running in Kubernetes.",source:"@site/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/1-deploy-application.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/deploy-application",permalink:"/docs/user-guides/working-with-k8s/deploy-application",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/1-deploy-application.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"deploy-application"},sidebar:"kusion",previous:{title:"Expose Application Service Deployed on CSP Kubernetes",permalink:"/docs/user-guides/cloud-resources/expose-service"},next:{title:"Configure Containers",permalink:"/docs/user-guides/working-with-k8s/container"}},s={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Initializing",id:"initializing",level:2},{value:"Initializing workspace configuration",id:"initializing-workspace-configuration",level:3},{value:"Initializing application configuration",id:"initializing-application-configuration",level:3},{value:"kcl.mod",id:"kclmod",level:4},{value:"main.k",id:"maink",level:4},{value:"Previewing",id:"previewing",level:2},{value:"Applying",id:"applying",level:2}],c={toc:p};function u(e){let{components:t,...o}=e;return(0,a.kt)("wrapper",(0,i.Z)({},c,o,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"deploy-application"},"Deploy Application"),(0,a.kt)("p",null,"This guide shows you how to use Kusion CLIs to complete the deployment of an application running in Kubernetes.\nWe call the abstraction of application operation and maintenance configuration as ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),", and its instance as ",(0,a.kt)("inlineCode",{parentName:"p"},"Application"),".\nIt is essentially a configuration model that describes an application. The complete definition can be seen ",(0,a.kt)("a",{parentName:"p",href:"../../reference/modules/developer-schemas/app-configuration"},"here"),"."),(0,a.kt)("p",null,"In production, the application generally includes minimally several k8s resources:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Namespace"),(0,a.kt)("li",{parentName:"ul"},"Deployment"),(0,a.kt)("li",{parentName:"ul"},"Service")),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"This guide requires you to have a basic understanding of Kubernetes.\nIf you are not familiar with the relevant concepts, please refer to the links below:"),(0,a.kt)("ul",{parentName:"admonition"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/tutorials/kubernetes-basics/"},"Learn Kubernetes Basics")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/"},"Namespace")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/concepts/workloads/controllers/deployment/"},"Deployment")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/concepts/services-networking/service/"},"Service")))),(0,a.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,a.kt)("p",null,"Before we start, we need to complete the following steps:"),(0,a.kt)("p",null,"1\u3001Install Kusion"),(0,a.kt)("p",null,"We recommend using HomeBrew(Mac), Scoop(Windows), or an installation shell script to download and install Kusion.\nSee ",(0,a.kt)("a",{parentName:"p",href:"../../getting-started/install-kusion"},"Download and Install")," for more details."),(0,a.kt)("p",null,"2\u3001Running Kubernetes cluster"),(0,a.kt)("p",null,"There must be a running and accessible Kubernetes cluster and a ",(0,a.kt)("a",{parentName:"p",href:"https://Kubernetes.io/docs/tasks/tools/#kubectl"},"kubectl")," command line tool.\nIf you don't have a cluster yet, you can use ",(0,a.kt)("a",{parentName:"p",href:"https://minikube.sigs.k8s.io/docs/tutorials/multi_node/"},"Minikube")," to start one of your own."),(0,a.kt)("h2",{id:"initializing"},"Initializing"),(0,a.kt)("p",null,"This guide is to deploy an app using Kusion, relying on the Kusion CLI and an existing Kubernetes cluster."),(0,a.kt)("h3",{id:"initializing-workspace-configuration"},"Initializing workspace configuration"),(0,a.kt)("p",null,"In version 0.10.0, we have introduced the new concept of ",(0,a.kt)("a",{parentName:"p",href:"../../concepts/workspace"},"workspaces"),', which is a logical layer whose configurations represent an opinionated set of defaults, often appointed by the platform team. In most cases workspaces are represented with an "environment" in traditional SDLC terms. These workspaces provide a means to separate the concerns between the ',(0,a.kt)("strong",{parentName:"p"},"application developers")," who wish to focus on business logic, and a group of ",(0,a.kt)("strong",{parentName:"p"},"platform engineers")," who wish to standardize the applications on the platform."),(0,a.kt)("p",null,"Driven by the discipline of Platform Engineering, management of the workspaces, including create/updating/deleting workspaces and their configurations should be done by dedicated platform engineers in a large software organizations to facilitate a more mature and scalable collaboration pattern."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"More on the collaboration pattern can be found in the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/design/collaboration/collaboration_paradigm.md"},"design doc"),".")),(0,a.kt)("p",null,"However, if that does NOT apply to your scenario, e.g. if you work in a smaller org without platform engineers or if you are an individual developer, we wish Kusion can still be a value tool to have when delivering an application. In this guide, we are NOT distinctively highlighting the different roles or what the best practices entails (the design doc above has all that) but rather the steps needed to get Kusion tool to work."),(0,a.kt)("p",null,"As of version 0.11.0, workspace configurations in Kusion can not only be managed on the local filesystem in the form of YAML files, but the remotely-managed workspaces have been supported as well."),(0,a.kt)("p",null,"To initialize the workspace configuration:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"~/playground$ touch ~/dev.yaml\n~/playground$ kusion workspace create dev -f ~/dev.yaml\ncreate workspace dev successfully\n")),(0,a.kt)("p",null,"To verify the workspace has been created properly:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"~/playground$ kusion workspace list\n- default\n- dev\n~/playground$ kusion workspace show dev\n{}\n")),(0,a.kt)("p",null,"Note that ",(0,a.kt)("inlineCode",{parentName:"p"},"show")," command tells us the workspace configuration is currently empty, which is expected because we created the ",(0,a.kt)("inlineCode",{parentName:"p"},"dev")," workspace with an empty YAML file. An empty workspace configuration will suffice in some cases, where no platform configurations are needed."),(0,a.kt)("p",null,"Kusion by default uses the ",(0,a.kt)("inlineCode",{parentName:"p"},"default")," workspace, thus we need to switch to the ",(0,a.kt)("inlineCode",{parentName:"p"},"dev")," workspace we have just created. "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"~/playground$ kusion workspace switch dev\n")),(0,a.kt)("p",null,"We will progressively add more workspace configurations throughout this user guide."),(0,a.kt)("h3",{id:"initializing-application-configuration"},"Initializing application configuration"),(0,a.kt)("p",null,"Now that workspaces are properly initialized, we can begin by initializing the application configuration:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"# Create a new directory and navigate into it. \nmkdir simple-service && cd simple-service\n\n# Initialize the demo project with the name of the current directory. \nkusion init\n")),(0,a.kt)("p",null,"The directory structure is as follows:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"simple-service/\n.\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n\n2 directories, 4 files\n")),(0,a.kt)("p",null,"The project directory has the following files that are automatically generated:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"project.yaml")," represents project-level configurations."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dev")," directory stores the customized stack configuration:",(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dev/main.k")," stores configurations in the ",(0,a.kt)("inlineCode",{parentName:"li"},"dev")," stack."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dev/stack.yaml")," stores stack-level configurations."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dev/kcl.mod")," stores stack-level dependencies.")))),(0,a.kt)("p",null,"In general, the ",(0,a.kt)("inlineCode",{parentName:"p"},".k")," files are the KCL source code that represents the application configuration, and the ",(0,a.kt)("inlineCode",{parentName:"p"},".yaml")," is the static configuration file that describes behavior at the project or stack level."),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"See ",(0,a.kt)("a",{parentName:"p",href:"../../concepts/project/overview"},"Project")," and ",(0,a.kt)("a",{parentName:"p",href:"../../concepts/stack/overview"},"Stack")," for more details about Project and Stack.")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init")," command will create a demo quickstart application, we may update the ",(0,a.kt)("inlineCode",{parentName:"p"},"dev/kcl.mod")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"dev/main.k")," later. "),(0,a.kt)("h4",{id:"kclmod"},"kcl.mod"),(0,a.kt)("p",null,"There should be a ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file generated automatically under the project directory. The ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file describes the dependency for the current project or stack. By default, it should contain a reference to the official ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kam"},(0,a.kt)("inlineCode",{parentName:"a"},"kam")," repository")," which holds the Kusion ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," and related workload model definitions that fits best practices. You can also create your own models library and reference that."),(0,a.kt)("p",null,"You can change the package name in ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," to ",(0,a.kt)("inlineCode",{parentName:"p"},"simple-service"),": "),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"dev/kcl.mod")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},'[package]\nname = "simple-service"\nversion = "0.1.0"\n\n[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\n\n[profile]\nentries = ["main.k"]\n')),(0,a.kt)("h4",{id:"maink"},"main.k"),(0,a.kt)("p",null,"The configuration file ",(0,a.kt)("inlineCode",{parentName:"p"},"main.k"),", usually written by the application developers, declare customized configurations for a specific stack, including an ",(0,a.kt)("inlineCode",{parentName:"p"},"Application")," instance of ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model. "),(0,a.kt)("p",null,"You can update the ",(0,a.kt)("inlineCode",{parentName:"p"},"main.k")," as follows: "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\n\n"helloworld": ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "helloworld": c.Container {\n image = "gcr.io/google-samples/gb-frontend:v4"\n }\n }\n replicas: 2\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n }\n}\n')),(0,a.kt)("h2",{id:"previewing"},"Previewing"),(0,a.kt)("p",null,"At this point, the project has been completely initialized.\nThe configuration is written in KCL, not JSON/YAML which Kubernetes recognizes, so it needs to be built to get the final output. And we can use the ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion preview")," cmd to preview the Kubernetes resources intended to deliver. "),(0,a.kt)("p",null,"Enter stack dir ",(0,a.kt)("inlineCode",{parentName:"p"},"simple-service/dev")," and preview:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cd simple-service/dev && kusion preview\n")),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"For instructions on the kusion command line tool, execute ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion -h"),", or refer to the tool's online ",(0,a.kt)("a",{parentName:"p",href:"../../reference/commands"},"documentation"),".")),(0,a.kt)("h2",{id:"applying"},"Applying"),(0,a.kt)("p",null,"Preview is now completed. We can apply the configuration as the next step. In the output from ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion preview"),", you can see 3 resources:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"a Namespace named ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service")),(0,a.kt)("li",{parentName:"ul"},"a Deployment named ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service-dev-helloworld")," in the ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service")," namespace"),(0,a.kt)("li",{parentName:"ul"},"a Service named ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service-dev-helloworld-private")," in the ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service")," namespace")),(0,a.kt)("p",null,"Execute command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kusion apply\n")),(0,a.kt)("p",null,"The output is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"}," \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service Create\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private Create\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Create\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS Create v1:Namespace:simple-service success \n SUCCESS Create v1:Service:simple-service:simple-service-dev-helloworld-private success \n SUCCESS Create apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \nCreate apps/v1:Deployment:simple-service:simple-service-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 3 created, 0 updated, 0 deleted.\n")),(0,a.kt)("p",null,"After the configuration applying successfully, you can use the ",(0,a.kt)("inlineCode",{parentName:"p"},"kubectl")," to check the actual status of these resources."),(0,a.kt)("p",null,"1\u3001 Check Namespace"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get ns\n")),(0,a.kt)("p",null,"The output is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"NAME STATUS AGE\ndefault Active 117d\nsimple-service Active 38s\nkube-system Active 117d\n...\n")),(0,a.kt)("p",null,"2\u3001Check Deployment"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get deploy -n simple-service\n")),(0,a.kt)("p",null,"The output is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"NAME READY UP-TO-DATE AVAILABLE AGE\nsimple-service-dev-helloworld 1/1 1 1 59s\n")),(0,a.kt)("p",null,"3\u3001Check Service"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get svc -n simple-service\n")),(0,a.kt)("p",null,"The output is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\nsimple-service-dev-helloworld-private ClusterIP 10.98.89.104 80/TCP 79s\n")),(0,a.kt)("p",null,"4\u3001Validate app"),(0,a.kt)("p",null,"Using the ",(0,a.kt)("inlineCode",{parentName:"p"},"kubectl")," tool, forward native port ",(0,a.kt)("inlineCode",{parentName:"p"},"30000")," to the service port ",(0,a.kt)("inlineCode",{parentName:"p"},"80"),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl port-forward svc/simple-service-dev-helloworld-private -n simple-service 30000:80\n")),(0,a.kt)("p",null,"Open browser and visit ",(0,a.kt)("a",{parentName:"p",href:"http://127.0.0.1:30000"},"http://127.0.0.1:30000"),"\uff1a"),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"app-preview",src:n(92287).Z,width:"1830",height:"330"})))}u.isMDXComponent=!0},92287:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/app-preview-de5274f4267fa725d2a65099e47c6c2c.png"}}]); \ No newline at end of file diff --git a/assets/js/2b0acc78.a87574cc.js b/assets/js/2b0acc78.a87574cc.js new file mode 100644 index 00000000000..33b92acfb8b --- /dev/null +++ b/assets/js/2b0acc78.a87574cc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5102],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=a.createContext({}),l=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=l(e.components);return a.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=l(n),m=o,f=d["".concat(p,".").concat(m)]||d[m]||u[m]||r;return n?a.createElement(f,i(i({ref:t},c),{},{components:n})):a.createElement(f,i({ref:t},c))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,i=new Array(r);i[0]=d;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>u,frontMatter:()=>r,metadata:()=>s,toc:()=>l});var a=n(87462),o=(n(67294),n(3905));const r={sidebar_position:2},i="Kusion vs. Other Software",s={unversionedId:"intro/kusion-vs-x",id:"version-v0.9/intro/kusion-vs-x",title:"Kusion vs. Other Software",description:"It can be difficult to understand how different software compare to each other. Is one a replacement for the other? Are they complementary? etc. In this section, we compare Kusion to other software.",source:"@site/docs_versioned_docs/version-v0.9/intro/kusion-vs-x.md",sourceDirName:"intro",slug:"/intro/kusion-vs-x",permalink:"/docs/v0.9/intro/kusion-vs-x",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/intro/kusion-vs-x.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"kusion",previous:{title:"Overview",permalink:"/docs/v0.9/"},next:{title:"Get Started",permalink:"/docs/v0.9/getting-started/"}},p={},l=[],c={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-vs-other-software"},"Kusion vs. Other Software"),(0,o.kt)("p",null,"It can be difficult to understand how different software compare to each other. Is one a replacement for the other? Are they complementary? etc. In this section, we compare Kusion to other software."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. GitOps (ArgoCD, FluxCD, etc.)")),(0,o.kt)("p",null,"According to the ",(0,o.kt)("a",{parentName:"p",href:"https://opengitops.dev/"},"open GitOps principles"),", GitOps systems typically have its desired state expressed declaratively, continuously observe actual system state and attempt to apply the desired state. In the design of Kusion toolchain, we refer to those principles but have no intention to reinvent any GitOps systems wheel. "),(0,o.kt)("p",null,"Kusion adopts your GitOps process and improves it with richness of features. The declarative ",(0,o.kt)("a",{parentName:"p",href:"../concepts/appconfiguration"},"AppConfiguration")," model can be used to express desired intent, once intent is declared ",(0,o.kt)("a",{parentName:"p",href:"../reference/cli/kusion"},"Kusion CLI")," takes the role to make production match intent as safely as possible. "),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. PaaS (Heroku, Vercel, etc.)")),(0,o.kt)("p",null,"Kusion shares the same goal with traditional PaaS platforms to provide application delivery and management capabilities. The intuitive difference from the full functionality PaaS platforms is that Kusion is a client-side toolchain, not a complete PaaS platform. "),(0,o.kt)("p",null,"Also traditional PaaS platforms typically constrain the type of applications they can run but there is no such constrain for Kusion which means Kusion provides greater flexibility."),(0,o.kt)("p",null,"Kusion allows you to have platform-like features without the constraints of a traditional PaaS. However, Kusion is not attempting to replace any PaaS platforms, instead Kusion can be used to deploy to a platform such as Heroku."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. KubeVela")),(0,o.kt)("p",null,"KubeVela is a modern software delivery and management control plane. KubeVela makes it easier to deploy and operate applications on top of Kubernetes."),(0,o.kt)("p",null,"Kusion is not a control plane. Kusion is a client-side tool for describing application intent in a declarative way and providing consistent workflow to apply that desired state."),(0,o.kt)("p",null,"With proper Generator implementation, the target Spec of ",(0,o.kt)("a",{parentName:"p",href:"../concepts/appconfiguration"},"AppConfiguration")," can be ",(0,o.kt)("a",{parentName:"p",href:"https://kubevela.io/docs/getting-started/core-concept/"},"KubeVela Application"),' and Kusion can use KubeVela to satisfy the "apply" step.'),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. Helm")),(0,o.kt)("p",null,"The concept of Helm originates from the ",(0,o.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Package_manager"},"package management")," mechanism of the operating system. It is a package management tool based on templated YAML files and supports the execution and management of resources in the package. "),(0,o.kt)("p",null,"Kusion is not a package manager. Kusion naturally provides a superset of Helm capabilities with the modeled key-value pairs, so that developers can use Kusion directly as a programable alternative to avoid the pain of writing text templates. For users who have adopted Helm, the stack compilation results in Kusion can be packaged and used in Helm format."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. Kubernetes")),(0,o.kt)("p",null,'Kubernetes(K8s) is a container scheduling and management runtime widely used around the world, an "operating system" core for containers, and a platform for building platforms. Above the Kubernetes API layer, Kusion aims to provide app-centric ',(0,o.kt)("strong",{parentName:"p"},"abstraction")," and unified ",(0,o.kt)("strong",{parentName:"p"},"workspace"),", better ",(0,o.kt)("strong",{parentName:"p"},"user experience")," and automation ",(0,o.kt)("strong",{parentName:"p"},"workflow"),", and helps developers build the app delivery model easily and collaboratively."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2b0acc78.c585ed54.js b/assets/js/2b0acc78.c585ed54.js deleted file mode 100644 index 2cf8f81e2d0..00000000000 --- a/assets/js/2b0acc78.c585ed54.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5102],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=a.createContext({}),l=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=l(e.components);return a.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=l(n),m=o,f=d["".concat(p,".").concat(m)]||d[m]||u[m]||r;return n?a.createElement(f,i(i({ref:t},c),{},{components:n})):a.createElement(f,i({ref:t},c))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,i=new Array(r);i[0]=d;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>u,frontMatter:()=>r,metadata:()=>s,toc:()=>l});var a=n(87462),o=(n(67294),n(3905));const r={sidebar_position:2},i="Kusion vs. Other Software",s={unversionedId:"intro/kusion-vs-x",id:"version-v0.9/intro/kusion-vs-x",title:"Kusion vs. Other Software",description:"It can be difficult to understand how different software compare to each other. Is one a replacement for the other? Are they complementary? etc. In this section, we compare Kusion to other software.",source:"@site/docs_versioned_docs/version-v0.9/intro/kusion-vs-x.md",sourceDirName:"intro",slug:"/intro/kusion-vs-x",permalink:"/docs/v0.9/intro/kusion-vs-x",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/intro/kusion-vs-x.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"kusion",previous:{title:"Overview",permalink:"/docs/v0.9/"},next:{title:"Get Started",permalink:"/docs/v0.9/getting-started/"}},p={},l=[],c={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-vs-other-software"},"Kusion vs. Other Software"),(0,o.kt)("p",null,"It can be difficult to understand how different software compare to each other. Is one a replacement for the other? Are they complementary? etc. In this section, we compare Kusion to other software."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. GitOps (ArgoCD, FluxCD, etc.)")),(0,o.kt)("p",null,"According to the ",(0,o.kt)("a",{parentName:"p",href:"https://opengitops.dev/"},"open GitOps principles"),", GitOps systems typically have its desired state expressed declaratively, continuously observe actual system state and attempt to apply the desired state. In the design of Kusion toolchain, we refer to those principles but have no intention to reinvent any GitOps systems wheel. "),(0,o.kt)("p",null,"Kusion adopts your GitOps process and improves it with richness of features. The declarative ",(0,o.kt)("a",{parentName:"p",href:"../concepts/appconfiguration"},"AppConfiguration")," model can be used to express desired intent, once intent is declared ",(0,o.kt)("a",{parentName:"p",href:"../reference/cli/kusion"},"Kusion CLI")," takes the role to make production match intent as safely as possible. "),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. PaaS (Heroku, Vercel, etc.)")),(0,o.kt)("p",null,"Kusion shares the same goal with traditional PaaS platforms to provide application delivery and management capabilities. The intuitive difference from the full functionality PaaS platforms is that Kusion is a client-side toolchain, not a complete PaaS platform. "),(0,o.kt)("p",null,"Also traditional PaaS platforms typically constrain the type of applications they can run but there is no such constrain for Kusion which means Kusion provides greater flexibility."),(0,o.kt)("p",null,"Kusion allows you to have platform-like features without the constraints of a traditional PaaS. However, Kusion is not attempting to replace any PaaS platforms, instead Kusion can be used to deploy to a platform such as Heroku."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. KubeVela")),(0,o.kt)("p",null,"KubeVela is a modern software delivery and management control plane. KubeVela makes it easier to deploy and operate applications on top of Kubernetes."),(0,o.kt)("p",null,"Kusion is not a control plane. Kusion is a client-side tool for describing application intent in a declarative way and providing consistent workflow to apply that desired state."),(0,o.kt)("p",null,"With proper Generator implementation, the target Spec of ",(0,o.kt)("a",{parentName:"p",href:"../concepts/appconfiguration"},"AppConfiguration")," can be ",(0,o.kt)("a",{parentName:"p",href:"https://kubevela.io/docs/getting-started/core-concept/"},"KubeVela Application"),' and Kusion can use KubeVela to satisfy the "apply" step.'),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. Helm")),(0,o.kt)("p",null,"The concept of Helm originates from the ",(0,o.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Package_manager"},"package management")," mechanism of the operating system. It is a package management tool based on templated YAML files and supports the execution and management of resources in the package. "),(0,o.kt)("p",null,"Kusion is not a package manager. Kusion naturally provides a superset of Helm capabilities with the modeled key-value pairs, so that developers can use Kusion directly as a programable alternative to avoid the pain of writing text templates. For users who have adopted Helm, the stack compilation results in Kusion can be packaged and used in Helm format."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. Kubernetes")),(0,o.kt)("p",null,'Kubernetes(K8s) is a container scheduling and management runtime widely used around the world, an "operating system" core for containers, and a platform for building platforms. Above the Kubernetes API layer, Kusion aims to provide app-centric ',(0,o.kt)("strong",{parentName:"p"},"abstraction")," and unified ",(0,o.kt)("strong",{parentName:"p"},"workspace"),", better ",(0,o.kt)("strong",{parentName:"p"},"user experience")," and automation ",(0,o.kt)("strong",{parentName:"p"},"workflow"),", and helps developers build the app delivery model easily and collaboratively."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2be338c6.0a4a7306.js b/assets/js/2be338c6.0a4a7306.js new file mode 100644 index 00000000000..d4cf42e1618 --- /dev/null +++ b/assets/js/2be338c6.0a4a7306.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7412],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var o=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=o.createContext({}),p=function(e){var t=o.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},c=function(e){var t=p(e.components);return o.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},u=o.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=p(n),f=i,h=u["".concat(l,".").concat(f)]||u[f]||d[f]||r;return n?o.createElement(h,a(a({ref:t},c),{},{components:n})):o.createElement(h,a({ref:t},c))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,a=new Array(r);a[0]=u;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,a[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>d,frontMatter:()=>r,metadata:()=>s,toc:()=>p});var o=n(87462),i=(n(67294),n(3905));const r={id:"app-configuration",sidebar_label:"AppConfiguration"},a="AppConfiguration",s={unversionedId:"concepts/app-configuration",id:"version-v0.11/concepts/app-configuration",title:"AppConfiguration",description:"As a modern cloud-native application delivery toolchain, declarative intent-based actuation is the central idea of Kusion, and AppConfiguration model plays the role of describing the intent, which provides a simpler path for on-boarding developers to the platform without leaking low level details in runtime infrastructure and allows developers to fully focus on the application logic itself.",source:"@site/docs_versioned_docs/version-v0.11/3-concepts/5-appconfiguration.md",sourceDirName:"3-concepts",slug:"/concepts/app-configuration",permalink:"/docs/concepts/app-configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/3-concepts/5-appconfiguration.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:5,frontMatter:{id:"app-configuration",sidebar_label:"AppConfiguration"},sidebar:"kusion",previous:{title:"Workspace",permalink:"/docs/concepts/workspace"},next:{title:"Spec",permalink:"/docs/concepts/spec"}},l={},p=[{value:"Workload",id:"workload",level:4},{value:"Accessory",id:"accessory",level:4},{value:"Pipeline",id:"pipeline",level:4},{value:"Topologies",id:"topologies",level:4}],c={toc:p};function d(e){let{components:t,...r}=e;return(0,i.kt)("wrapper",(0,o.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"appconfiguration"},"AppConfiguration"),(0,i.kt)("p",null,"As a modern cloud-native application delivery toolchain, declarative intent-based actuation is the central idea of Kusion, and ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model plays the role of describing the intent, which provides a simpler path for on-boarding developers to the platform without leaking low level details in runtime infrastructure and allows developers to fully focus on the application logic itself."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model consolidates workload and their dependent accessories for the application deployment, along with any pipeline and operational requirements into one standardized, infrastructure-independent declarative specification. This declarative specification represents the intuitive user intent for the application, which drives a standardized and efficient application delivery and operation process in a hybrid environment."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"appconfig.png",src:n(57091).Z,width:"5512",height:"3390"})),(0,i.kt)("p",null,"AppConfiguration consists of four core concepts, namely ",(0,i.kt)("inlineCode",{parentName:"p"},"Workload"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Accessory"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Pipeline"),", and ",(0,i.kt)("inlineCode",{parentName:"p"},"Dependency"),". We will walk through these concepts one by one."),(0,i.kt)("h4",{id:"workload"},"Workload"),(0,i.kt)("p",null,"Workload is a representation of the business logic that runs in the cluster. Common workload types include long-running services that should \u201cnever\u201d go down and batch jobs that take from a few seconds to a few days to complete. A valid AppConfiguration instance must include at least one Workload, which is made of one or more containers, along with their configurations, such as the container image, environment variables, and resource requirements."),(0,i.kt)("p",null,"In most cases, a Workload is a backend service or the frontend of an Application. For example, in a micro-service architecture, each service would be represented by a distinct Workload. This allows developers to manage and deploy their code in a more organized and efficient manner."),(0,i.kt)("h4",{id:"accessory"},"Accessory"),(0,i.kt)("p",null,"Using the analogy of a car, workload is the core engine of application, but only having the engine isn\u2019t enough for the application to function properly. In most cases there must be other supporting parts for the workload to operate as intended. For those supporting parts we call them Accessory. Accessory refers to various runtime capabilities and operational requirements provided by the underlying infrastructure, such as database, network load-balancer, storage and so on."),(0,i.kt)("p",null,"From the perspective of team collaboration, the platform team should be responsible for creating and maintaining various accessory definitions, providing reusable building blocks out-of-the-box. Application developers just need to leverage the existing accessories to cover the evolving application needs. This helps software organizations achieve separation of concern, so that different roles can focus on the subject matter they are an expert of."),(0,i.kt)("h4",{id:"pipeline"},"Pipeline"),(0,i.kt)("p",null,"Running reliable applications requires reliable delivery pipelines. By default, Kusion provides a relatively fixed built-in application delivery pipeline, which should be sufficient for most use cases. However, as the application scale and complexity grows, so does the need for a customizable delivery pipeline. Developers wish for more fine-tuned control and customization over the workflow to delivery their applications. That\u2019s why we introduced the Pipeline section in AppConfiguration model."),(0,i.kt)("p",null,"A customized delivery pipeline is made of several steps, each corresponds to an operation that needs to be executed, such as running certain tests after a deployment, scanning artifacts for vulnerabilities prior to a deployment, and so on. Implementation-wise, the execution of each step should be carried out in the form of a plugin, developed and managed by the platform owners."),(0,i.kt)("h4",{id:"topologies"},"Topologies"),(0,i.kt)("p",null,"Application dependencies refer to the external services or other software that an application relies on in order to function properly. These dependencies may be required in order to provide certain functionality or to use certain features in the application."),(0,i.kt)("p",null,"Similar to declaring a dependency from an application to an accessory, AppConfiguration lets you declare the dependencies between different applications in the same way."))}d.isMDXComponent=!0},57091:(e,t,n)=>{n.d(t,{Z:()=>o});const o=n.p+"assets/images/appconfig-04e20b2e12ca7d5c3bc3992b2d602416.png"}}]); \ No newline at end of file diff --git a/assets/js/2be338c6.ab8a4e1d.js b/assets/js/2be338c6.ab8a4e1d.js deleted file mode 100644 index d9fe146105c..00000000000 --- a/assets/js/2be338c6.ab8a4e1d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7412],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var o=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=o.createContext({}),p=function(e){var t=o.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},c=function(e){var t=p(e.components);return o.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},u=o.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=p(n),f=i,h=u["".concat(l,".").concat(f)]||u[f]||d[f]||r;return n?o.createElement(h,a(a({ref:t},c),{},{components:n})):o.createElement(h,a({ref:t},c))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,a=new Array(r);a[0]=u;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,a[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>d,frontMatter:()=>r,metadata:()=>s,toc:()=>p});var o=n(87462),i=(n(67294),n(3905));const r={id:"app-configuration",sidebar_label:"AppConfiguration"},a="AppConfiguration",s={unversionedId:"concepts/app-configuration",id:"version-v0.11/concepts/app-configuration",title:"AppConfiguration",description:"As a modern cloud-native application delivery toolchain, declarative intent-based actuation is the central idea of Kusion, and AppConfiguration model plays the role of describing the intent, which provides a simpler path for on-boarding developers to the platform without leaking low level details in runtime infrastructure and allows developers to fully focus on the application logic itself.",source:"@site/docs_versioned_docs/version-v0.11/3-concepts/5-appconfiguration.md",sourceDirName:"3-concepts",slug:"/concepts/app-configuration",permalink:"/docs/concepts/app-configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/3-concepts/5-appconfiguration.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:5,frontMatter:{id:"app-configuration",sidebar_label:"AppConfiguration"},sidebar:"kusion",previous:{title:"Workspace",permalink:"/docs/concepts/workspace"},next:{title:"Spec",permalink:"/docs/concepts/spec"}},l={},p=[{value:"Workload",id:"workload",level:4},{value:"Accessory",id:"accessory",level:4},{value:"Pipeline",id:"pipeline",level:4},{value:"Topologies",id:"topologies",level:4}],c={toc:p};function d(e){let{components:t,...r}=e;return(0,i.kt)("wrapper",(0,o.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"appconfiguration"},"AppConfiguration"),(0,i.kt)("p",null,"As a modern cloud-native application delivery toolchain, declarative intent-based actuation is the central idea of Kusion, and ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model plays the role of describing the intent, which provides a simpler path for on-boarding developers to the platform without leaking low level details in runtime infrastructure and allows developers to fully focus on the application logic itself."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model consolidates workload and their dependent accessories for the application deployment, along with any pipeline and operational requirements into one standardized, infrastructure-independent declarative specification. This declarative specification represents the intuitive user intent for the application, which drives a standardized and efficient application delivery and operation process in a hybrid environment."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"appconfig.png",src:n(57091).Z,width:"5512",height:"3390"})),(0,i.kt)("p",null,"AppConfiguration consists of four core concepts, namely ",(0,i.kt)("inlineCode",{parentName:"p"},"Workload"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Accessory"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Pipeline"),", and ",(0,i.kt)("inlineCode",{parentName:"p"},"Dependency"),". We will walk through these concepts one by one."),(0,i.kt)("h4",{id:"workload"},"Workload"),(0,i.kt)("p",null,"Workload is a representation of the business logic that runs in the cluster. Common workload types include long-running services that should \u201cnever\u201d go down and batch jobs that take from a few seconds to a few days to complete. A valid AppConfiguration instance must include at least one Workload, which is made of one or more containers, along with their configurations, such as the container image, environment variables, and resource requirements."),(0,i.kt)("p",null,"In most cases, a Workload is a backend service or the frontend of an Application. For example, in a micro-service architecture, each service would be represented by a distinct Workload. This allows developers to manage and deploy their code in a more organized and efficient manner."),(0,i.kt)("h4",{id:"accessory"},"Accessory"),(0,i.kt)("p",null,"Using the analogy of a car, workload is the core engine of application, but only having the engine isn\u2019t enough for the application to function properly. In most cases there must be other supporting parts for the workload to operate as intended. For those supporting parts we call them Accessory. Accessory refers to various runtime capabilities and operational requirements provided by the underlying infrastructure, such as database, network load-balancer, storage and so on."),(0,i.kt)("p",null,"From the perspective of team collaboration, the platform team should be responsible for creating and maintaining various accessory definitions, providing reusable building blocks out-of-the-box. Application developers just need to leverage the existing accessories to cover the evolving application needs. This helps software organizations achieve separation of concern, so that different roles can focus on the subject matter they are an expert of."),(0,i.kt)("h4",{id:"pipeline"},"Pipeline"),(0,i.kt)("p",null,"Running reliable applications requires reliable delivery pipelines. By default, Kusion provides a relatively fixed built-in application delivery pipeline, which should be sufficient for most use cases. However, as the application scale and complexity grows, so does the need for a customizable delivery pipeline. Developers wish for more fine-tuned control and customization over the workflow to delivery their applications. That\u2019s why we introduced the Pipeline section in AppConfiguration model."),(0,i.kt)("p",null,"A customized delivery pipeline is made of several steps, each corresponds to an operation that needs to be executed, such as running certain tests after a deployment, scanning artifacts for vulnerabilities prior to a deployment, and so on. Implementation-wise, the execution of each step should be carried out in the form of a plugin, developed and managed by the platform owners."),(0,i.kt)("h4",{id:"topologies"},"Topologies"),(0,i.kt)("p",null,"Application dependencies refer to the external services or other software that an application relies on in order to function properly. These dependencies may be required in order to provide certain functionality or to use certain features in the application."),(0,i.kt)("p",null,"Similar to declaring a dependency from an application to an accessory, AppConfiguration lets you declare the dependencies between different applications in the same way."))}d.isMDXComponent=!0},57091:(e,t,n)=>{n.d(t,{Z:()=>o});const o=n.p+"assets/images/appconfig-04e20b2e12ca7d5c3bc3992b2d602416.png"}}]); \ No newline at end of file diff --git a/assets/js/2bf7c981.5f304794.js b/assets/js/2bf7c981.5f304794.js deleted file mode 100644 index c6a5bec65a1..00000000000 --- a/assets/js/2bf7c981.5f304794.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6646],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},l=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=p(n),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||a;return n?r.createElement(f,s(s({ref:t},l),{},{components:n})):r.createElement(f,s({ref:t},l))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var p=2;p{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var r=n(87462),o=(n(67294),n(3905));const a={},s="kusion generate",i={unversionedId:"reference/commands/kusion-generate",id:"reference/commands/kusion-generate",title:"kusion generate",description:"Generate and print the resulting Spec resources of target Stack",source:"@site/docs/kusion/6-reference/1-commands/kusion-generate.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-generate",permalink:"/docs/next/reference/commands/kusion-generate",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-generate.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion destroy",permalink:"/docs/next/reference/commands/kusion-destroy"},next:{title:"kusion init",permalink:"/docs/next/reference/commands/kusion-init"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-generate"},"kusion generate"),(0,o.kt)("p",null,"Generate and print the resulting Spec resources of target Stack"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," This command generates Spec resources with given values, then write the resulting Spec resources to specific output file or stdout.\n\n The nearest parent folder containing a stack.yaml file is loaded from the project in the current directory.\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion generate [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"\n # Generate and write Spec resources to specific output file\n kusion generate -o /tmp/spec.yaml\n\n # Generate spec with custom workspace\n kusion generate -o /tmp/spec.yaml --workspace dev\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string The backend to use, supports 'local', 'oss' and 's3'.\n -h, --help help for generate\n --no-style no-style sets to RawOutput mode and disables all of styling\n -o, --output string File to write generated Spec resources to\n --set stringArray Set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)\n -w, --workdir string The work directory to run Kusion CLI.\n --workspace string The name of target workspace to operate in.\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2bf7c981.b51e5670.js b/assets/js/2bf7c981.b51e5670.js new file mode 100644 index 00000000000..e9238f51f10 --- /dev/null +++ b/assets/js/2bf7c981.b51e5670.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6646],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},l=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=p(n),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||a;return n?r.createElement(f,s(s({ref:t},l),{},{components:n})):r.createElement(f,s({ref:t},l))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var p=2;p{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var r=n(87462),o=(n(67294),n(3905));const a={},s="kusion generate",i={unversionedId:"reference/commands/kusion-generate",id:"reference/commands/kusion-generate",title:"kusion generate",description:"Generate and print the resulting Spec resources of target Stack",source:"@site/docs/kusion/6-reference/1-commands/kusion-generate.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-generate",permalink:"/docs/next/reference/commands/kusion-generate",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-generate.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion destroy",permalink:"/docs/next/reference/commands/kusion-destroy"},next:{title:"kusion init",permalink:"/docs/next/reference/commands/kusion-init"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-generate"},"kusion generate"),(0,o.kt)("p",null,"Generate and print the resulting Spec resources of target Stack"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," This command generates Spec resources with given values, then write the resulting Spec resources to specific output file or stdout.\n\n The nearest parent folder containing a stack.yaml file is loaded from the project in the current directory.\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion generate [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"\n # Generate and write Spec resources to specific output file\n kusion generate -o /tmp/spec.yaml\n\n # Generate spec with custom workspace\n kusion generate -o /tmp/spec.yaml --workspace dev\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string The backend to use, supports 'local', 'oss' and 's3'.\n -h, --help help for generate\n --no-style no-style sets to RawOutput mode and disables all of styling\n -o, --output string File to write generated Spec resources to\n --set stringArray Set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)\n -w, --workdir string The work directory to run Kusion CLI.\n --workspace string The name of target workspace to operate in.\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2e408e18.058934e9.js b/assets/js/2e408e18.058934e9.js deleted file mode 100644 index b5f27b0837e..00000000000 --- a/assets/js/2e408e18.058934e9.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5681],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),c=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=c(n),m=i,k=u["".concat(s,".").concat(m)]||u[m]||d[m]||r;return n?a.createElement(k,o(o({ref:t},p),{},{components:n})):a.createElement(k,o({ref:t},p))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,o=new Array(r);o[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:i,o[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>d,frontMatter:()=>r,metadata:()=>l,toc:()=>c});var a=n(87462),i=(n(67294),n(3905));const r={},o="Backend Configuration",l={unversionedId:"reference/cli/backend/backend-configuration",id:"version-v0.9/reference/cli/backend/backend-configuration",title:"Backend Configuration",description:"The backend configuration defines the place where Kusion stores its state data file. By default, Kusion uses the local type of backend to store the state on the local disk, while for team collaboration projects, the state can be stored on a remote type of backend, such as database, oss and s3 to allow multiple users access it.",source:"@site/docs_versioned_docs/version-v0.9/reference/cli/backend/backend-configuration.md",sourceDirName:"reference/cli/backend",slug:"/reference/cli/backend/backend-configuration",permalink:"/docs/v0.9/reference/cli/backend/backend-configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/cli/backend/backend-configuration.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion version",permalink:"/docs/v0.9/reference/cli/kusion/kusion_version"},next:{title:"Kusion Model Library",permalink:"/docs/v0.9/reference/model/"}},s={},c=[{value:"Configuring State Backend",id:"configuring-state-backend",level:2},{value:"Command Line Parameters",id:"command-line-parameters",level:3},{value:"Configuration File",id:"configuration-file",level:3},{value:"Configuration Combination",id:"configuration-combination",level:3},{value:"Available Backend",id:"available-backend",level:2},{value:"Default Backend",id:"default-backend",level:3},{value:"local",id:"local",level:3},{value:"oss",id:"oss",level:3},{value:"s3",id:"s3",level:3},{value:"db",id:"db",level:3}],p={toc:c};function d(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"backend-configuration"},"Backend Configuration"),(0,i.kt)("p",null,"The backend configuration defines the place where Kusion stores its ",(0,i.kt)("inlineCode",{parentName:"p"},"state")," data file. By default, Kusion uses the ",(0,i.kt)("inlineCode",{parentName:"p"},"local")," type of backend to store the state on the local disk, while for team collaboration projects, the state can be stored on a ",(0,i.kt)("inlineCode",{parentName:"p"},"remote")," type of backend, such as ",(0,i.kt)("inlineCode",{parentName:"p"},"database"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"oss")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"s3")," to allow multiple users access it. "),(0,i.kt)("h2",{id:"configuring-state-backend"},"Configuring State Backend"),(0,i.kt)("p",null,"Kusion configures the storage of state through command line parameters or the ",(0,i.kt)("inlineCode",{parentName:"p"},"backend")," field in the ",(0,i.kt)("inlineCode",{parentName:"p"},"project.yaml")," file. "),(0,i.kt)("h3",{id:"command-line-parameters"},"Command Line Parameters"),(0,i.kt)("p",null,"Users can specify the type of backend with the option ",(0,i.kt)("inlineCode",{parentName:"p"},"--backend-type"),", and configure the detailed information with ",(0,i.kt)("inlineCode",{parentName:"p"},"--backend-config")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"-C"),", for instance: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"kusion apply --backend-type local --backend-config path=kusion_state.json\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"kusion destroy --backend-type local --backend-config path=kusion_state.json\n")),(0,i.kt)("h3",{id:"configuration-file"},"Configuration File"),(0,i.kt)("p",null,"Users can configure the storage of the state with the ",(0,i.kt)("inlineCode",{parentName:"p"},"backend")," field in the ",(0,i.kt)("inlineCode",{parentName:"p"},"project.yaml")," file: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"# project.yaml\nbackend: \n storageType: local\n config: \n path: kusion_state.json\n")),(0,i.kt)("p",null,"In this case, ",(0,i.kt)("inlineCode",{parentName:"p"},"storageType")," is used to declare the type of storage for the state backend, and ",(0,i.kt)("inlineCode",{parentName:"p"},"config")," is used to declare the required parameters for the corresponding storage type. "),(0,i.kt)("h3",{id:"configuration-combination"},"Configuration Combination"),(0,i.kt)("p",null,"When both of the ",(0,i.kt)("inlineCode",{parentName:"p"},"config")," field in the ",(0,i.kt)("inlineCode",{parentName:"p"},"project.yaml")," and the ",(0,i.kt)("inlineCode",{parentName:"p"},"--backend-config")," option in the command line are configured, Kusion will merge the entire configuration, combining both the ",(0,i.kt)("inlineCode",{parentName:"p"},"project.yaml")," file and the command line options. When there comes a conflict between the options in the ",(0,i.kt)("inlineCode",{parentName:"p"},"project.yaml")," file and the command line, the options in the ",(0,i.kt)("strong",{parentName:"p"},"command line")," will take precedence. This way, users can pass the sensitive information like ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeyID")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeySecret")," to Kusion through command line parameters. "),(0,i.kt)("h2",{id:"available-backend"},"Available Backend"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"local"),(0,i.kt)("li",{parentName:"ul"},"oss"),(0,i.kt)("li",{parentName:"ul"},"s3"),(0,i.kt)("li",{parentName:"ul"},"db")),(0,i.kt)("h3",{id:"default-backend"},"Default Backend"),(0,i.kt)("p",null,"When neither the ",(0,i.kt)("inlineCode",{parentName:"p"},"project.yaml")," file nor the command line parameters declare the backend configuration, Kusion by default uses the ",(0,i.kt)("a",{parentName:"p",href:"#local"},"local"),". "),(0,i.kt)("h3",{id:"local"},"local"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"local")," storage type stores the ",(0,i.kt)("inlineCode",{parentName:"p"},"state")," on the local file system, which is suitable for local operations while not ideal for multi-user collaboration. "),(0,i.kt)("p",null,"Here is an example: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"# project.yaml\nbackend: \n storageType: local\n config: \n path: kusion_state.json\n")),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"storageType - local, using local file system to store the state"),(0,i.kt)("li",{parentName:"ul"},"path - ",(0,i.kt)("inlineCode",{parentName:"li"},"optional")," specify the local file path to store the state")),(0,i.kt)("h3",{id:"oss"},"oss"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"oss")," storage type stores the ",(0,i.kt)("inlineCode",{parentName:"p"},"state")," on the ",(0,i.kt)("strong",{parentName:"p"},"Alicloud Object Storage Service (OSS)"),". "),(0,i.kt)("p",null,"Here is an example: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"# project.yaml\nbackend:\n storageType: oss\n config: \n endpoint: oss-cn-beijing.aliyuncs.com\n bucket: kusion-oss\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"kusion apply -C accessKeyID=******* -C accessKeySecret=*******\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"kusion destroy -C accessKeyID=******* -C accessKeySecret=*******\n")),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"storageType - oss, using alicloud oss as the storage backend for state"),(0,i.kt)("li",{parentName:"ul"},"endpoint - ",(0,i.kt)("inlineCode",{parentName:"li"},"required")," specify the access endpoint for alicloud oss bucket"),(0,i.kt)("li",{parentName:"ul"},"bucket - ",(0,i.kt)("inlineCode",{parentName:"li"},"required")," specify the name of the alicloud oss bucket"),(0,i.kt)("li",{parentName:"ul"},"accessKeyID - ",(0,i.kt)("inlineCode",{parentName:"li"},"required")," specify the alicloud account accessKeyID"),(0,i.kt)("li",{parentName:"ul"},"accessKeySecret - ",(0,i.kt)("inlineCode",{parentName:"li"},"required")," specify the alicloud account accessKeySecret")),(0,i.kt)("h3",{id:"s3"},"s3"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"s3")," storage type stores the ",(0,i.kt)("inlineCode",{parentName:"p"},"state")," on the ",(0,i.kt)("strong",{parentName:"p"},"AWS Simple Storage Service (S3)"),". "),(0,i.kt)("p",null,"Here is an example: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"# project.yaml\nbackend: \n storageType: s3\n config: \n endpoint: s3.us-east-1.amazonaws.com\n bucket: kusion-s3\n region: us-east-1\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"kusion apply -C accessKeyID=******* -C accessKeySecret=*******\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"kusion destroy -C accessKeyID=******* -C accessKeySecret=*******\n")),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"storageType - s3, using aws s3 as the storage backend for state"),(0,i.kt)("li",{parentName:"ul"},"endpoint - ",(0,i.kt)("inlineCode",{parentName:"li"},"required")," specify the access endpoint for aws s3 bucket"),(0,i.kt)("li",{parentName:"ul"},"bucket - ",(0,i.kt)("inlineCode",{parentName:"li"},"required")," specify the name of the aws s3 bucket"),(0,i.kt)("li",{parentName:"ul"},"accessKeyID - ",(0,i.kt)("inlineCode",{parentName:"li"},"required")," specify the aws account accessKeyID"),(0,i.kt)("li",{parentName:"ul"},"accessKeySecret - ",(0,i.kt)("inlineCode",{parentName:"li"},"required")," specify the aws account accessKeySecret")),(0,i.kt)("h3",{id:"db"},"db"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"db")," storage type stores the ",(0,i.kt)("inlineCode",{parentName:"p"},"state")," into a ",(0,i.kt)("strong",{parentName:"p"},"database"),". "),(0,i.kt)("p",null,"Here is an example: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"# project.yaml\nbackend: \n storageType: db\n config: \n dbHost: 127.0.0.1\n dbName: kusion-db\n dbPort: 3306\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"kusion apply -C dbUser=******* -C dbPassword=*******\n")),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"storageType - db, using database as the storage backend for state"),(0,i.kt)("li",{parentName:"ul"},"dbHost - ",(0,i.kt)("inlineCode",{parentName:"li"},"required")," the access address for the database"),(0,i.kt)("li",{parentName:"ul"},"dbName - ",(0,i.kt)("inlineCode",{parentName:"li"},"required")," the name of the database"),(0,i.kt)("li",{parentName:"ul"},"dbPort - ",(0,i.kt)("inlineCode",{parentName:"li"},"required")," the port of the database"),(0,i.kt)("li",{parentName:"ul"},"dbUser - ",(0,i.kt)("inlineCode",{parentName:"li"},"required")," the user name of the database"),(0,i.kt)("li",{parentName:"ul"},"dbPassword - ",(0,i.kt)("inlineCode",{parentName:"li"},"required")," the password of the database")),(0,i.kt)("p",null,"Note that the table name in the database used by Kusion is ",(0,i.kt)("strong",{parentName:"p"},"state"),". Below is an example SQL statement for creating this table: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sql"},"CREATE TABLE `state` (\n `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'primary key',\n `tenant` varchar(100) DEFAULT NULL COMMENT 'tenant',\n `project` varchar(100) NOT NULL COMMENT 'project',\n `kusion_version` varchar(50) DEFAULT NULL COMMENT 'kusion version',\n `version` int(10) unsigned NOT NULL COMMENT 'current state format version\uff0cmay upgrade in the future',\n `serial` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'modification times for state\uff0ccan be used in concurrent control',\n `operator` varchar(100) DEFAULT NULL COMMENT 'last modifier',\n `resources` longtext DEFAULT NULL COMMENT 'state of the resources\uff0cjson array',\n `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'creation time',\n `modified_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT 'update time',\n `stack` varchar(100) DEFAULT NULL COMMENT 'stack',\n `cluster` varchar(100) DEFAULT NULL COMMENT 'logical isolation in a stack\uff0cusually clustername__cellname',\n PRIMARY KEY (`id`),\n UNIQUE KEY `uk_state_latest` (`tenant`, `project`, `stack`, `serial`, `cluster`),\n KEY `idx_tenant` (`tenant`),\n KEY `idx_project` (`project`),\n KEY `idx_kusion_version` (`kusion_version`),\n KEY `idx_version` (`version`),\n KEY `idx_create_time` (`create_time`),\n KEY `idx_modified_time` (`modified_time`),\n KEY `idx_stack` (`stack`),\n KEY `idx_cluster` (`cluster`)\n);\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2e408e18.7df979fa.js b/assets/js/2e408e18.7df979fa.js new file mode 100644 index 00000000000..d846fab58f7 --- /dev/null +++ b/assets/js/2e408e18.7df979fa.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5681],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),c=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=c(n),m=i,k=u["".concat(s,".").concat(m)]||u[m]||d[m]||r;return n?a.createElement(k,o(o({ref:t},p),{},{components:n})):a.createElement(k,o({ref:t},p))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,o=new Array(r);o[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:i,o[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>d,frontMatter:()=>r,metadata:()=>l,toc:()=>c});var a=n(87462),i=(n(67294),n(3905));const r={},o="Backend Configuration",l={unversionedId:"reference/cli/backend/backend-configuration",id:"version-v0.9/reference/cli/backend/backend-configuration",title:"Backend Configuration",description:"The backend configuration defines the place where Kusion stores its state data file. By default, Kusion uses the local type of backend to store the state on the local disk, while for team collaboration projects, the state can be stored on a remote type of backend, such as database, oss and s3 to allow multiple users access it.",source:"@site/docs_versioned_docs/version-v0.9/reference/cli/backend/backend-configuration.md",sourceDirName:"reference/cli/backend",slug:"/reference/cli/backend/backend-configuration",permalink:"/docs/v0.9/reference/cli/backend/backend-configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/cli/backend/backend-configuration.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion version",permalink:"/docs/v0.9/reference/cli/kusion/kusion_version"},next:{title:"Kusion Model Library",permalink:"/docs/v0.9/reference/model/"}},s={},c=[{value:"Configuring State Backend",id:"configuring-state-backend",level:2},{value:"Command Line Parameters",id:"command-line-parameters",level:3},{value:"Configuration File",id:"configuration-file",level:3},{value:"Configuration Combination",id:"configuration-combination",level:3},{value:"Available Backend",id:"available-backend",level:2},{value:"Default Backend",id:"default-backend",level:3},{value:"local",id:"local",level:3},{value:"oss",id:"oss",level:3},{value:"s3",id:"s3",level:3},{value:"db",id:"db",level:3}],p={toc:c};function d(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"backend-configuration"},"Backend Configuration"),(0,i.kt)("p",null,"The backend configuration defines the place where Kusion stores its ",(0,i.kt)("inlineCode",{parentName:"p"},"state")," data file. By default, Kusion uses the ",(0,i.kt)("inlineCode",{parentName:"p"},"local")," type of backend to store the state on the local disk, while for team collaboration projects, the state can be stored on a ",(0,i.kt)("inlineCode",{parentName:"p"},"remote")," type of backend, such as ",(0,i.kt)("inlineCode",{parentName:"p"},"database"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"oss")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"s3")," to allow multiple users access it. "),(0,i.kt)("h2",{id:"configuring-state-backend"},"Configuring State Backend"),(0,i.kt)("p",null,"Kusion configures the storage of state through command line parameters or the ",(0,i.kt)("inlineCode",{parentName:"p"},"backend")," field in the ",(0,i.kt)("inlineCode",{parentName:"p"},"project.yaml")," file. "),(0,i.kt)("h3",{id:"command-line-parameters"},"Command Line Parameters"),(0,i.kt)("p",null,"Users can specify the type of backend with the option ",(0,i.kt)("inlineCode",{parentName:"p"},"--backend-type"),", and configure the detailed information with ",(0,i.kt)("inlineCode",{parentName:"p"},"--backend-config")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"-C"),", for instance: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"kusion apply --backend-type local --backend-config path=kusion_state.json\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"kusion destroy --backend-type local --backend-config path=kusion_state.json\n")),(0,i.kt)("h3",{id:"configuration-file"},"Configuration File"),(0,i.kt)("p",null,"Users can configure the storage of the state with the ",(0,i.kt)("inlineCode",{parentName:"p"},"backend")," field in the ",(0,i.kt)("inlineCode",{parentName:"p"},"project.yaml")," file: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"# project.yaml\nbackend: \n storageType: local\n config: \n path: kusion_state.json\n")),(0,i.kt)("p",null,"In this case, ",(0,i.kt)("inlineCode",{parentName:"p"},"storageType")," is used to declare the type of storage for the state backend, and ",(0,i.kt)("inlineCode",{parentName:"p"},"config")," is used to declare the required parameters for the corresponding storage type. "),(0,i.kt)("h3",{id:"configuration-combination"},"Configuration Combination"),(0,i.kt)("p",null,"When both of the ",(0,i.kt)("inlineCode",{parentName:"p"},"config")," field in the ",(0,i.kt)("inlineCode",{parentName:"p"},"project.yaml")," and the ",(0,i.kt)("inlineCode",{parentName:"p"},"--backend-config")," option in the command line are configured, Kusion will merge the entire configuration, combining both the ",(0,i.kt)("inlineCode",{parentName:"p"},"project.yaml")," file and the command line options. When there comes a conflict between the options in the ",(0,i.kt)("inlineCode",{parentName:"p"},"project.yaml")," file and the command line, the options in the ",(0,i.kt)("strong",{parentName:"p"},"command line")," will take precedence. This way, users can pass the sensitive information like ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeyID")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeySecret")," to Kusion through command line parameters. "),(0,i.kt)("h2",{id:"available-backend"},"Available Backend"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"local"),(0,i.kt)("li",{parentName:"ul"},"oss"),(0,i.kt)("li",{parentName:"ul"},"s3"),(0,i.kt)("li",{parentName:"ul"},"db")),(0,i.kt)("h3",{id:"default-backend"},"Default Backend"),(0,i.kt)("p",null,"When neither the ",(0,i.kt)("inlineCode",{parentName:"p"},"project.yaml")," file nor the command line parameters declare the backend configuration, Kusion by default uses the ",(0,i.kt)("a",{parentName:"p",href:"#local"},"local"),". "),(0,i.kt)("h3",{id:"local"},"local"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"local")," storage type stores the ",(0,i.kt)("inlineCode",{parentName:"p"},"state")," on the local file system, which is suitable for local operations while not ideal for multi-user collaboration. "),(0,i.kt)("p",null,"Here is an example: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"# project.yaml\nbackend: \n storageType: local\n config: \n path: kusion_state.json\n")),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"storageType - local, using local file system to store the state"),(0,i.kt)("li",{parentName:"ul"},"path - ",(0,i.kt)("inlineCode",{parentName:"li"},"optional")," specify the local file path to store the state")),(0,i.kt)("h3",{id:"oss"},"oss"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"oss")," storage type stores the ",(0,i.kt)("inlineCode",{parentName:"p"},"state")," on the ",(0,i.kt)("strong",{parentName:"p"},"Alicloud Object Storage Service (OSS)"),". "),(0,i.kt)("p",null,"Here is an example: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"# project.yaml\nbackend:\n storageType: oss\n config: \n endpoint: oss-cn-beijing.aliyuncs.com\n bucket: kusion-oss\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"kusion apply -C accessKeyID=******* -C accessKeySecret=*******\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"kusion destroy -C accessKeyID=******* -C accessKeySecret=*******\n")),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"storageType - oss, using alicloud oss as the storage backend for state"),(0,i.kt)("li",{parentName:"ul"},"endpoint - ",(0,i.kt)("inlineCode",{parentName:"li"},"required")," specify the access endpoint for alicloud oss bucket"),(0,i.kt)("li",{parentName:"ul"},"bucket - ",(0,i.kt)("inlineCode",{parentName:"li"},"required")," specify the name of the alicloud oss bucket"),(0,i.kt)("li",{parentName:"ul"},"accessKeyID - ",(0,i.kt)("inlineCode",{parentName:"li"},"required")," specify the alicloud account accessKeyID"),(0,i.kt)("li",{parentName:"ul"},"accessKeySecret - ",(0,i.kt)("inlineCode",{parentName:"li"},"required")," specify the alicloud account accessKeySecret")),(0,i.kt)("h3",{id:"s3"},"s3"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"s3")," storage type stores the ",(0,i.kt)("inlineCode",{parentName:"p"},"state")," on the ",(0,i.kt)("strong",{parentName:"p"},"AWS Simple Storage Service (S3)"),". "),(0,i.kt)("p",null,"Here is an example: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"# project.yaml\nbackend: \n storageType: s3\n config: \n endpoint: s3.us-east-1.amazonaws.com\n bucket: kusion-s3\n region: us-east-1\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"kusion apply -C accessKeyID=******* -C accessKeySecret=*******\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"kusion destroy -C accessKeyID=******* -C accessKeySecret=*******\n")),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"storageType - s3, using aws s3 as the storage backend for state"),(0,i.kt)("li",{parentName:"ul"},"endpoint - ",(0,i.kt)("inlineCode",{parentName:"li"},"required")," specify the access endpoint for aws s3 bucket"),(0,i.kt)("li",{parentName:"ul"},"bucket - ",(0,i.kt)("inlineCode",{parentName:"li"},"required")," specify the name of the aws s3 bucket"),(0,i.kt)("li",{parentName:"ul"},"accessKeyID - ",(0,i.kt)("inlineCode",{parentName:"li"},"required")," specify the aws account accessKeyID"),(0,i.kt)("li",{parentName:"ul"},"accessKeySecret - ",(0,i.kt)("inlineCode",{parentName:"li"},"required")," specify the aws account accessKeySecret")),(0,i.kt)("h3",{id:"db"},"db"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"db")," storage type stores the ",(0,i.kt)("inlineCode",{parentName:"p"},"state")," into a ",(0,i.kt)("strong",{parentName:"p"},"database"),". "),(0,i.kt)("p",null,"Here is an example: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"# project.yaml\nbackend: \n storageType: db\n config: \n dbHost: 127.0.0.1\n dbName: kusion-db\n dbPort: 3306\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"kusion apply -C dbUser=******* -C dbPassword=*******\n")),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"storageType - db, using database as the storage backend for state"),(0,i.kt)("li",{parentName:"ul"},"dbHost - ",(0,i.kt)("inlineCode",{parentName:"li"},"required")," the access address for the database"),(0,i.kt)("li",{parentName:"ul"},"dbName - ",(0,i.kt)("inlineCode",{parentName:"li"},"required")," the name of the database"),(0,i.kt)("li",{parentName:"ul"},"dbPort - ",(0,i.kt)("inlineCode",{parentName:"li"},"required")," the port of the database"),(0,i.kt)("li",{parentName:"ul"},"dbUser - ",(0,i.kt)("inlineCode",{parentName:"li"},"required")," the user name of the database"),(0,i.kt)("li",{parentName:"ul"},"dbPassword - ",(0,i.kt)("inlineCode",{parentName:"li"},"required")," the password of the database")),(0,i.kt)("p",null,"Note that the table name in the database used by Kusion is ",(0,i.kt)("strong",{parentName:"p"},"state"),". Below is an example SQL statement for creating this table: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sql"},"CREATE TABLE `state` (\n `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'primary key',\n `tenant` varchar(100) DEFAULT NULL COMMENT 'tenant',\n `project` varchar(100) NOT NULL COMMENT 'project',\n `kusion_version` varchar(50) DEFAULT NULL COMMENT 'kusion version',\n `version` int(10) unsigned NOT NULL COMMENT 'current state format version\uff0cmay upgrade in the future',\n `serial` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'modification times for state\uff0ccan be used in concurrent control',\n `operator` varchar(100) DEFAULT NULL COMMENT 'last modifier',\n `resources` longtext DEFAULT NULL COMMENT 'state of the resources\uff0cjson array',\n `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'creation time',\n `modified_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT 'update time',\n `stack` varchar(100) DEFAULT NULL COMMENT 'stack',\n `cluster` varchar(100) DEFAULT NULL COMMENT 'logical isolation in a stack\uff0cusually clustername__cellname',\n PRIMARY KEY (`id`),\n UNIQUE KEY `uk_state_latest` (`tenant`, `project`, `stack`, `serial`, `cluster`),\n KEY `idx_tenant` (`tenant`),\n KEY `idx_project` (`project`),\n KEY `idx_kusion_version` (`kusion_version`),\n KEY `idx_version` (`version`),\n KEY `idx_create_time` (`create_time`),\n KEY `idx_modified_time` (`modified_time`),\n KEY `idx_stack` (`stack`),\n KEY `idx_cluster` (`cluster`)\n);\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2e7a9059.9e60dfcd.js b/assets/js/2e7a9059.17e42187.js similarity index 50% rename from assets/js/2e7a9059.9e60dfcd.js rename to assets/js/2e7a9059.17e42187.js index febb54e8390..059f15692a0 100644 --- a/assets/js/2e7a9059.9e60dfcd.js +++ b/assets/js/2e7a9059.17e42187.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[271],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=l(n),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||a;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={},i="kusion stack",s={unversionedId:"reference/commands/kusion-stack",id:"version-v0.11/reference/commands/kusion-stack",title:"kusion stack",description:"Stack is a folder that contains a stack.yaml file within the corresponding project directory",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-stack.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-stack",permalink:"/docs/reference/commands/kusion-stack",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-stack.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion stack create",permalink:"/docs/reference/commands/kusion-stack-create"},next:{title:"kusion version",permalink:"/docs/reference/commands/kusion-version"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-stack"},"kusion stack"),(0,o.kt)("p",null,"Stack is a folder that contains a stack.yaml file within the corresponding project directory"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Stack in Kusion is defined as any folder that contains a stack.yaml file within the corresponding project directory."),(0,o.kt)("p",null," A stack provides a mechanism to isolate multiple deployments of the same application, serving with the target workspace to which an application will be deployed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion stack [flags]\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for stack\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-stack-create"},"kusion stack create"),"\t - Create a new stack")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[271],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=l(n),f=o,m=d["".concat(c,".").concat(f)]||d[f]||u[f]||a;return n?r.createElement(m,i(i({ref:t},p),{},{components:n})):r.createElement(m,i({ref:t},p))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={},i="kusion stack",s={unversionedId:"reference/commands/kusion-stack",id:"version-v0.11/reference/commands/kusion-stack",title:"kusion stack",description:"Stack is a folder that contains a stack.yaml file within the corresponding project directory",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-stack.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-stack",permalink:"/docs/reference/commands/kusion-stack",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-stack.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion stack create",permalink:"/docs/reference/commands/kusion-stack-create"},next:{title:"kusion version",permalink:"/docs/reference/commands/kusion-version"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-stack"},"kusion stack"),(0,o.kt)("p",null,"Stack is a folder that contains a stack.yaml file within the corresponding project directory"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Stack in Kusion is defined as any folder that contains a stack.yaml file within the corresponding project directory."),(0,o.kt)("p",null," A stack provides a mechanism to isolate multiple deployments of the same application, serving with the target workspace to which an application will be deployed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion stack [flags]\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for stack\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-stack-create"},"kusion stack create"),"\t - Create a new stack")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2ed6f3e5.1963be6d.js b/assets/js/2ed6f3e5.7ce7fa5d.js similarity index 51% rename from assets/js/2ed6f3e5.1963be6d.js rename to assets/js/2ed6f3e5.7ce7fa5d.js index 760a9cf38a7..7f343f6a120 100644 --- a/assets/js/2ed6f3e5.1963be6d.js +++ b/assets/js/2ed6f3e5.7ce7fa5d.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3350],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),l=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),m=l(n),d=o,f=m["".concat(s,".").concat(d)]||m[d]||u[d]||a;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=m;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:o,i[1]=c;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={},i="kusion compile",c={unversionedId:"reference/commands/kusion-compile",id:"version-v0.10/reference/commands/kusion-compile",title:"kusion compile",description:"Deprecated: Use 'kusion build' to generate the Intent instead",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-compile.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-compile",permalink:"/docs/v0.10/reference/commands/kusion-compile",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-compile.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion build",permalink:"/docs/v0.10/reference/commands/kusion-build"},next:{title:"kusion destroy",permalink:"/docs/v0.10/reference/commands/kusion-destroy"}},s={},l=[{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-compile"},"kusion compile"),(0,o.kt)("p",null,"Deprecated: Use 'kusion build' to generate the Intent instead"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion compile [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," Deprecated\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for compile\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of KusionStack")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3350],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),l=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),d=l(n),m=o,f=d["".concat(s,".").concat(m)]||d[m]||u[m]||a;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=d;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:o,i[1]=c;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={},i="kusion compile",c={unversionedId:"reference/commands/kusion-compile",id:"version-v0.10/reference/commands/kusion-compile",title:"kusion compile",description:"Deprecated: Use 'kusion build' to generate the Intent instead",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-compile.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-compile",permalink:"/docs/v0.10/reference/commands/kusion-compile",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-compile.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion build",permalink:"/docs/v0.10/reference/commands/kusion-build"},next:{title:"kusion destroy",permalink:"/docs/v0.10/reference/commands/kusion-destroy"}},s={},l=[{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-compile"},"kusion compile"),(0,o.kt)("p",null,"Deprecated: Use 'kusion build' to generate the Intent instead"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion compile [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," Deprecated\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for compile\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of KusionStack")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2fec9cb7.379ca2a4.js b/assets/js/2fec9cb7.379ca2a4.js deleted file mode 100644 index c7a04970719..00000000000 --- a/assets/js/2fec9cb7.379ca2a4.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6138],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>k});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=a.createContext({}),c=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},p=function(e){var t=c(e.components);return a.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=c(n),k=i,m=u["".concat(l,".").concat(k)]||u[k]||d[k]||o;return n?a.createElement(m,r(r({ref:t},p),{},{components:n})):a.createElement(m,r({ref:t},p))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,r=new Array(o);r[0]=u;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,r[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>c});var a=n(87462),i=(n(67294),n(3905));const o={id:"deliver-quickstart"},r="Run Your First App on Kubernetes with Kusion",s={unversionedId:"getting-started/deliver-quickstart",id:"version-v0.11/getting-started/deliver-quickstart",title:"Run Your First App on Kubernetes with Kusion",description:"In this tutorial, we will walk through how to deploy a quickstart application on Kubernetes with Kusion. The demo application can interact with a locally deployed MySQL database, which is declared as an accessory in the config codes and will be automatically created and managed by Kusion.",source:"@site/docs_versioned_docs/version-v0.11/2-getting-started/2-deliver-quickstart.md",sourceDirName:"2-getting-started",slug:"/getting-started/deliver-quickstart",permalink:"/docs/getting-started/deliver-quickstart",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/2-getting-started/2-deliver-quickstart.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"deliver-quickstart"},sidebar:"kusion",previous:{title:"Install Kusion",permalink:"/docs/getting-started/install-kusion"},next:{title:"Overview",permalink:"/docs/concepts/project/overview"}},l={},c=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Initialize Project",id:"initialize-project",level:2},{value:"Review Configuration Files",id:"review-configuration-files",level:3},{value:"Application Delivery",id:"application-delivery",level:2},{value:"Add MySQL Accessory",id:"add-mysql-accessory",level:2},{value:"Delete Application",id:"delete-application",level:2}],p={toc:c};function d(e){let{components:t,...o}=e;return(0,i.kt)("wrapper",(0,a.Z)({},p,o,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"run-your-first-app-on-kubernetes-with-kusion"},"Run Your First App on Kubernetes with Kusion"),(0,i.kt)("p",null,"In this tutorial, we will walk through how to deploy a quickstart application on Kubernetes with Kusion. The demo application can interact with a locally deployed MySQL database, which is declared as an accessory in the config codes and will be automatically created and managed by Kusion. "),(0,i.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,i.kt)("p",null,"Before we start to play with this example, we need to have the Kusion CLI installed and run an accessible Kubernetes cluster. Here are some helpful documents: "),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Install ",(0,i.kt)("a",{parentName:"li",href:"/docs/getting-started/install-kusion"},"Kusion CLI"),". "),(0,i.kt)("li",{parentName:"ul"},"Run a ",(0,i.kt)("a",{parentName:"li",href:"https://kubernetes.io"},"Kubernetes")," cluster. Some light and convenient options for Kubernetes local deployment include ",(0,i.kt)("a",{parentName:"li",href:"https://docs.k3s.io/quick-start"},"k3s"),", ",(0,i.kt)("a",{parentName:"li",href:"https://k3d.io/v5.4.4/#installation"},"k3d"),", and ",(0,i.kt)("a",{parentName:"li",href:"https://minikube.sigs.k8s.io/docs/tutorials/multi_node"},"MiniKube"),". ")),(0,i.kt)("h2",{id:"initialize-project"},"Initialize Project"),(0,i.kt)("p",null,"We can start by initializing this tutorial project with ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," cmd. "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"# Create a new directory and navigate into it. \nmkdir quickstart && cd quickstart\n\n# Initialize the demo project with the name of the current directory. \nkusion init\n")),(0,i.kt)("p",null,"The created project structure looks like below: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"tree\n.\n\u251c\u2500\u2500 default\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n\n2 directories, 4 files\n")),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"More details about the project and stack structure can be found in ",(0,i.kt)("a",{parentName:"p",href:"/docs/concepts/project/overview"},"Project")," and ",(0,i.kt)("a",{parentName:"p",href:"/docs/concepts/stack/overview"},"Stack"),". ")),(0,i.kt)("h3",{id:"review-configuration-files"},"Review Configuration Files"),(0,i.kt)("p",null,"Now let's have a glance at the configuration codes of ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," stack: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"cat default/main.k\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\n\n# main.k declares the customized configuration codes for default stack.\nquickstart: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n quickstart: c.Container {\n image: "kusionstack/kusion-quickstart:latest"\n }\n }\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 8080\n }\n ]\n }\n }\n}\n')),(0,i.kt)("p",null,"The configuration file ",(0,i.kt)("inlineCode",{parentName:"p"},"main.k"),", usually written by the ",(0,i.kt)("strong",{parentName:"p"},"App Developers"),", declares the customized configuration codes for ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," stack, including an ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance with the name of ",(0,i.kt)("inlineCode",{parentName:"p"},"quickstart"),". The ",(0,i.kt)("inlineCode",{parentName:"p"},"quickstart")," application consists of a ",(0,i.kt)("inlineCode",{parentName:"p"},"Workload")," with the type of ",(0,i.kt)("inlineCode",{parentName:"p"},"kam.v1.workload.Service"),", which runs a container named ",(0,i.kt)("inlineCode",{parentName:"p"},"quickstart")," using the image of ",(0,i.kt)("inlineCode",{parentName:"p"},"kusionstack/kusion-quickstart:latest"),". "),(0,i.kt)("p",null,"Besides, it declares a ",(0,i.kt)("strong",{parentName:"p"},"Kusion Module")," with the type of ",(0,i.kt)("inlineCode",{parentName:"p"},"network.Network"),", exposing ",(0,i.kt)("inlineCode",{parentName:"p"},"8080")," port to be accessed for the long-running service. "),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model can hide the major complexity of Kubernetes resources such as ",(0,i.kt)("inlineCode",{parentName:"p"},"Namespace"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Deployment"),", and ",(0,i.kt)("inlineCode",{parentName:"p"},"Service")," which will be created and managed by Kusion, providing the concepts that are ",(0,i.kt)("strong",{parentName:"p"},"application-centric")," and ",(0,i.kt)("strong",{parentName:"p"},"infrastructure-agnostic")," for a more developer-friendly experience. "),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"More details about the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model and built-in Kusion Module can be found in ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kam"},"kam")," and ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"catalog"),". ")),(0,i.kt)("p",null,"The declaration of the dependency packages can be found in ",(0,i.kt)("inlineCode",{parentName:"p"},"default/kcl.mod"),": "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"cat default/kcl.mod\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},'[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\n')),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"More details about the application model and module dependency declaration can be found in ",(0,i.kt)("a",{parentName:"p",href:"/docs/concepts/kusion-module/app-dev-guide"},"Kusion Module guide for app dev"),". ")),(0,i.kt)("h2",{id:"application-delivery"},"Application Delivery"),(0,i.kt)("p",null,"Use the following command to deliver the quickstart application in ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," stack on your accessible Kubernetes cluster, while watching the resource creation and automatically port-forwarding the specified port (8080) from local to the Kubernetes Service of the application. We can check the details of the resource preview results before we confirm to apply the diffs. "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"cd default && kusion apply --watch --port-forward 8080\n")),(0,i.kt)("p",null,(0,i.kt)("img",{src:n(41542).Z,width:"1886",height:"1296"})),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"During the first apply, the models and modules that the application depends on will be downloaded, so it may take some time (usually within one minute). You can take a break and have a cup of coffee. ")),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"Kusion by default will create the Kubernetes resources of the application in the namespace the same as the project name. If you want to customize the namespace, please refer to ",(0,i.kt)("strong",{parentName:"p"},"[T.B.D]"),". ")),(0,i.kt)("p",null,"Now we can visit ",(0,i.kt)("a",{parentName:"p",href:"http://localhost:8080"},"http://localhost:8080")," in our browser and play with the demo application! "),(0,i.kt)("p",null,(0,i.kt)("img",{src:n(58104).Z,width:"2872",height:"1318"})),(0,i.kt)("h2",{id:"add-mysql-accessory"},"Add MySQL Accessory"),(0,i.kt)("p",null,"As you can see, the demo application page indicates that the MySQL database is not ready yet. Hence, we will now add a MySQL database as an accessory for the workload. "),(0,i.kt)("p",null,"We can add the Kusion-provided built-in dependency in the ",(0,i.kt)("inlineCode",{parentName:"p"},"default/kcl.mod"),", so that we can use the ",(0,i.kt)("inlineCode",{parentName:"p"},"MySQL")," module in the configuration codes. "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},'[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\nmysql = { oci = "oci://ghcr.io/kusionstack/mysql", tag = "0.1.0" }\n')),(0,i.kt)("p",null,"We can update the ",(0,i.kt)("inlineCode",{parentName:"p"},"default/main.k")," with the following configuration codes: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-python"},'# The configuration codes in the perspective of developers. \nimport kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\nimport mysql\n\nquickstart: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n quickstart: c.Container {\n image: "kusionstack/kusion-quickstart:latest"\n env: {\n "DB_HOST": "$(KUSION_DB_HOST_QUICKSTART_DEFAULT_QUICKSTART_MYSQL)"\n "DB_USERNAME": "$(KUSION_DB_USERNAME_QUICKSTART_DEFAULT_QUICKSTART_MYSQL)"\n "DB_PASSWORD": "$(KUSION_DB_PASSWORD_QUICKSTART_DEFAULT_QUICKSTART_MYSQL)"\n }\n }\n }\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 8080\n }\n ]\n }\n "mysql": mysql.MySQL {\n type: "local"\n version: "8.0"\n }\n }\n}\n')),(0,i.kt)("p",null,"The configuration codes above declare a local ",(0,i.kt)("inlineCode",{parentName:"p"},"mysql.MySQL")," with the engine version of ",(0,i.kt)("inlineCode",{parentName:"p"},"8.0")," as an accessory for the application workload. The necessary Kubernetes resources for deploying and using the local MySQL database will be generated and users can get the ",(0,i.kt)("inlineCode",{parentName:"p"},"host"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"username")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"password")," of the database through the ",(0,i.kt)("a",{parentName:"p",href:"/docs/reference/modules/developer-schemas/database/mysql#credentials-and-connectivity"},"MySQL Credentials And Connectivity")," of Kusion in application containers. "),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"For more information about the naming convention of Kusion built-in MySQL module, you can refer to ",(0,i.kt)("a",{parentName:"p",href:"/docs/reference/modules/naming-conventions"},"Module Naming Convention"),". ")),(0,i.kt)("p",null,"After that, we can re-apply the application: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"kusion apply --watch --port-forward 8080\n")),(0,i.kt)("p",null,(0,i.kt)("img",{src:n(97361).Z,width:"1886",height:"1296"})),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"You may wait another minute to download the MySQL Module. ")),(0,i.kt)("p",null,"Let's visit ",(0,i.kt)("a",{parentName:"p",href:"http://localhost:8080"},"http://localhost:8080")," in our browser, and we can find that the application has successfully connected to the MySQL database. The connection information is also printed on the page. "),(0,i.kt)("p",null,(0,i.kt)("img",{src:n(48968).Z,width:"2876",height:"1556"})),(0,i.kt)("p",null,"Now please feel free to enjoy the demo application!"),(0,i.kt)("p",null,(0,i.kt)("img",{src:n(73398).Z,width:"2874",height:"1566"})),(0,i.kt)("h2",{id:"delete-application"},"Delete Application"),(0,i.kt)("p",null,"We can delete the quickstart demo workload and related accessory resources with the following cmd: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"kusion destroy --yes\n")),(0,i.kt)("p",null,(0,i.kt)("img",{src:n(61788).Z,width:"1886",height:"1298"})))}d.isMDXComponent=!0},41542:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/kusion_apply_quickstart-cb45ebe5dd7e2839261fb19b7715d5cd.gif"},61788:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/kusion_destroy_quickstart-50eb4898c1c96fc4d3914c32cec371ad.gif"},97361:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/kusion_re_apply_quickstart-5e95c1b3ed6f6d69444d4c720c31790d.gif"},73398:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/quickstart_mysql_validation-d34684107fe5c9914b783c19d949f460.gif"},58104:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/quickstart_page-6487ce3284b33db5234a96241ef72bf7.png"},48968:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/quickstart_page_with_mysql-1900976723fa14db1d29797d882d1382.png"}}]); \ No newline at end of file diff --git a/assets/js/2fec9cb7.4bc97e56.js b/assets/js/2fec9cb7.4bc97e56.js new file mode 100644 index 00000000000..0f541c60cae --- /dev/null +++ b/assets/js/2fec9cb7.4bc97e56.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6138],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>k});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=a.createContext({}),c=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},p=function(e){var t=c(e.components);return a.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=c(n),k=i,m=u["".concat(l,".").concat(k)]||u[k]||d[k]||o;return n?a.createElement(m,r(r({ref:t},p),{},{components:n})):a.createElement(m,r({ref:t},p))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,r=new Array(o);r[0]=u;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,r[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>c});var a=n(87462),i=(n(67294),n(3905));const o={id:"deliver-quickstart"},r="Run Your First App on Kubernetes with Kusion",s={unversionedId:"getting-started/deliver-quickstart",id:"version-v0.11/getting-started/deliver-quickstart",title:"Run Your First App on Kubernetes with Kusion",description:"In this tutorial, we will walk through how to deploy a quickstart application on Kubernetes with Kusion. The demo application can interact with a locally deployed MySQL database, which is declared as an accessory in the config codes and will be automatically created and managed by Kusion.",source:"@site/docs_versioned_docs/version-v0.11/2-getting-started/2-deliver-quickstart.md",sourceDirName:"2-getting-started",slug:"/getting-started/deliver-quickstart",permalink:"/docs/getting-started/deliver-quickstart",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/2-getting-started/2-deliver-quickstart.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"deliver-quickstart"},sidebar:"kusion",previous:{title:"Install Kusion",permalink:"/docs/getting-started/install-kusion"},next:{title:"Overview",permalink:"/docs/concepts/project/overview"}},l={},c=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Initialize Project",id:"initialize-project",level:2},{value:"Review Configuration Files",id:"review-configuration-files",level:3},{value:"Application Delivery",id:"application-delivery",level:2},{value:"Add MySQL Accessory",id:"add-mysql-accessory",level:2},{value:"Delete Application",id:"delete-application",level:2}],p={toc:c};function d(e){let{components:t,...o}=e;return(0,i.kt)("wrapper",(0,a.Z)({},p,o,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"run-your-first-app-on-kubernetes-with-kusion"},"Run Your First App on Kubernetes with Kusion"),(0,i.kt)("p",null,"In this tutorial, we will walk through how to deploy a quickstart application on Kubernetes with Kusion. The demo application can interact with a locally deployed MySQL database, which is declared as an accessory in the config codes and will be automatically created and managed by Kusion. "),(0,i.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,i.kt)("p",null,"Before we start to play with this example, we need to have the Kusion CLI installed and run an accessible Kubernetes cluster. Here are some helpful documents: "),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Install ",(0,i.kt)("a",{parentName:"li",href:"/docs/getting-started/install-kusion"},"Kusion CLI"),". "),(0,i.kt)("li",{parentName:"ul"},"Run a ",(0,i.kt)("a",{parentName:"li",href:"https://kubernetes.io"},"Kubernetes")," cluster. Some light and convenient options for Kubernetes local deployment include ",(0,i.kt)("a",{parentName:"li",href:"https://docs.k3s.io/quick-start"},"k3s"),", ",(0,i.kt)("a",{parentName:"li",href:"https://k3d.io/v5.4.4/#installation"},"k3d"),", and ",(0,i.kt)("a",{parentName:"li",href:"https://minikube.sigs.k8s.io/docs/tutorials/multi_node"},"MiniKube"),". ")),(0,i.kt)("h2",{id:"initialize-project"},"Initialize Project"),(0,i.kt)("p",null,"We can start by initializing this tutorial project with ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," cmd. "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"# Create a new directory and navigate into it. \nmkdir quickstart && cd quickstart\n\n# Initialize the demo project with the name of the current directory. \nkusion init\n")),(0,i.kt)("p",null,"The created project structure looks like below: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"tree\n.\n\u251c\u2500\u2500 default\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n\n2 directories, 4 files\n")),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"More details about the project and stack structure can be found in ",(0,i.kt)("a",{parentName:"p",href:"/docs/concepts/project/overview"},"Project")," and ",(0,i.kt)("a",{parentName:"p",href:"/docs/concepts/stack/overview"},"Stack"),". ")),(0,i.kt)("h3",{id:"review-configuration-files"},"Review Configuration Files"),(0,i.kt)("p",null,"Now let's have a glance at the configuration codes of ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," stack: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"cat default/main.k\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\n\n# main.k declares the customized configuration codes for default stack.\nquickstart: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n quickstart: c.Container {\n image: "kusionstack/kusion-quickstart:latest"\n }\n }\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 8080\n }\n ]\n }\n }\n}\n')),(0,i.kt)("p",null,"The configuration file ",(0,i.kt)("inlineCode",{parentName:"p"},"main.k"),", usually written by the ",(0,i.kt)("strong",{parentName:"p"},"App Developers"),", declares the customized configuration codes for ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," stack, including an ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance with the name of ",(0,i.kt)("inlineCode",{parentName:"p"},"quickstart"),". The ",(0,i.kt)("inlineCode",{parentName:"p"},"quickstart")," application consists of a ",(0,i.kt)("inlineCode",{parentName:"p"},"Workload")," with the type of ",(0,i.kt)("inlineCode",{parentName:"p"},"kam.v1.workload.Service"),", which runs a container named ",(0,i.kt)("inlineCode",{parentName:"p"},"quickstart")," using the image of ",(0,i.kt)("inlineCode",{parentName:"p"},"kusionstack/kusion-quickstart:latest"),". "),(0,i.kt)("p",null,"Besides, it declares a ",(0,i.kt)("strong",{parentName:"p"},"Kusion Module")," with the type of ",(0,i.kt)("inlineCode",{parentName:"p"},"network.Network"),", exposing ",(0,i.kt)("inlineCode",{parentName:"p"},"8080")," port to be accessed for the long-running service. "),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model can hide the major complexity of Kubernetes resources such as ",(0,i.kt)("inlineCode",{parentName:"p"},"Namespace"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Deployment"),", and ",(0,i.kt)("inlineCode",{parentName:"p"},"Service")," which will be created and managed by Kusion, providing the concepts that are ",(0,i.kt)("strong",{parentName:"p"},"application-centric")," and ",(0,i.kt)("strong",{parentName:"p"},"infrastructure-agnostic")," for a more developer-friendly experience. "),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"More details about the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model and built-in Kusion Module can be found in ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kam"},"kam")," and ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"catalog"),". ")),(0,i.kt)("p",null,"The declaration of the dependency packages can be found in ",(0,i.kt)("inlineCode",{parentName:"p"},"default/kcl.mod"),": "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"cat default/kcl.mod\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},'[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\n')),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"More details about the application model and module dependency declaration can be found in ",(0,i.kt)("a",{parentName:"p",href:"/docs/concepts/kusion-module/app-dev-guide"},"Kusion Module guide for app dev"),". ")),(0,i.kt)("h2",{id:"application-delivery"},"Application Delivery"),(0,i.kt)("p",null,"Use the following command to deliver the quickstart application in ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," stack on your accessible Kubernetes cluster, while watching the resource creation and automatically port-forwarding the specified port (8080) from local to the Kubernetes Service of the application. We can check the details of the resource preview results before we confirm to apply the diffs. "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"cd default && kusion apply --watch --port-forward 8080\n")),(0,i.kt)("p",null,(0,i.kt)("img",{src:n(41542).Z,width:"1886",height:"1296"})),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"During the first apply, the models and modules that the application depends on will be downloaded, so it may take some time (usually within one minute). You can take a break and have a cup of coffee. ")),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"Kusion by default will create the Kubernetes resources of the application in the namespace the same as the project name. If you want to customize the namespace, please refer to ",(0,i.kt)("strong",{parentName:"p"},"[T.B.D]"),". ")),(0,i.kt)("p",null,"Now we can visit ",(0,i.kt)("a",{parentName:"p",href:"http://localhost:8080"},"http://localhost:8080")," in our browser and play with the demo application! "),(0,i.kt)("p",null,(0,i.kt)("img",{src:n(58104).Z,width:"2872",height:"1318"})),(0,i.kt)("h2",{id:"add-mysql-accessory"},"Add MySQL Accessory"),(0,i.kt)("p",null,"As you can see, the demo application page indicates that the MySQL database is not ready yet. Hence, we will now add a MySQL database as an accessory for the workload. "),(0,i.kt)("p",null,"We can add the Kusion-provided built-in dependency in the ",(0,i.kt)("inlineCode",{parentName:"p"},"default/kcl.mod"),", so that we can use the ",(0,i.kt)("inlineCode",{parentName:"p"},"MySQL")," module in the configuration codes. "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},'[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\nmysql = { oci = "oci://ghcr.io/kusionstack/mysql", tag = "0.1.0" }\n')),(0,i.kt)("p",null,"We can update the ",(0,i.kt)("inlineCode",{parentName:"p"},"default/main.k")," with the following configuration codes: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-python"},'# The configuration codes in the perspective of developers. \nimport kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\nimport mysql\n\nquickstart: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n quickstart: c.Container {\n image: "kusionstack/kusion-quickstart:latest"\n env: {\n "DB_HOST": "$(KUSION_DB_HOST_QUICKSTART_DEFAULT_QUICKSTART_MYSQL)"\n "DB_USERNAME": "$(KUSION_DB_USERNAME_QUICKSTART_DEFAULT_QUICKSTART_MYSQL)"\n "DB_PASSWORD": "$(KUSION_DB_PASSWORD_QUICKSTART_DEFAULT_QUICKSTART_MYSQL)"\n }\n }\n }\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 8080\n }\n ]\n }\n "mysql": mysql.MySQL {\n type: "local"\n version: "8.0"\n }\n }\n}\n')),(0,i.kt)("p",null,"The configuration codes above declare a local ",(0,i.kt)("inlineCode",{parentName:"p"},"mysql.MySQL")," with the engine version of ",(0,i.kt)("inlineCode",{parentName:"p"},"8.0")," as an accessory for the application workload. The necessary Kubernetes resources for deploying and using the local MySQL database will be generated and users can get the ",(0,i.kt)("inlineCode",{parentName:"p"},"host"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"username")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"password")," of the database through the ",(0,i.kt)("a",{parentName:"p",href:"/docs/reference/modules/developer-schemas/database/mysql#credentials-and-connectivity"},"MySQL Credentials And Connectivity")," of Kusion in application containers. "),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"For more information about the naming convention of Kusion built-in MySQL module, you can refer to ",(0,i.kt)("a",{parentName:"p",href:"/docs/reference/modules/naming-conventions"},"Module Naming Convention"),". ")),(0,i.kt)("p",null,"After that, we can re-apply the application: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"kusion apply --watch --port-forward 8080\n")),(0,i.kt)("p",null,(0,i.kt)("img",{src:n(97361).Z,width:"1886",height:"1296"})),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"You may wait another minute to download the MySQL Module. ")),(0,i.kt)("p",null,"Let's visit ",(0,i.kt)("a",{parentName:"p",href:"http://localhost:8080"},"http://localhost:8080")," in our browser, and we can find that the application has successfully connected to the MySQL database. The connection information is also printed on the page. "),(0,i.kt)("p",null,(0,i.kt)("img",{src:n(48968).Z,width:"2876",height:"1556"})),(0,i.kt)("p",null,"Now please feel free to enjoy the demo application!"),(0,i.kt)("p",null,(0,i.kt)("img",{src:n(73398).Z,width:"2874",height:"1566"})),(0,i.kt)("h2",{id:"delete-application"},"Delete Application"),(0,i.kt)("p",null,"We can delete the quickstart demo workload and related accessory resources with the following cmd: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"kusion destroy --yes\n")),(0,i.kt)("p",null,(0,i.kt)("img",{src:n(61788).Z,width:"1886",height:"1298"})))}d.isMDXComponent=!0},41542:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/kusion_apply_quickstart-cb45ebe5dd7e2839261fb19b7715d5cd.gif"},61788:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/kusion_destroy_quickstart-50eb4898c1c96fc4d3914c32cec371ad.gif"},97361:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/kusion_re_apply_quickstart-5e95c1b3ed6f6d69444d4c720c31790d.gif"},73398:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/quickstart_mysql_validation-d34684107fe5c9914b783c19d949f460.gif"},58104:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/quickstart_page-6487ce3284b33db5234a96241ef72bf7.png"},48968:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/quickstart_page_with_mysql-1900976723fa14db1d29797d882d1382.png"}}]); \ No newline at end of file diff --git a/assets/js/30ab2121.afe82661.js b/assets/js/30ab2121.5e0396c2.js similarity index 62% rename from assets/js/30ab2121.afe82661.js rename to assets/js/30ab2121.5e0396c2.js index 59bcd410372..f4c9eff318f 100644 --- a/assets/js/30ab2121.afe82661.js +++ b/assets/js/30ab2121.5e0396c2.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9376],{3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=p(r),m=o,f=d["".concat(i,".").concat(m)]||d[m]||c[m]||a;return r?n.createElement(f,l(l({ref:t},u),{},{components:r})):n.createElement(f,l({ref:t},u))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,l=new Array(a);l[0]=d;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:o,l[1]=s;for(var p=2;p{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>c,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},l="opsrule",s={unversionedId:"reference/modules/workspace-configs/opsrule/opsrule",id:"version-v0.11/reference/modules/workspace-configs/opsrule/opsrule",title:"opsrule",description:"opsrule can be used to define workspace-level operational rule configurations.",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/opsrule/opsrule.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/opsrule",slug:"/reference/modules/workspace-configs/opsrule/",permalink:"/docs/reference/modules/workspace-configs/opsrule/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/opsrule/opsrule.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"network",permalink:"/docs/reference/modules/workspace-configs/networking/network"},next:{title:"job",permalink:"/docs/reference/modules/workspace-configs/workload/job"}},i={},p=[{value:"Attributes",id:"attributes",level:2},{value:"Examples",id:"examples",level:3}],u={toc:p};function c(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"opsrule"},"opsrule"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"opsrule")," can be used to define workspace-level operational rule configurations."),(0,o.kt)("h2",{id:"attributes"},"Attributes"),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,o.kt)("th",{parentName:"tr",align:null},"Type"),(0,o.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,o.kt)("th",{parentName:"tr",align:null},"Required"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"maxUnavailable"),(0,o.kt)("br",null),"The maximum percentage of the total pod instances in the component that can be",(0,o.kt)("br",null),"simultaneously unhealthy."),(0,o.kt)("td",{parentName:"tr",align:null},"int ","|"," str"),(0,o.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")))),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n kusionstack/opsrule@0.1.0:\n default:\n maxUnavailable: "40%"\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9376],{3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=p(r),m=o,f=d["".concat(i,".").concat(m)]||d[m]||c[m]||a;return r?n.createElement(f,l(l({ref:t},u),{},{components:r})):n.createElement(f,l({ref:t},u))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,l=new Array(a);l[0]=d;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:o,l[1]=s;for(var p=2;p{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>c,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},l="opsrule",s={unversionedId:"reference/modules/workspace-configs/opsrule/opsrule",id:"version-v0.11/reference/modules/workspace-configs/opsrule/opsrule",title:"opsrule",description:"opsrule can be used to define workspace-level operational rule configurations.",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/opsrule/opsrule.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/opsrule",slug:"/reference/modules/workspace-configs/opsrule/",permalink:"/docs/reference/modules/workspace-configs/opsrule/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/opsrule/opsrule.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"network",permalink:"/docs/reference/modules/workspace-configs/networking/network"},next:{title:"job",permalink:"/docs/reference/modules/workspace-configs/workload/job"}},i={},p=[{value:"Attributes",id:"attributes",level:2},{value:"Examples",id:"examples",level:3}],u={toc:p};function c(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"opsrule"},"opsrule"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"opsrule")," can be used to define workspace-level operational rule configurations."),(0,o.kt)("h2",{id:"attributes"},"Attributes"),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,o.kt)("th",{parentName:"tr",align:null},"Type"),(0,o.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,o.kt)("th",{parentName:"tr",align:null},"Required"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"maxUnavailable"),(0,o.kt)("br",null),"The maximum percentage of the total pod instances in the component that can be",(0,o.kt)("br",null),"simultaneously unhealthy."),(0,o.kt)("td",{parentName:"tr",align:null},"int ","|"," str"),(0,o.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")))),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n kusionstack/opsrule@0.1.0:\n default:\n maxUnavailable: "40%"\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/312696f8.1f62176d.js b/assets/js/312696f8.1f62176d.js deleted file mode 100644 index db01fff2c1c..00000000000 --- a/assets/js/312696f8.1f62176d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3546],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),d=p(r),m=a,f=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return r?n.createElement(f,l(l({ref:t},c),{},{components:r})):n.createElement(f,l({ref:t},c))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var n=r(87462),a=(r(67294),r(3905));const o={},l="port",i={unversionedId:"reference/modules/workspace-configs/networking/port",id:"version-v0.10/reference/modules/workspace-configs/networking/port",title:"port",description:"port can be used to define workspace-level networking configurations.",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/networking/port.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/networking",slug:"/reference/modules/workspace-configs/networking/port",permalink:"/docs/v0.10/reference/modules/workspace-configs/networking/port",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/networking/port.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"monitoring",permalink:"/docs/v0.10/reference/modules/workspace-configs/monitoring/prometheus"},next:{title:"opsrule",permalink:"/docs/v0.10/reference/modules/workspace-configs/trait/opsrule"}},s={},p=[{value:"Attributes",id:"attributes",level:2},{value:"Examples",id:"examples",level:3}],c={toc:p};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"port"},"port"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"port")," can be used to define workspace-level networking configurations."),(0,a.kt)("h2",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"type"),(0,a.kt)("br",null),"The specific cloud vendor that provides load balancer."),(0,a.kt)("td",{parentName:"tr",align:null},'"alicloud" ',"|",' "aws"'),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels"),(0,a.kt)("br",null),"The attached labels of the port."),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations"),(0,a.kt)("br",null),"The attached annotations of the port."),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n port:\n default:\n type: alicloud\n labels:\n kusionstack.io/control: "true"\n annotations:\n service.beta.kubernetes.io/alibaba-cloud-loadbalancer-spec: slb.s1.small\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/312696f8.a017a544.js b/assets/js/312696f8.a017a544.js new file mode 100644 index 00000000000..49fe75919b6 --- /dev/null +++ b/assets/js/312696f8.a017a544.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3546],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),d=p(n),m=a,f=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return n?r.createElement(f,l(l({ref:t},c),{},{components:n})):r.createElement(f,l({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const o={},l="port",i={unversionedId:"reference/modules/workspace-configs/networking/port",id:"version-v0.10/reference/modules/workspace-configs/networking/port",title:"port",description:"port can be used to define workspace-level networking configurations.",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/networking/port.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/networking",slug:"/reference/modules/workspace-configs/networking/port",permalink:"/docs/v0.10/reference/modules/workspace-configs/networking/port",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/networking/port.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"monitoring",permalink:"/docs/v0.10/reference/modules/workspace-configs/monitoring/prometheus"},next:{title:"opsrule",permalink:"/docs/v0.10/reference/modules/workspace-configs/trait/opsrule"}},s={},p=[{value:"Attributes",id:"attributes",level:2},{value:"Examples",id:"examples",level:3}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"port"},"port"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"port")," can be used to define workspace-level networking configurations."),(0,a.kt)("h2",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"type"),(0,a.kt)("br",null),"The specific cloud vendor that provides load balancer."),(0,a.kt)("td",{parentName:"tr",align:null},'"alicloud" ',"|",' "aws"'),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels"),(0,a.kt)("br",null),"The attached labels of the port."),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations"),(0,a.kt)("br",null),"The attached annotations of the port."),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n port:\n default:\n type: alicloud\n labels:\n kusionstack.io/control: "true"\n annotations:\n service.beta.kubernetes.io/alibaba-cloud-loadbalancer-spec: slb.s1.small\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/32773aa2.1c6bd5c3.js b/assets/js/32773aa2.1c6bd5c3.js new file mode 100644 index 00000000000..f7c95377330 --- /dev/null +++ b/assets/js/32773aa2.1c6bd5c3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8665],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),f=l(n),m=o,d=f["".concat(c,".").concat(m)]||f[m]||u[m]||i;return n?r.createElement(d,a(a({ref:t},p),{},{components:n})):r.createElement(d,a({ref:t},p))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=f;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const i={},a="kusion config list",s={unversionedId:"reference/commands/kusion-config-list",id:"reference/commands/kusion-config-list",title:"kusion config list",description:"List all config items",source:"@site/docs/kusion/6-reference/1-commands/kusion-config-list.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-config-list",permalink:"/docs/next/reference/commands/kusion-config-list",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-config-list.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion config get",permalink:"/docs/next/reference/commands/kusion-config-get"},next:{title:"kusion config set",permalink:"/docs/next/reference/commands/kusion-config-set"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-config-list"},"kusion config list"),(0,o.kt)("p",null,"List all config items"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command lists all the kusion config items and their values."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion config list\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # List config items\n kusion config list\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for list\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-config"},"kusion config"),"\t - Interact with the Kusion config")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/32773aa2.8ee95384.js b/assets/js/32773aa2.8ee95384.js deleted file mode 100644 index 908ff1960c8..00000000000 --- a/assets/js/32773aa2.8ee95384.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8665],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,p=a(e,["components","mdxType","originalType","parentName"]),f=l(n),m=o,d=f["".concat(c,".").concat(m)]||f[m]||u[m]||i;return n?r.createElement(d,s(s({ref:t},p),{},{components:n})):r.createElement(d,s({ref:t},p))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,s=new Array(i);s[0]=f;var a={};for(var c in t)hasOwnProperty.call(t,c)&&(a[c]=t[c]);a.originalType=e,a.mdxType="string"==typeof e?e:o,s[1]=a;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>i,metadata:()=>a,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const i={},s="kusion config list",a={unversionedId:"reference/commands/kusion-config-list",id:"reference/commands/kusion-config-list",title:"kusion config list",description:"List all config items",source:"@site/docs/kusion/6-reference/1-commands/kusion-config-list.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-config-list",permalink:"/docs/next/reference/commands/kusion-config-list",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-config-list.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion config get",permalink:"/docs/next/reference/commands/kusion-config-get"},next:{title:"kusion config set",permalink:"/docs/next/reference/commands/kusion-config-set"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-config-list"},"kusion config list"),(0,o.kt)("p",null,"List all config items"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command lists all the kusion config items and their values."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion config list\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # List config items\n kusion config list\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for list\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-config"},"kusion config"),"\t - Interact with the Kusion config")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/32956a74.14d57419.js b/assets/js/32956a74.14d57419.js new file mode 100644 index 00000000000..ad74485d3cf --- /dev/null +++ b/assets/js/32956a74.14d57419.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2842],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),d=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=d(e.components);return a.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,i=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),c=d(n),m=r,k=c["".concat(i,".").concat(m)]||c[m]||u[m]||l;return n?a.createElement(k,o(o({ref:t},p),{},{components:n})):a.createElement(k,o({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,o=new Array(l);o[0]=c;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var d=2;d{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>u,frontMatter:()=>l,metadata:()=>s,toc:()=>d});var a=n(87462),r=(n(67294),n(3905));const l={},o="mysql",s={unversionedId:"reference/modules/workspace-configs/database/mysql",id:"reference/modules/workspace-configs/database/mysql",title:"mysql",description:"Module MySQL",source:"@site/docs/kusion/6-reference/2-modules/2-workspace-configs/database/mysql.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/database",slug:"/reference/modules/workspace-configs/database/mysql",permalink:"/docs/next/reference/modules/workspace-configs/database/mysql",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/2-workspace-configs/database/mysql.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"service",permalink:"/docs/next/reference/modules/developer-schemas/workload/service"},next:{title:"postgres",permalink:"/docs/next/reference/modules/workspace-configs/database/postgres"}},i={},d=[{value:"Module MySQL",id:"module-mysql",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:d};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"mysql"},"mysql"),(0,r.kt)("h2",{id:"module-mysql"},"Module MySQL"),(0,r.kt)("p",null,"MySQL describes the attributes to locally deploy or create a cloud provider managed mysql database instance for the workload. "),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"cloud"),(0,r.kt)("br",null),"Cloud specifies the type of the cloud vendor."),(0,r.kt)("td",{parentName:"tr",align:null},'"aws" ',"|",' "alicloud"'),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"username"),(0,r.kt)("br",null),"Username specifies the operation account for the mysql database."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},'"root"'),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"category"),(0,r.kt)("br",null),"Category specifies the edition of the mysql instance provided by the cloud vendor."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},'"Basic"'),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"securityIPs"),(0,r.kt)("br",null),"SecurityIPs specifies the list of IP addresses allowed to access the mysql instance provided by the cloud vendor."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},'["0.0.0.0/0"]'),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"privateRouting"),(0,r.kt)("br",null),"PrivateRouting specifies whether the host address of the cloud mysql instance for the workload to connect with is via public network or private network of the cloud vendor."),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"true"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"size"),(0,r.kt)("br",null),"Size specifies the allocated storage size of the mysql instance."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"10"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"subnetID"),(0,r.kt)("br",null),"SubnetID specifies the virtual subnet ID associated with the VPC that the cloud mysql instance will be created in."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"databaseName"),(0,r.kt)("br",null),"databaseName specifies the database name."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'# MySQL workspace configs for AWS RDS\nmodules: \n kusionstack@mysql@0.1.0: \n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n privateRouting: false\n databaseName: "my-mysql"\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'# MySQL workspace configs for Alicloud RDS\nmodules: \n kusionstack@mysql@0.1.0: \n default: \n cloud: alicloud\n size: 20\n instanceType: mysql.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n databaseName: "my-mysql"\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/32956a74.502a8e15.js b/assets/js/32956a74.502a8e15.js deleted file mode 100644 index 67ee4f739f5..00000000000 --- a/assets/js/32956a74.502a8e15.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2842],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),d=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=d(e.components);return a.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,i=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),c=d(n),m=r,k=c["".concat(i,".").concat(m)]||c[m]||u[m]||l;return n?a.createElement(k,o(o({ref:t},p),{},{components:n})):a.createElement(k,o({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,o=new Array(l);o[0]=c;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var d=2;d{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>u,frontMatter:()=>l,metadata:()=>s,toc:()=>d});var a=n(87462),r=(n(67294),n(3905));const l={},o="mysql",s={unversionedId:"reference/modules/workspace-configs/database/mysql",id:"reference/modules/workspace-configs/database/mysql",title:"mysql",description:"Module MySQL",source:"@site/docs/kusion/6-reference/2-modules/2-workspace-configs/database/mysql.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/database",slug:"/reference/modules/workspace-configs/database/mysql",permalink:"/docs/next/reference/modules/workspace-configs/database/mysql",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/2-workspace-configs/database/mysql.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"service",permalink:"/docs/next/reference/modules/developer-schemas/workload/service"},next:{title:"postgres",permalink:"/docs/next/reference/modules/workspace-configs/database/postgres"}},i={},d=[{value:"Module MySQL",id:"module-mysql",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:d};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"mysql"},"mysql"),(0,r.kt)("h2",{id:"module-mysql"},"Module MySQL"),(0,r.kt)("p",null,"MySQL describes the attributes to locally deploy or create a cloud provider managed mysql database instance for the workload. "),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"cloud"),(0,r.kt)("br",null),"Cloud specifies the type of the cloud vendor."),(0,r.kt)("td",{parentName:"tr",align:null},'"aws" ',"|",' "alicloud"'),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"username"),(0,r.kt)("br",null),"Username specifies the operation account for the mysql database."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},'"root"'),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"category"),(0,r.kt)("br",null),"Category specifies the edition of the mysql instance provided by the cloud vendor."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},'"Basic"'),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"securityIPs"),(0,r.kt)("br",null),"SecurityIPs specifies the list of IP addresses allowed to access the mysql instance provided by the cloud vendor."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},'["0.0.0.0/0"]'),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"privateRouting"),(0,r.kt)("br",null),"PrivateRouting specifies whether the host address of the cloud mysql instance for the workload to connect with is via public network or private network of the cloud vendor."),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"true"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"size"),(0,r.kt)("br",null),"Size specifies the allocated storage size of the mysql instance."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"10"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"subnetID"),(0,r.kt)("br",null),"SubnetID specifies the virtual subnet ID associated with the VPC that the cloud mysql instance will be created in."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"databaseName"),(0,r.kt)("br",null),"databaseName specifies the database name."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'# MySQL workspace configs for AWS RDS\nmodules: \n kusionstack@mysql@0.1.0: \n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n privateRouting: false\n databaseName: "my-mysql"\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'# MySQL workspace configs for Alicloud RDS\nmodules: \n kusionstack@mysql@0.1.0: \n default: \n cloud: alicloud\n size: 20\n instanceType: mysql.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n databaseName: "my-mysql"\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/33b38546.8edd6905.js b/assets/js/33b38546.8edd6905.js deleted file mode 100644 index ec6efa61a8b..00000000000 --- a/assets/js/33b38546.8edd6905.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6286],{3905:(e,t,o)=>{o.d(t,{Zo:()=>c,kt:()=>h});var n=o(67294);function i(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function r(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function a(e){for(var t=1;t=0||(i[o]=e[o]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(i[o]=e[o])}return i}var l=n.createContext({}),p=function(e){var t=n.useContext(l),o=t;return e&&(o="function"==typeof e?e(t):a(a({},t),e)),o},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var o=e.components,i=e.mdxType,r=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(o),h=i,m=d["".concat(l,".").concat(h)]||d[h]||u[h]||r;return o?n.createElement(m,a(a({ref:t},c),{},{components:o})):n.createElement(m,a({ref:t},c))}));function h(e,t){var o=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=o.length,a=new Array(r);a[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,a[1]=s;for(var p=2;p{o.r(t),o.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>r,metadata:()=>s,toc:()=>p});var n=o(87462),i=(o(67294),o(3905));const r={sidebar_position:1,sidebar_label:"Overview",title:"Overview",slug:"/"},a="Introduction to Kusion",s={unversionedId:"intro/overview",id:"version-v0.9/intro/overview",title:"Overview",description:"Welcome to Kusion! This introduction section covers what Kusion is, the problem Kusion aims to solve, and how Kusion compares to other software. If you just want to dive into using Kusion, feel free to skip ahead to the Getting Started section.",source:"@site/docs_versioned_docs/version-v0.9/intro/overview.md",sourceDirName:"intro",slug:"/",permalink:"/docs/v0.9/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/intro/overview.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1,sidebar_label:"Overview",title:"Overview",slug:"/"},sidebar:"kusion",next:{title:"Kusion vs. Other Software",permalink:"/docs/v0.9/intro/kusion-vs-x"}},l={},p=[{value:"What is Kusion?",id:"what-is-kusion",level:2},{value:"Why Kusion?",id:"why-kusion",level:2},{value:"Kusion Highlights",id:"kusion-highlights",level:2}],c={toc:p};function u(e){let{components:t,...r}=e;return(0,i.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"introduction-to-kusion"},"Introduction to Kusion"),(0,i.kt)("p",null,"Welcome to Kusion! This introduction section covers what Kusion is, the problem Kusion aims to solve, and how Kusion compares to other software. If you just want to dive into using Kusion, feel free to skip ahead to the ",(0,i.kt)("a",{parentName:"p",href:"getting-started/install-kusion"},"Getting Started")," section."),(0,i.kt)("h2",{id:"what-is-kusion"},"What is Kusion?"),(0,i.kt)("p",null,"Kusion is a modern application delivery and management toolchain that enables developers to specify desired intent in a declarative way and then using a consistent workflow to drive continuous deployment through application lifecycle. Inspired by the phrase ",(0,i.kt)("strong",{parentName:"p"},"Fusion on Kubernetes"),", Kusion aims to help application and platform developers to develop and deliver in a self-serviceable, fast, reliable, and collaborative way."),(0,i.kt)("p",null,(0,i.kt)("img",{src:o(90647).Z,width:"1906",height:"742"})),(0,i.kt)("h2",{id:"why-kusion"},"Why Kusion?"),(0,i.kt)("p",null,"Developers should be able to deploy and run their applications and services end to end. ",(0,i.kt)("strong",{parentName:"p"},'"You build it, you run it", the original promise of DevOps.')),(0,i.kt)("p",null,"But the modern day for most software organizations this promise quickly become unrelalistic since the increasingly complex cloud-native toolchains, while cloud native technologies made huge improvements in areas such as scalability, availability and operability, it also brings downside - the growing burden on developers, which leads to the rise of ",(0,i.kt)("a",{parentName:"p",href:"https://platformengineering.org/"},"Platform Engineering"),"."),(0,i.kt)("p",null,"Another challenge we saw is that a series of ",(0,i.kt)("a",{parentName:"p",href:"https://web.devopstopologies.com/#anti-types"},"antipatterns")," emerge when regular software organizations tries to implement true DevOps. Without well proven reference architecture and supporting tools, it's much more difficult to accomplish the original promise."),(0,i.kt)("p",null,"On one hand, ",(0,i.kt)("strong",{parentName:"p"},"Kusion was build to minimize developer's cognitive load"),". With application-centric configuration model, you don't need to deal with tedious infrastructure and configuration management tooling, all you need to be familiar with is ",(0,i.kt)("a",{parentName:"p",href:"config-walkthrough/overview"},"AppConfigation"),". This approach shields developers from the configurational complexity of Kubernetes but still enable standardization by design."),(0,i.kt)("p",null,"On the other hand, ",(0,i.kt)("strong",{parentName:"p"},"Kusion defines a new way of how different engineering teams collaboration"),". With the separation of concerns, different roles could focus on their work based on their knowledge and responsibility. Through such a division of labor, the platform team can better manage the differences and complexities of the platform, and app developers could participate in ops work with less cognitive load."),(0,i.kt)("h2",{id:"kusion-highlights"},"Kusion Highlights"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Platform as Code")),(0,i.kt)("p",{parentName:"li"},"Specify desired application intent through declarative configuration code, drive continuous deployment with any CI/CD systems or GitOps to match that intent. No ad-hoc scripts, no hard maintain custom workflows, just declarative configuration code.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Dynamic Configuration Management")),(0,i.kt)("p",{parentName:"li"},"Enable platform teams to set baseline-templates, control how and where to deploy application workloads and provision accessory resources. While still enabling application developers freedom via workload-centric specification and deployment. ")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Security & Compliance Built In")),(0,i.kt)("p",{parentName:"li"},"Enforce security and infrastructure best practices with out-of-box ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"base models"),", create security and compliance guardrails for any Kusion deploy with third-party Policy as Code tools. All accessory resource secrets are automatically injected into Workloads.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Lightweight and Open Model Ecosystem")),(0,i.kt)("p",{parentName:"li"},"Pure client-side solution ensures good portability and the rich APIs make it easier to integrate and automate. Large growing model ecosystem covers all stages in application lifecycle, with extensive connections to various infrastructure capabilities. "))),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("strong",{parentName:"p"},"Kusion is an early project.")," The end goal of Kusion is to boost ",(0,i.kt)("a",{parentName:"p",href:"https://internaldeveloperplatform.org/"},"Internal Developer Platform")," revolution and we are iterating on Kusion quickly to strive towards this goal. For any help or feedback, please contract us in ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/community/discussions/categories/meeting"},"Slack")," or ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/issues"},"issues"),".")))}u.isMDXComponent=!0},90647:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/kusion-b78c8632647fb8e4ed182914fe67185e.png"}}]); \ No newline at end of file diff --git a/assets/js/33b38546.e191937e.js b/assets/js/33b38546.e191937e.js new file mode 100644 index 00000000000..3192b5f3ad7 --- /dev/null +++ b/assets/js/33b38546.e191937e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6286],{3905:(e,t,o)=>{o.d(t,{Zo:()=>c,kt:()=>h});var n=o(67294);function i(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function a(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function r(e){for(var t=1;t=0||(i[o]=e[o]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(i[o]=e[o])}return i}var l=n.createContext({}),p=function(e){var t=n.useContext(l),o=t;return e&&(o="function"==typeof e?e(t):r(r({},t),e)),o},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var o=e.components,i=e.mdxType,a=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(o),h=i,m=d["".concat(l,".").concat(h)]||d[h]||u[h]||a;return o?n.createElement(m,r(r({ref:t},c),{},{components:o})):n.createElement(m,r({ref:t},c))}));function h(e,t){var o=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=o.length,r=new Array(a);r[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,r[1]=s;for(var p=2;p{o.r(t),o.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=o(87462),i=(o(67294),o(3905));const a={sidebar_position:1,sidebar_label:"Overview",title:"Overview",slug:"/"},r="Introduction to Kusion",s={unversionedId:"intro/overview",id:"version-v0.9/intro/overview",title:"Overview",description:"Welcome to Kusion! This introduction section covers what Kusion is, the problem Kusion aims to solve, and how Kusion compares to other software. If you just want to dive into using Kusion, feel free to skip ahead to the Getting Started section.",source:"@site/docs_versioned_docs/version-v0.9/intro/overview.md",sourceDirName:"intro",slug:"/",permalink:"/docs/v0.9/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/intro/overview.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1,sidebar_label:"Overview",title:"Overview",slug:"/"},sidebar:"kusion",next:{title:"Kusion vs. Other Software",permalink:"/docs/v0.9/intro/kusion-vs-x"}},l={},p=[{value:"What is Kusion?",id:"what-is-kusion",level:2},{value:"Why Kusion?",id:"why-kusion",level:2},{value:"Kusion Highlights",id:"kusion-highlights",level:2}],c={toc:p};function u(e){let{components:t,...a}=e;return(0,i.kt)("wrapper",(0,n.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"introduction-to-kusion"},"Introduction to Kusion"),(0,i.kt)("p",null,"Welcome to Kusion! This introduction section covers what Kusion is, the problem Kusion aims to solve, and how Kusion compares to other software. If you just want to dive into using Kusion, feel free to skip ahead to the ",(0,i.kt)("a",{parentName:"p",href:"getting-started/install-kusion"},"Getting Started")," section."),(0,i.kt)("h2",{id:"what-is-kusion"},"What is Kusion?"),(0,i.kt)("p",null,"Kusion is a modern application delivery and management toolchain that enables developers to specify desired intent in a declarative way and then using a consistent workflow to drive continuous deployment through application lifecycle. Inspired by the phrase ",(0,i.kt)("strong",{parentName:"p"},"Fusion on Kubernetes"),", Kusion aims to help application and platform developers to develop and deliver in a self-serviceable, fast, reliable, and collaborative way."),(0,i.kt)("p",null,(0,i.kt)("img",{src:o(90647).Z,width:"1906",height:"742"})),(0,i.kt)("h2",{id:"why-kusion"},"Why Kusion?"),(0,i.kt)("p",null,"Developers should be able to deploy and run their applications and services end to end. ",(0,i.kt)("strong",{parentName:"p"},'"You build it, you run it", the original promise of DevOps.')),(0,i.kt)("p",null,"But the modern day for most software organizations this promise quickly become unrelalistic since the increasingly complex cloud-native toolchains, while cloud native technologies made huge improvements in areas such as scalability, availability and operability, it also brings downside - the growing burden on developers, which leads to the rise of ",(0,i.kt)("a",{parentName:"p",href:"https://platformengineering.org/"},"Platform Engineering"),"."),(0,i.kt)("p",null,"Another challenge we saw is that a series of ",(0,i.kt)("a",{parentName:"p",href:"https://web.devopstopologies.com/#anti-types"},"antipatterns")," emerge when regular software organizations tries to implement true DevOps. Without well proven reference architecture and supporting tools, it's much more difficult to accomplish the original promise."),(0,i.kt)("p",null,"On one hand, ",(0,i.kt)("strong",{parentName:"p"},"Kusion was build to minimize developer's cognitive load"),". With application-centric configuration model, you don't need to deal with tedious infrastructure and configuration management tooling, all you need to be familiar with is ",(0,i.kt)("a",{parentName:"p",href:"config-walkthrough/overview"},"AppConfigation"),". This approach shields developers from the configurational complexity of Kubernetes but still enable standardization by design."),(0,i.kt)("p",null,"On the other hand, ",(0,i.kt)("strong",{parentName:"p"},"Kusion defines a new way of how different engineering teams collaboration"),". With the separation of concerns, different roles could focus on their work based on their knowledge and responsibility. Through such a division of labor, the platform team can better manage the differences and complexities of the platform, and app developers could participate in ops work with less cognitive load."),(0,i.kt)("h2",{id:"kusion-highlights"},"Kusion Highlights"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Platform as Code")),(0,i.kt)("p",{parentName:"li"},"Specify desired application intent through declarative configuration code, drive continuous deployment with any CI/CD systems or GitOps to match that intent. No ad-hoc scripts, no hard maintain custom workflows, just declarative configuration code.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Dynamic Configuration Management")),(0,i.kt)("p",{parentName:"li"},"Enable platform teams to set baseline-templates, control how and where to deploy application workloads and provision accessory resources. While still enabling application developers freedom via workload-centric specification and deployment. ")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Security & Compliance Built In")),(0,i.kt)("p",{parentName:"li"},"Enforce security and infrastructure best practices with out-of-box ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"base models"),", create security and compliance guardrails for any Kusion deploy with third-party Policy as Code tools. All accessory resource secrets are automatically injected into Workloads.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Lightweight and Open Model Ecosystem")),(0,i.kt)("p",{parentName:"li"},"Pure client-side solution ensures good portability and the rich APIs make it easier to integrate and automate. Large growing model ecosystem covers all stages in application lifecycle, with extensive connections to various infrastructure capabilities. "))),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("strong",{parentName:"p"},"Kusion is an early project.")," The end goal of Kusion is to boost ",(0,i.kt)("a",{parentName:"p",href:"https://internaldeveloperplatform.org/"},"Internal Developer Platform")," revolution and we are iterating on Kusion quickly to strive towards this goal. For any help or feedback, please contract us in ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/community/discussions/categories/meeting"},"Slack")," or ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/issues"},"issues"),".")))}u.isMDXComponent=!0},90647:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/kusion-b78c8632647fb8e4ed182914fe67185e.png"}}]); \ No newline at end of file diff --git a/assets/js/35b54083.20a1e69b.js b/assets/js/35b54083.20a1e69b.js new file mode 100644 index 00000000000..df747927de1 --- /dev/null +++ b/assets/js/35b54083.20a1e69b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7860],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var i=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=i.createContext({}),p=function(e){var t=i.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=p(e.components);return i.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},d=i.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(n),m=r,h=d["".concat(l,".").concat(m)]||d[m]||u[m]||a;return n?i.createElement(h,o(o({ref:t},c),{},{components:n})):i.createElement(h,o({ref:t},c))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,o=new Array(a);o[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var i=n(87462),r=(n(67294),n(3905));const a={},o="Expose Application Service Deployed on CSP Kubernetes",s={unversionedId:"guides/cloud-resources/expose-service",id:"version-v0.9/guides/cloud-resources/expose-service",title:"Expose Application Service Deployed on CSP Kubernetes",description:"Deploying application on the Kuberentes provided by CSP (Cloud Service Provider) is convenient and reliable, which is adopted by many individuals and enterprises. Kusion has a good integration with CSP Kuberentes service. You can deploy your application to the Kubernetes cluster, and expose the service in a quite easy way.",source:"@site/docs_versioned_docs/version-v0.9/guides/cloud-resources/expose-service.md",sourceDirName:"guides/cloud-resources",slug:"/guides/cloud-resources/expose-service",permalink:"/docs/v0.9/guides/cloud-resources/expose-service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/guides/cloud-resources/expose-service.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Deliver the WordPress Application with Cloud RDS",permalink:"/docs/v0.9/guides/cloud-resources/database"},next:{title:"Kubernetes",permalink:"/docs/v0.9/guides/working-with-k8s/"}},l={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Expose Service Publicly",id:"expose-service-publicly",level:2},{value:"Write Configuration Code",id:"write-configuration-code",level:3},{value:"Preview and Apply",id:"preview-and-apply",level:3},{value:"Verify Accessibility",id:"verify-accessibility",level:3},{value:"Expose Service Inside Cluster",id:"expose-service-inside-cluster",level:2},{value:"Summary",id:"summary",level:2}],c={toc:p};function u(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,i.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"expose-application-service-deployed-on-csp-kubernetes"},"Expose Application Service Deployed on CSP Kubernetes"),(0,r.kt)("p",null,"Deploying application on the Kuberentes provided by CSP (Cloud Service Provider) is convenient and reliable, which is adopted by many individuals and enterprises. Kusion has a good integration with CSP Kuberentes service. You can deploy your application to the Kubernetes cluster, and expose the service in a quite easy way. "),(0,r.kt)("p",null,"This tutorial demonstrates how to expose service of the application deployed on CSP Kubernetes. In this article, ",(0,r.kt)("em",{parentName:"p"},(0,r.kt)("a",{parentName:"em",href:"https://github.com/KusionStack/konfig/blob/main/example/nginx/dev/main.k"},"exposing the service of nginx"),' (referred to "the example" in the below)')," is given as an example."),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("p",null,"Create a Kubernetes cluster, the following CSP Kubernetes services are supported."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/product/kubernetes"},"Alibaba Cloud Container Service for Kubernetes (ACK)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://aws.amazon.com/eks"},"Amazon Elastic Kubernetes Service (EKS)"),".")),(0,r.kt)("p",null,"After creating the cluster, get the kube-config and export it, so that Kusion can access the cluster."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'export KUBE_CONFIG=""\n')),(0,r.kt)("h2",{id:"expose-service-publicly"},"Expose Service Publicly"),(0,r.kt)("p",null,"If you want the application can be accessed from outside the cluster, you should expose the service publicly. Follow the steps below, you will simply hit the goal."),(0,r.kt)("h3",{id:"write-configuration-code"},"Write Configuration Code"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.network as n\n\nnginx: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n nginx: c.Container {\n image = "nginx:1.25.2"\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n ports: [\n n.Port {\n type: "aliyun"\n port: 80\n protocol: "TCP"\n public: True\n }\n ]\n }\n}\n')),(0,r.kt)("p",null,"The code shown above describes how to expose service publicly of the example on ACK. Kusion use schema ",(0,r.kt)("inlineCode",{parentName:"p"},"Port")," to describe the network configuration, the primary fields of Port are as follows:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"type: the CSP providing Kubernetes service, support ",(0,r.kt)("inlineCode",{parentName:"li"},"aliyun")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"aws")),(0,r.kt)("li",{parentName:"ul"},"port: port number to expose service"),(0,r.kt)("li",{parentName:"ul"},"protocol: protocol to expose service, support ",(0,r.kt)("inlineCode",{parentName:"li"},"TCP")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"UDP")),(0,r.kt)("li",{parentName:"ul"},"public: whether to public the service")),(0,r.kt)("p",null,"To public the service, you should assign the ",(0,r.kt)("inlineCode",{parentName:"p"},"type")," (aliyun for ACK, aws for EKS), and set ",(0,r.kt)("inlineCode",{parentName:"p"},"public")," as True. Besides, schema ",(0,r.kt)("inlineCode",{parentName:"p"},"Service")," should be used to describe the workload configuration."),(0,r.kt)("p",null,"That's all what you need to configure! Next, preview and apply the configuration, the application will get deployed and exposed publicly."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"Kusion uses Load Balancer (LB) provided by the CSP to expose service publicly. For more detailed network configuration, please refer to ",(0,r.kt)("a",{parentName:"p",href:"../../config-walkthrough/networking"},"Application Networking"))),(0,r.kt)("h3",{id:"preview-and-apply"},"Preview and Apply"),(0,r.kt)("p",null,"Execute ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion preview")," under the stack path, you will get what will be created in the real infrastructure. The picture below gives the preview result of the example. A Namespace, Service and Deployment will be created, which meets the expectation. The service name has a suffix ",(0,r.kt)("inlineCode",{parentName:"p"},"public"),", which shows it can be accessed publicly."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"preview-public",src:n(85091).Z,width:"1540",height:"262"})),(0,r.kt)("p",null,"Then, execute ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion apply --yes")," to do the real deploying job. Just a command and a few minutes, you have accomplished deploying application and expose it publicly."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply-public",src:n(97932).Z,width:"1558",height:"480"})),(0,r.kt)("h3",{id:"verify-accessibility"},"Verify Accessibility"),(0,r.kt)("p",null,"In the example, the kubernetes Namespace whose name is nginx, and a Service and Deployment under the Namespace should be created. Use ",(0,r.kt)("inlineCode",{parentName:"p"},"kubectl get")," to check, the Service whose type is ",(0,r.kt)("inlineCode",{parentName:"p"},"LoadBalancer")," and Deployment are created indeed. And the Service has ",(0,r.kt)("inlineCode",{parentName:"p"},"EXTERNAL-IP")," 106.5.190.109, which means it can be accessed from outside the cluster."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"k8s-resource-public",src:n(68162).Z,width:"1662",height:"216"})),(0,r.kt)("p",null,"Visit the ",(0,r.kt)("inlineCode",{parentName:"p"},"EXTERNAL-IP")," via browser, the correct result is returned, which illustrates the servie get publicly exposed successfully."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"result-public",src:n(65377).Z,width:"1494",height:"682"})),(0,r.kt)("h2",{id:"expose-service-inside-cluster"},"Expose Service Inside Cluster"),(0,r.kt)("p",null,"If you only need the application can be accessed inside the cluster, just configure ",(0,r.kt)("inlineCode",{parentName:"p"},"Public")," as False in schema ",(0,r.kt)("inlineCode",{parentName:"p"},"Port"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.network as n\n\nnginx: ac.AppConfiguration {\n workload: wl.Service {\n ...\n ports: [\n n.Port {\n ...\n public: False\n }\n ]\n }\n}\n")),(0,r.kt)("p",null,"Execute ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion apply --yes"),", the generated Service has suffix ",(0,r.kt)("inlineCode",{parentName:"p"},"private"),"."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply-private",src:n(96057).Z,width:"1612",height:"494"})),(0,r.kt)("p",null,"And the Service type is ",(0,r.kt)("inlineCode",{parentName:"p"},"ClusterIP"),", only has ",(0,r.kt)("inlineCode",{parentName:"p"},"CLUSTER_IP")," and no ",(0,r.kt)("inlineCode",{parentName:"p"},"EXTERNAL_IP"),", which means it cannot get accessed from outside the cluster. "),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"k8s-resource-private",src:n(64600).Z,width:"1542",height:"210"})),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"This tutorial demonstrates how to expose service of the application deployed on the CSP Kubernetes. By configuring schema Port, Kusion enables you expose service simply and efficiently."))}u.isMDXComponent=!0},96057:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/apply-private-a1d1f3a1b5afac81cea19f189d08222d.png"},97932:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/apply-public-d89cdb3ba9d96904e1820bfbcf4671d8.png"},64600:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/k8s-resource-private-62ab14b1de35205866b64a0d63180450.png"},68162:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/k8s-resource-public-66ffcb206b33c5fc6f1a779bc10b3e93.png"},85091:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/preview-public-eea90eec123cd2fc13536be2b645e900.png"},65377:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/result-public-4bf3f757b0a43c78464ec9bcd75a4b2f.png"}}]); \ No newline at end of file diff --git a/assets/js/35b54083.d5979de7.js b/assets/js/35b54083.d5979de7.js deleted file mode 100644 index 5827c822a05..00000000000 --- a/assets/js/35b54083.d5979de7.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7860],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var i=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=i.createContext({}),p=function(e){var t=i.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=p(e.components);return i.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},d=i.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(n),m=r,h=d["".concat(l,".").concat(m)]||d[m]||u[m]||a;return n?i.createElement(h,o(o({ref:t},c),{},{components:n})):i.createElement(h,o({ref:t},c))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,o=new Array(a);o[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var i=n(87462),r=(n(67294),n(3905));const a={},o="Expose Application Service Deployed on CSP Kubernetes",s={unversionedId:"guides/cloud-resources/expose-service",id:"version-v0.9/guides/cloud-resources/expose-service",title:"Expose Application Service Deployed on CSP Kubernetes",description:"Deploying application on the Kuberentes provided by CSP (Cloud Service Provider) is convenient and reliable, which is adopted by many individuals and enterprises. Kusion has a good integration with CSP Kuberentes service. You can deploy your application to the Kubernetes cluster, and expose the service in a quite easy way.",source:"@site/docs_versioned_docs/version-v0.9/guides/cloud-resources/expose-service.md",sourceDirName:"guides/cloud-resources",slug:"/guides/cloud-resources/expose-service",permalink:"/docs/v0.9/guides/cloud-resources/expose-service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/guides/cloud-resources/expose-service.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Deliver the WordPress Application with Cloud RDS",permalink:"/docs/v0.9/guides/cloud-resources/database"},next:{title:"Kubernetes",permalink:"/docs/v0.9/guides/working-with-k8s/"}},l={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Expose Service Publicly",id:"expose-service-publicly",level:2},{value:"Write Configuration Code",id:"write-configuration-code",level:3},{value:"Preview and Apply",id:"preview-and-apply",level:3},{value:"Verify Accessibility",id:"verify-accessibility",level:3},{value:"Expose Service Inside Cluster",id:"expose-service-inside-cluster",level:2},{value:"Summary",id:"summary",level:2}],c={toc:p};function u(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,i.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"expose-application-service-deployed-on-csp-kubernetes"},"Expose Application Service Deployed on CSP Kubernetes"),(0,r.kt)("p",null,"Deploying application on the Kuberentes provided by CSP (Cloud Service Provider) is convenient and reliable, which is adopted by many individuals and enterprises. Kusion has a good integration with CSP Kuberentes service. You can deploy your application to the Kubernetes cluster, and expose the service in a quite easy way. "),(0,r.kt)("p",null,"This tutorial demonstrates how to expose service of the application deployed on CSP Kubernetes. In this article, ",(0,r.kt)("em",{parentName:"p"},(0,r.kt)("a",{parentName:"em",href:"https://github.com/KusionStack/konfig/blob/main/example/nginx/dev/main.k"},"exposing the service of nginx"),' (referred to "the example" in the below)')," is given as an example."),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("p",null,"Create a Kubernetes cluster, the following CSP Kubernetes services are supported."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/product/kubernetes"},"Alibaba Cloud Container Service for Kubernetes (ACK)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://aws.amazon.com/eks"},"Amazon Elastic Kubernetes Service (EKS)"),".")),(0,r.kt)("p",null,"After creating the cluster, get the kube-config and export it, so that Kusion can access the cluster."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'export KUBE_CONFIG=""\n')),(0,r.kt)("h2",{id:"expose-service-publicly"},"Expose Service Publicly"),(0,r.kt)("p",null,"If you want the application can be accessed from outside the cluster, you should expose the service publicly. Follow the steps below, you will simply hit the goal."),(0,r.kt)("h3",{id:"write-configuration-code"},"Write Configuration Code"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.network as n\n\nnginx: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n nginx: c.Container {\n image = "nginx:1.25.2"\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n ports: [\n n.Port {\n type: "aliyun"\n port: 80\n protocol: "TCP"\n public: True\n }\n ]\n }\n}\n')),(0,r.kt)("p",null,"The code shown above describes how to expose service publicly of the example on ACK. Kusion use schema ",(0,r.kt)("inlineCode",{parentName:"p"},"Port")," to describe the network configuration, the primary fields of Port are as follows:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"type: the CSP providing Kubernetes service, support ",(0,r.kt)("inlineCode",{parentName:"li"},"aliyun")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"aws")),(0,r.kt)("li",{parentName:"ul"},"port: port number to expose service"),(0,r.kt)("li",{parentName:"ul"},"protocol: protocol to expose service, support ",(0,r.kt)("inlineCode",{parentName:"li"},"TCP")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"UDP")),(0,r.kt)("li",{parentName:"ul"},"public: whether to public the service")),(0,r.kt)("p",null,"To public the service, you should assign the ",(0,r.kt)("inlineCode",{parentName:"p"},"type")," (aliyun for ACK, aws for EKS), and set ",(0,r.kt)("inlineCode",{parentName:"p"},"public")," as True. Besides, schema ",(0,r.kt)("inlineCode",{parentName:"p"},"Service")," should be used to describe the workload configuration."),(0,r.kt)("p",null,"That's all what you need to configure! Next, preview and apply the configuration, the application will get deployed and exposed publicly."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"Kusion uses Load Balancer (LB) provided by the CSP to expose service publicly. For more detailed network configuration, please refer to ",(0,r.kt)("a",{parentName:"p",href:"../../config-walkthrough/networking"},"Application Networking"))),(0,r.kt)("h3",{id:"preview-and-apply"},"Preview and Apply"),(0,r.kt)("p",null,"Execute ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion preview")," under the stack path, you will get what will be created in the real infrastructure. The picture below gives the preview result of the example. A Namespace, Service and Deployment will be created, which meets the expectation. The service name has a suffix ",(0,r.kt)("inlineCode",{parentName:"p"},"public"),", which shows it can be accessed publicly."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"preview-public",src:n(85091).Z,width:"1540",height:"262"})),(0,r.kt)("p",null,"Then, execute ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion apply --yes")," to do the real deploying job. Just a command and a few minutes, you have accomplished deploying application and expose it publicly."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply-public",src:n(97932).Z,width:"1558",height:"480"})),(0,r.kt)("h3",{id:"verify-accessibility"},"Verify Accessibility"),(0,r.kt)("p",null,"In the example, the kubernetes Namespace whose name is nginx, and a Service and Deployment under the Namespace should be created. Use ",(0,r.kt)("inlineCode",{parentName:"p"},"kubectl get")," to check, the Service whose type is ",(0,r.kt)("inlineCode",{parentName:"p"},"LoadBalancer")," and Deployment are created indeed. And the Service has ",(0,r.kt)("inlineCode",{parentName:"p"},"EXTERNAL-IP")," 106.5.190.109, which means it can be accessed from outside the cluster."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"k8s-resource-public",src:n(68162).Z,width:"1662",height:"216"})),(0,r.kt)("p",null,"Visit the ",(0,r.kt)("inlineCode",{parentName:"p"},"EXTERNAL-IP")," via browser, the correct result is returned, which illustrates the servie get publicly exposed successfully."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"result-public",src:n(65377).Z,width:"1494",height:"682"})),(0,r.kt)("h2",{id:"expose-service-inside-cluster"},"Expose Service Inside Cluster"),(0,r.kt)("p",null,"If you only need the application can be accessed inside the cluster, just configure ",(0,r.kt)("inlineCode",{parentName:"p"},"Public")," as False in schema ",(0,r.kt)("inlineCode",{parentName:"p"},"Port"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.network as n\n\nnginx: ac.AppConfiguration {\n workload: wl.Service {\n ...\n ports: [\n n.Port {\n ...\n public: False\n }\n ]\n }\n}\n")),(0,r.kt)("p",null,"Execute ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion apply --yes"),", the generated Service has suffix ",(0,r.kt)("inlineCode",{parentName:"p"},"private"),"."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply-private",src:n(96057).Z,width:"1612",height:"494"})),(0,r.kt)("p",null,"And the Service type is ",(0,r.kt)("inlineCode",{parentName:"p"},"ClusterIP"),", only has ",(0,r.kt)("inlineCode",{parentName:"p"},"CLUSTER_IP")," and no ",(0,r.kt)("inlineCode",{parentName:"p"},"EXTERNAL_IP"),", which means it cannot get accessed from outside the cluster. "),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"k8s-resource-private",src:n(64600).Z,width:"1542",height:"210"})),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"This tutorial demonstrates how to expose service of the application deployed on the CSP Kubernetes. By configuring schema Port, Kusion enables you expose service simply and efficiently."))}u.isMDXComponent=!0},96057:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/apply-private-a1d1f3a1b5afac81cea19f189d08222d.png"},97932:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/apply-public-d89cdb3ba9d96904e1820bfbcf4671d8.png"},64600:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/k8s-resource-private-62ab14b1de35205866b64a0d63180450.png"},68162:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/k8s-resource-public-66ffcb206b33c5fc6f1a779bc10b3e93.png"},85091:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/preview-public-eea90eec123cd2fc13536be2b645e900.png"},65377:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/result-public-4bf3f757b0a43c78464ec9bcd75a4b2f.png"}}]); \ No newline at end of file diff --git a/assets/js/3777d550.13a3ca30.js b/assets/js/3777d550.13a3ca30.js deleted file mode 100644 index 3478731295a..00000000000 --- a/assets/js/3777d550.13a3ca30.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5420],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function i(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var l=a.createContext({}),c=function(e){var n=a.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},p=function(e){var n=c(e.components);return a.createElement(l.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},d=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=c(t),m=r,k=d["".concat(l,".").concat(m)]||d[m]||u[m]||o;return t?a.createElement(k,i(i({ref:n},p),{},{components:t})):a.createElement(k,i({ref:n},p))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,i=new Array(o);i[0]=d;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var c=2;c{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>i,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>c});var a=t(87462),r=(t(67294),t(3905));const o={id:"backend-configuration",sidebar_label:"Backend Configuration"},i="Backend Configuration",s={unversionedId:"concepts/backend-configuration",id:"version-v0.10/concepts/backend-configuration",title:"Backend Configuration",description:"The backend configuration defines the place where Kusion stores its state data file. By default, Kusion uses the local type of backend to store the state on the local disk. While for team collaboration projects, the state can be stored on a remote backend, such as mysql, oss and s3 to allow multiple users access it.",source:"@site/docs_versioned_docs/version-v0.10/3-concepts/7-backend-configuration.md",sourceDirName:"3-concepts",slug:"/concepts/backend-configuration",permalink:"/docs/v0.10/concepts/backend-configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/3-concepts/7-backend-configuration.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:7,frontMatter:{id:"backend-configuration",sidebar_label:"Backend Configuration"},sidebar:"kusion",previous:{title:"Intent",permalink:"/docs/v0.10/concepts/intent"},next:{title:"How Kusion Works?",permalink:"/docs/v0.10/concepts/how-kusion-works"}},l={},c=[{value:"Configuring State Backend",id:"configuring-state-backend",level:2},{value:"Workspace Configuration File",id:"workspace-configuration-file",level:3},{value:"Environment Variables",id:"environment-variables",level:3},{value:"Command Line Parameters",id:"command-line-parameters",level:3},{value:"Configuration Combination",id:"configuration-combination",level:3},{value:"Available Backend",id:"available-backend",level:2},{value:"local",id:"local",level:3},{value:"mysql",id:"mysql",level:3},{value:"oss",id:"oss",level:3},{value:"s3",id:"s3",level:3}],p={toc:c};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"backend-configuration"},"Backend Configuration"),(0,r.kt)("p",null,"The backend configuration defines the place where Kusion stores its ",(0,r.kt)("inlineCode",{parentName:"p"},"state")," data file. By default, Kusion uses the ",(0,r.kt)("inlineCode",{parentName:"p"},"local")," type of backend to store the state on the local disk. While for team collaboration projects, the state can be stored on a remote backend, such as ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"oss")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"s3")," to allow multiple users access it. "),(0,r.kt)("h2",{id:"configuring-state-backend"},"Configuring State Backend"),(0,r.kt)("p",null,"There are three ways to configure the backend:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"workspace configuration file"),(0,r.kt)("li",{parentName:"ul"},"environment variables"),(0,r.kt)("li",{parentName:"ul"},"command line parameters")),(0,r.kt)("h3",{id:"workspace-configuration-file"},"Workspace Configuration File"),(0,r.kt)("p",null,"Users can configure the storage of the state with the ",(0,r.kt)("inlineCode",{parentName:"p"},"backends")," block in the workspace file, where a map with the backend type as the key and the corresponding config items as the value to declare the backend configuration. Be attention, only one kind of backend type is allowed, more than one backend types are illegal."),(0,r.kt)("p",null,"The following gives an example of the backend configuration of ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"backends:\n mysql:\n dbName: \n user: \n password: \n host: \n port: \n")),(0,r.kt)("h3",{id:"environment-variables"},"Environment Variables"),(0,r.kt)("p",null,"For the sensitive information, Kusion supports configuring them by environment variables. Not all the configuration items are enabled, and the items differ from backend type. For example, users can configure mysql password by environment variable ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_BACKEND_MYSQL_PASSWORD"),"."),(0,r.kt)("h3",{id:"command-line-parameters"},"Command Line Parameters"),(0,r.kt)("p",null,"Users can specify the type of backend with the option ",(0,r.kt)("inlineCode",{parentName:"p"},"--backend-type"),", and configure the detailed information with ",(0,r.kt)("inlineCode",{parentName:"p"},"--backend-config")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"-C"),", for instance: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion apply --backend-type mysql -C dbName= -C user= -C password= -C host= -C port=\n")),(0,r.kt)("h3",{id:"configuration-combination"},"Configuration Combination"),(0,r.kt)("p",null,"When more than one configuration methods are in use, Kusion will merge them to generate the whole backend configuration. Workspace configuration file, environment variables, command line parameter: the priority of these three configuration methods increases gradually. If there is no conflict of backend type, the latter will overlay the former by configuration items. If there is conflict of backend type, which only occurs between workspace configuration file and command line parameters, use the backend type specified by command line, and the configuration items from workspace are deprecated."),(0,r.kt)("h2",{id:"available-backend"},"Available Backend"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"local"),(0,r.kt)("li",{parentName:"ul"},"mysql"),(0,r.kt)("li",{parentName:"ul"},"oss"),(0,r.kt)("li",{parentName:"ul"},"s3")),(0,r.kt)("h3",{id:"local"},"local"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"local")," storage type stores the ",(0,r.kt)("inlineCode",{parentName:"p"},"state")," on the local file system, which is suitable for local operations while not ideal for multi-user collaboration. "),(0,r.kt)("p",null,"There is no configuration items for ",(0,r.kt)("inlineCode",{parentName:"p"},"local")," backend. When neither the workspace configuration file nor the command line parameters declare the backend configuration, Kusion by default uses the ",(0,r.kt)("inlineCode",{parentName:"p"},"local"),"."),(0,r.kt)("h3",{id:"mysql"},"mysql"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql")," storage type stores the ",(0,r.kt)("inlineCode",{parentName:"p"},"state")," into a ",(0,r.kt)("strong",{parentName:"p"},"mysql database"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"# workspace configuration file\nbackends:\n mysql:\n dbName: \n user: \n password: \n host: \n port: \n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# environment variables\nexport KUSION_BACKEND_MYSQL_PASSWORD=\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"# command line parameters\nkusion apply --backend-type mysql -C dbName= -C user= -C password= -C host= -C port=\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"dbName - ",(0,r.kt)("inlineCode",{parentName:"li"},"required")," the name of the database"),(0,r.kt)("li",{parentName:"ul"},"user - ",(0,r.kt)("inlineCode",{parentName:"li"},"required")," the username of the database"),(0,r.kt)("li",{parentName:"ul"},"password - ",(0,r.kt)("inlineCode",{parentName:"li"},"required")," the password of the database, support declaring by environment variable ",(0,r.kt)("inlineCode",{parentName:"li"},"KUSION_BACKEND_MYSQL_PASSWORD")),(0,r.kt)("li",{parentName:"ul"},"host - ",(0,r.kt)("inlineCode",{parentName:"li"},"required")," the access address for the database"),(0,r.kt)("li",{parentName:"ul"},"port - ",(0,r.kt)("inlineCode",{parentName:"li"},"required")," the port of the database")),(0,r.kt)("p",null,"Note that the table name in the database used by Kusion is ",(0,r.kt)("strong",{parentName:"p"},"state"),". Below is an example SQL statement for creating this table:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sql"},"CREATE TABLE `state` (\n `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'primary key',\n `tenant` varchar(100) DEFAULT NULL COMMENT 'tenant',\n `project` varchar(100) NOT NULL COMMENT 'project',\n `kusion_version` varchar(50) DEFAULT NULL COMMENT 'kusion version',\n `version` int(10) unsigned NOT NULL COMMENT 'current state format version\uff0cmay upgrade in the future',\n `serial` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'modification times for state\uff0ccan be used in concurrent control',\n `operator` varchar(100) DEFAULT NULL COMMENT 'last modifier',\n `resources` longtext DEFAULT NULL COMMENT 'state of the resources\uff0cjson array',\n `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'creation time',\n `modified_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT 'update time',\n `stack` varchar(100) DEFAULT NULL COMMENT 'stack',\n `cluster` varchar(100) DEFAULT NULL COMMENT 'logical isolation in a stack\uff0cusually clustername__cellname',\n PRIMARY KEY (`id`),\n UNIQUE KEY `uk_state_latest` (`tenant`, `project`, `stack`, `serial`, `cluster`),\n KEY `idx_tenant` (`tenant`),\n KEY `idx_project` (`project`),\n KEY `idx_kusion_version` (`kusion_version`),\n KEY `idx_version` (`version`),\n KEY `idx_create_time` (`create_time`),\n KEY `idx_modified_time` (`modified_time`),\n KEY `idx_stack` (`stack`),\n KEY `idx_cluster` (`cluster`)\n);\n")),(0,r.kt)("h3",{id:"oss"},"oss"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"oss")," storage type stores the ",(0,r.kt)("inlineCode",{parentName:"p"},"state")," on the ",(0,r.kt)("strong",{parentName:"p"},"Alicloud Object Storage Service (OSS)"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"# workspace configuration file\nbackends:\n oss:\n endpoint: \n bucket: \n accessKeyID: \n access-key-secret: \n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# environment variables\nexport OSS_ACCESS_KEY_ID=\nexport OSS_ACCESS_KEY_SECRET=\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"# command line parameters\nkusion apply --backend-type oss -C endpoint= -C bucket= -C accessKeyID= -C accessKeySecret=\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"endpoint - ",(0,r.kt)("inlineCode",{parentName:"li"},"required")," specify the access endpoint for alicloud oss bucket"),(0,r.kt)("li",{parentName:"ul"},"bucket - ",(0,r.kt)("inlineCode",{parentName:"li"},"required")," specify the name of the alicloud oss bucket"),(0,r.kt)("li",{parentName:"ul"},"accessKeyID - ",(0,r.kt)("inlineCode",{parentName:"li"},"required")," specify the alicloud account accessKeyID, support declaring by environment variable ",(0,r.kt)("inlineCode",{parentName:"li"},"OSS_ACCESS_KEY_ID")),(0,r.kt)("li",{parentName:"ul"},"accessKeySecret - ",(0,r.kt)("inlineCode",{parentName:"li"},"required")," specify the alicloud account accessKeySecret, support declaring by environment variable ",(0,r.kt)("inlineCode",{parentName:"li"},"OSS_ACCESS_KEY_SECRET"))),(0,r.kt)("h3",{id:"s3"},"s3"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"s3")," storage type stores the ",(0,r.kt)("inlineCode",{parentName:"p"},"state")," on the ",(0,r.kt)("strong",{parentName:"p"},"AWS Simple Storage Service (S3)"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"# workspace configuration file\nbackend: \n s3:\n endpoint: \n bucket: \n accessKeyID: \n access-key-secret: \n region: \n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# environment variables\nexport AWS_ACCESS_KEY_ID=\nexport AWS_SECRET_ACCESS_KEY=\nexport AWS_REGION=\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"# command line parameters\nkusion apply --backend-type s3 -C endpoint= -C bucket= -C accessKeyID= -C accessKeySecret= -C region=\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"endpoint - ",(0,r.kt)("inlineCode",{parentName:"li"},"optional")," specify the access endpoint for aws s3 bucket"),(0,r.kt)("li",{parentName:"ul"},"bucket - ",(0,r.kt)("inlineCode",{parentName:"li"},"required")," specify the name of the aws s3 bucket"),(0,r.kt)("li",{parentName:"ul"},"accessKeyID - ",(0,r.kt)("inlineCode",{parentName:"li"},"required")," specify the aws account accessKeyID, support declaring by environment variable ",(0,r.kt)("inlineCode",{parentName:"li"},"AWS_ACCESS_KEY_ID")),(0,r.kt)("li",{parentName:"ul"},"accessKeySecret - ",(0,r.kt)("inlineCode",{parentName:"li"},"required")," specify the aws account accessKeySecret, support declaring by environment variable ",(0,r.kt)("inlineCode",{parentName:"li"},"AWS_SECRET_ACCESS_KEY")),(0,r.kt)("li",{parentName:"ul"},"region - ",(0,r.kt)("inlineCode",{parentName:"li"},"required")," specify the region of aws s3 bucket, support declaring by environment variable ",(0,r.kt)("inlineCode",{parentName:"li"},"AWS_DEFAULT_REGION")," or ",(0,r.kt)("inlineCode",{parentName:"li"},"AWS_REGION"))))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3777d550.d2c0d61e.js b/assets/js/3777d550.d2c0d61e.js new file mode 100644 index 00000000000..324bb8a2099 --- /dev/null +++ b/assets/js/3777d550.d2c0d61e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5420],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function i(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var l=a.createContext({}),c=function(e){var n=a.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},p=function(e){var n=c(e.components);return a.createElement(l.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},d=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=c(t),m=r,k=d["".concat(l,".").concat(m)]||d[m]||u[m]||o;return t?a.createElement(k,i(i({ref:n},p),{},{components:t})):a.createElement(k,i({ref:n},p))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var o=t.length,i=new Array(o);i[0]=d;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var c=2;c{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>i,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>c});var a=t(87462),r=(t(67294),t(3905));const o={id:"backend-configuration",sidebar_label:"Backend Configuration"},i="Backend Configuration",s={unversionedId:"concepts/backend-configuration",id:"version-v0.10/concepts/backend-configuration",title:"Backend Configuration",description:"The backend configuration defines the place where Kusion stores its state data file. By default, Kusion uses the local type of backend to store the state on the local disk. While for team collaboration projects, the state can be stored on a remote backend, such as mysql, oss and s3 to allow multiple users access it.",source:"@site/docs_versioned_docs/version-v0.10/3-concepts/7-backend-configuration.md",sourceDirName:"3-concepts",slug:"/concepts/backend-configuration",permalink:"/docs/v0.10/concepts/backend-configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/3-concepts/7-backend-configuration.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:7,frontMatter:{id:"backend-configuration",sidebar_label:"Backend Configuration"},sidebar:"kusion",previous:{title:"Intent",permalink:"/docs/v0.10/concepts/intent"},next:{title:"How Kusion Works?",permalink:"/docs/v0.10/concepts/how-kusion-works"}},l={},c=[{value:"Configuring State Backend",id:"configuring-state-backend",level:2},{value:"Workspace Configuration File",id:"workspace-configuration-file",level:3},{value:"Environment Variables",id:"environment-variables",level:3},{value:"Command Line Parameters",id:"command-line-parameters",level:3},{value:"Configuration Combination",id:"configuration-combination",level:3},{value:"Available Backend",id:"available-backend",level:2},{value:"local",id:"local",level:3},{value:"mysql",id:"mysql",level:3},{value:"oss",id:"oss",level:3},{value:"s3",id:"s3",level:3}],p={toc:c};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"backend-configuration"},"Backend Configuration"),(0,r.kt)("p",null,"The backend configuration defines the place where Kusion stores its ",(0,r.kt)("inlineCode",{parentName:"p"},"state")," data file. By default, Kusion uses the ",(0,r.kt)("inlineCode",{parentName:"p"},"local")," type of backend to store the state on the local disk. While for team collaboration projects, the state can be stored on a remote backend, such as ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"oss")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"s3")," to allow multiple users access it. "),(0,r.kt)("h2",{id:"configuring-state-backend"},"Configuring State Backend"),(0,r.kt)("p",null,"There are three ways to configure the backend:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"workspace configuration file"),(0,r.kt)("li",{parentName:"ul"},"environment variables"),(0,r.kt)("li",{parentName:"ul"},"command line parameters")),(0,r.kt)("h3",{id:"workspace-configuration-file"},"Workspace Configuration File"),(0,r.kt)("p",null,"Users can configure the storage of the state with the ",(0,r.kt)("inlineCode",{parentName:"p"},"backends")," block in the workspace file, where a map with the backend type as the key and the corresponding config items as the value to declare the backend configuration. Be attention, only one kind of backend type is allowed, more than one backend types are illegal."),(0,r.kt)("p",null,"The following gives an example of the backend configuration of ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"backends:\n mysql:\n dbName: \n user: \n password: \n host: \n port: \n")),(0,r.kt)("h3",{id:"environment-variables"},"Environment Variables"),(0,r.kt)("p",null,"For the sensitive information, Kusion supports configuring them by environment variables. Not all the configuration items are enabled, and the items differ from backend type. For example, users can configure mysql password by environment variable ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_BACKEND_MYSQL_PASSWORD"),"."),(0,r.kt)("h3",{id:"command-line-parameters"},"Command Line Parameters"),(0,r.kt)("p",null,"Users can specify the type of backend with the option ",(0,r.kt)("inlineCode",{parentName:"p"},"--backend-type"),", and configure the detailed information with ",(0,r.kt)("inlineCode",{parentName:"p"},"--backend-config")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"-C"),", for instance: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion apply --backend-type mysql -C dbName= -C user= -C password= -C host= -C port=\n")),(0,r.kt)("h3",{id:"configuration-combination"},"Configuration Combination"),(0,r.kt)("p",null,"When more than one configuration methods are in use, Kusion will merge them to generate the whole backend configuration. Workspace configuration file, environment variables, command line parameter: the priority of these three configuration methods increases gradually. If there is no conflict of backend type, the latter will overlay the former by configuration items. If there is conflict of backend type, which only occurs between workspace configuration file and command line parameters, use the backend type specified by command line, and the configuration items from workspace are deprecated."),(0,r.kt)("h2",{id:"available-backend"},"Available Backend"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"local"),(0,r.kt)("li",{parentName:"ul"},"mysql"),(0,r.kt)("li",{parentName:"ul"},"oss"),(0,r.kt)("li",{parentName:"ul"},"s3")),(0,r.kt)("h3",{id:"local"},"local"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"local")," storage type stores the ",(0,r.kt)("inlineCode",{parentName:"p"},"state")," on the local file system, which is suitable for local operations while not ideal for multi-user collaboration. "),(0,r.kt)("p",null,"There is no configuration items for ",(0,r.kt)("inlineCode",{parentName:"p"},"local")," backend. When neither the workspace configuration file nor the command line parameters declare the backend configuration, Kusion by default uses the ",(0,r.kt)("inlineCode",{parentName:"p"},"local"),"."),(0,r.kt)("h3",{id:"mysql"},"mysql"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql")," storage type stores the ",(0,r.kt)("inlineCode",{parentName:"p"},"state")," into a ",(0,r.kt)("strong",{parentName:"p"},"mysql database"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"# workspace configuration file\nbackends:\n mysql:\n dbName: \n user: \n password: \n host: \n port: \n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# environment variables\nexport KUSION_BACKEND_MYSQL_PASSWORD=\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"# command line parameters\nkusion apply --backend-type mysql -C dbName= -C user= -C password= -C host= -C port=\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"dbName - ",(0,r.kt)("inlineCode",{parentName:"li"},"required")," the name of the database"),(0,r.kt)("li",{parentName:"ul"},"user - ",(0,r.kt)("inlineCode",{parentName:"li"},"required")," the username of the database"),(0,r.kt)("li",{parentName:"ul"},"password - ",(0,r.kt)("inlineCode",{parentName:"li"},"required")," the password of the database, support declaring by environment variable ",(0,r.kt)("inlineCode",{parentName:"li"},"KUSION_BACKEND_MYSQL_PASSWORD")),(0,r.kt)("li",{parentName:"ul"},"host - ",(0,r.kt)("inlineCode",{parentName:"li"},"required")," the access address for the database"),(0,r.kt)("li",{parentName:"ul"},"port - ",(0,r.kt)("inlineCode",{parentName:"li"},"required")," the port of the database")),(0,r.kt)("p",null,"Note that the table name in the database used by Kusion is ",(0,r.kt)("strong",{parentName:"p"},"state"),". Below is an example SQL statement for creating this table:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sql"},"CREATE TABLE `state` (\n `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'primary key',\n `tenant` varchar(100) DEFAULT NULL COMMENT 'tenant',\n `project` varchar(100) NOT NULL COMMENT 'project',\n `kusion_version` varchar(50) DEFAULT NULL COMMENT 'kusion version',\n `version` int(10) unsigned NOT NULL COMMENT 'current state format version\uff0cmay upgrade in the future',\n `serial` bigint(20) unsigned NOT NULL DEFAULT '0' COMMENT 'modification times for state\uff0ccan be used in concurrent control',\n `operator` varchar(100) DEFAULT NULL COMMENT 'last modifier',\n `resources` longtext DEFAULT NULL COMMENT 'state of the resources\uff0cjson array',\n `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'creation time',\n `modified_time` timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT 'update time',\n `stack` varchar(100) DEFAULT NULL COMMENT 'stack',\n `cluster` varchar(100) DEFAULT NULL COMMENT 'logical isolation in a stack\uff0cusually clustername__cellname',\n PRIMARY KEY (`id`),\n UNIQUE KEY `uk_state_latest` (`tenant`, `project`, `stack`, `serial`, `cluster`),\n KEY `idx_tenant` (`tenant`),\n KEY `idx_project` (`project`),\n KEY `idx_kusion_version` (`kusion_version`),\n KEY `idx_version` (`version`),\n KEY `idx_create_time` (`create_time`),\n KEY `idx_modified_time` (`modified_time`),\n KEY `idx_stack` (`stack`),\n KEY `idx_cluster` (`cluster`)\n);\n")),(0,r.kt)("h3",{id:"oss"},"oss"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"oss")," storage type stores the ",(0,r.kt)("inlineCode",{parentName:"p"},"state")," on the ",(0,r.kt)("strong",{parentName:"p"},"Alicloud Object Storage Service (OSS)"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"# workspace configuration file\nbackends:\n oss:\n endpoint: \n bucket: \n accessKeyID: \n access-key-secret: \n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# environment variables\nexport OSS_ACCESS_KEY_ID=\nexport OSS_ACCESS_KEY_SECRET=\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"# command line parameters\nkusion apply --backend-type oss -C endpoint= -C bucket= -C accessKeyID= -C accessKeySecret=\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"endpoint - ",(0,r.kt)("inlineCode",{parentName:"li"},"required")," specify the access endpoint for alicloud oss bucket"),(0,r.kt)("li",{parentName:"ul"},"bucket - ",(0,r.kt)("inlineCode",{parentName:"li"},"required")," specify the name of the alicloud oss bucket"),(0,r.kt)("li",{parentName:"ul"},"accessKeyID - ",(0,r.kt)("inlineCode",{parentName:"li"},"required")," specify the alicloud account accessKeyID, support declaring by environment variable ",(0,r.kt)("inlineCode",{parentName:"li"},"OSS_ACCESS_KEY_ID")),(0,r.kt)("li",{parentName:"ul"},"accessKeySecret - ",(0,r.kt)("inlineCode",{parentName:"li"},"required")," specify the alicloud account accessKeySecret, support declaring by environment variable ",(0,r.kt)("inlineCode",{parentName:"li"},"OSS_ACCESS_KEY_SECRET"))),(0,r.kt)("h3",{id:"s3"},"s3"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"s3")," storage type stores the ",(0,r.kt)("inlineCode",{parentName:"p"},"state")," on the ",(0,r.kt)("strong",{parentName:"p"},"AWS Simple Storage Service (S3)"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"# workspace configuration file\nbackend: \n s3:\n endpoint: \n bucket: \n accessKeyID: \n access-key-secret: \n region: \n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# environment variables\nexport AWS_ACCESS_KEY_ID=\nexport AWS_SECRET_ACCESS_KEY=\nexport AWS_REGION=\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"# command line parameters\nkusion apply --backend-type s3 -C endpoint= -C bucket= -C accessKeyID= -C accessKeySecret= -C region=\n")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"endpoint - ",(0,r.kt)("inlineCode",{parentName:"li"},"optional")," specify the access endpoint for aws s3 bucket"),(0,r.kt)("li",{parentName:"ul"},"bucket - ",(0,r.kt)("inlineCode",{parentName:"li"},"required")," specify the name of the aws s3 bucket"),(0,r.kt)("li",{parentName:"ul"},"accessKeyID - ",(0,r.kt)("inlineCode",{parentName:"li"},"required")," specify the aws account accessKeyID, support declaring by environment variable ",(0,r.kt)("inlineCode",{parentName:"li"},"AWS_ACCESS_KEY_ID")),(0,r.kt)("li",{parentName:"ul"},"accessKeySecret - ",(0,r.kt)("inlineCode",{parentName:"li"},"required")," specify the aws account accessKeySecret, support declaring by environment variable ",(0,r.kt)("inlineCode",{parentName:"li"},"AWS_SECRET_ACCESS_KEY")),(0,r.kt)("li",{parentName:"ul"},"region - ",(0,r.kt)("inlineCode",{parentName:"li"},"required")," specify the region of aws s3 bucket, support declaring by environment variable ",(0,r.kt)("inlineCode",{parentName:"li"},"AWS_DEFAULT_REGION")," or ",(0,r.kt)("inlineCode",{parentName:"li"},"AWS_REGION"))))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/385397a2.8bb89edc.js b/assets/js/385397a2.a6296923.js similarity index 54% rename from assets/js/385397a2.8bb89edc.js rename to assets/js/385397a2.a6296923.js index c74cf219e29..438b5d10cfd 100644 --- a/assets/js/385397a2.8bb89edc.js +++ b/assets/js/385397a2.a6296923.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[995],{3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>d});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),m=p(r),d=a,f=m["".concat(i,".").concat(d)]||m[d]||c[d]||o;return r?n.createElement(f,l(l({ref:t},u),{},{components:r})):n.createElement(f,l({ref:t},u))}));function d(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=m;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,l[1]=s;for(var p=2;p{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var n=r(87462),a=(r(67294),r(3905));const o={},l="opsrule",s={unversionedId:"reference/modules/workspace-configs/opsrule/opsrule",id:"reference/modules/workspace-configs/opsrule/opsrule",title:"opsrule",description:"opsrule can be used to define workspace-level operational rule configurations.",source:"@site/docs/kusion/6-reference/2-modules/2-workspace-configs/opsrule/opsrule.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/opsrule",slug:"/reference/modules/workspace-configs/opsrule/",permalink:"/docs/next/reference/modules/workspace-configs/opsrule/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/2-workspace-configs/opsrule/opsrule.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"network",permalink:"/docs/next/reference/modules/workspace-configs/networking/network"},next:{title:"job",permalink:"/docs/next/reference/modules/workspace-configs/workload/job"}},i={},p=[{value:"Attributes",id:"attributes",level:2},{value:"Examples",id:"examples",level:3}],u={toc:p};function c(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"opsrule"},"opsrule"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"opsrule")," can be used to define workspace-level operational rule configurations."),(0,a.kt)("h2",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"maxUnavailable"),(0,a.kt)("br",null),"The maximum percentage of the total pod instances in the component that can be",(0,a.kt)("br",null),"simultaneously unhealthy."),(0,a.kt)("td",{parentName:"tr",align:null},"int ","|"," str"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n kusionstack/opsrule@0.1.0:\n default:\n maxUnavailable: "40%"\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[995],{3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},u=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=p(r),m=a,f=d["".concat(i,".").concat(m)]||d[m]||c[m]||o;return r?n.createElement(f,l(l({ref:t},u),{},{components:r})):n.createElement(f,l({ref:t},u))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=d;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,l[1]=s;for(var p=2;p{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var n=r(87462),a=(r(67294),r(3905));const o={},l="opsrule",s={unversionedId:"reference/modules/workspace-configs/opsrule/opsrule",id:"reference/modules/workspace-configs/opsrule/opsrule",title:"opsrule",description:"opsrule can be used to define workspace-level operational rule configurations.",source:"@site/docs/kusion/6-reference/2-modules/2-workspace-configs/opsrule/opsrule.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/opsrule",slug:"/reference/modules/workspace-configs/opsrule/",permalink:"/docs/next/reference/modules/workspace-configs/opsrule/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/2-workspace-configs/opsrule/opsrule.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"network",permalink:"/docs/next/reference/modules/workspace-configs/networking/network"},next:{title:"job",permalink:"/docs/next/reference/modules/workspace-configs/workload/job"}},i={},p=[{value:"Attributes",id:"attributes",level:2},{value:"Examples",id:"examples",level:3}],u={toc:p};function c(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"opsrule"},"opsrule"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"opsrule")," can be used to define workspace-level operational rule configurations."),(0,a.kt)("h2",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"maxUnavailable"),(0,a.kt)("br",null),"The maximum percentage of the total pod instances in the component that can be",(0,a.kt)("br",null),"simultaneously unhealthy."),(0,a.kt)("td",{parentName:"tr",align:null},"int ","|"," str"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n kusionstack/opsrule@0.1.0:\n default:\n maxUnavailable: "40%"\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/386fece6.0b6a6574.js b/assets/js/386fece6.092f735d.js similarity index 53% rename from assets/js/386fece6.0b6a6574.js rename to assets/js/386fece6.092f735d.js index 916f5816e53..8accd1b801b 100644 --- a/assets/js/386fece6.0b6a6574.js +++ b/assets/js/386fece6.092f735d.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5195],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},l=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,l=a(e,["components","mdxType","originalType","parentName"]),f=p(n),m=o,d=f["".concat(c,".").concat(m)]||f[m]||u[m]||i;return n?r.createElement(d,s(s({ref:t},l),{},{components:n})):r.createElement(d,s({ref:t},l))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,s=new Array(i);s[0]=f;var a={};for(var c in t)hasOwnProperty.call(t,c)&&(a[c]=t[c]);a.originalType=e,a.mdxType="string"==typeof e?e:o,s[1]=a;for(var p=2;p{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>i,metadata:()=>a,toc:()=>p});var r=n(87462),o=(n(67294),n(3905));const i={},s="kusion config set",a={unversionedId:"reference/commands/kusion-config-set",id:"version-v0.11/reference/commands/kusion-config-set",title:"kusion config set",description:"Set a config item",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-config-set.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-config-set",permalink:"/docs/reference/commands/kusion-config-set",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-config-set.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion config list",permalink:"/docs/reference/commands/kusion-config-list"},next:{title:"kusion config unset",permalink:"/docs/reference/commands/kusion-config-unset"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-config-set"},"kusion config set"),(0,o.kt)("p",null,"Set a config item"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command sets the value of a specified kusion config item, where the config item must be registered, and the value must be in valid type."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion config set\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' # Set a config item with string type value\n kusion config set backends.current mysql-pre\n \n # Set a config item with int type value\n kusion config set backends.mysql-pre.configs.port 3306\n \n # Set a config item with struct or map type value\n kusion config set backends.mysql-pre.configs \'{"dbName":"kusion","user":"kk","host":"127.0.0.1","port":3306}\'\n')),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for set\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-config"},"kusion config"),"\t - Interact with the Kusion config")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5195],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},l=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,l=a(e,["components","mdxType","originalType","parentName"]),f=p(n),m=o,d=f["".concat(c,".").concat(m)]||f[m]||u[m]||i;return n?r.createElement(d,s(s({ref:t},l),{},{components:n})):r.createElement(d,s({ref:t},l))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,s=new Array(i);s[0]=f;var a={};for(var c in t)hasOwnProperty.call(t,c)&&(a[c]=t[c]);a.originalType=e,a.mdxType="string"==typeof e?e:o,s[1]=a;for(var p=2;p{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>i,metadata:()=>a,toc:()=>p});var r=n(87462),o=(n(67294),n(3905));const i={},s="kusion config set",a={unversionedId:"reference/commands/kusion-config-set",id:"version-v0.11/reference/commands/kusion-config-set",title:"kusion config set",description:"Set a config item",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-config-set.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-config-set",permalink:"/docs/reference/commands/kusion-config-set",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-config-set.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion config list",permalink:"/docs/reference/commands/kusion-config-list"},next:{title:"kusion config unset",permalink:"/docs/reference/commands/kusion-config-unset"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-config-set"},"kusion config set"),(0,o.kt)("p",null,"Set a config item"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command sets the value of a specified kusion config item, where the config item must be registered, and the value must be in valid type."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion config set\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' # Set a config item with string type value\n kusion config set backends.current mysql-pre\n \n # Set a config item with int type value\n kusion config set backends.mysql-pre.configs.port 3306\n \n # Set a config item with struct or map type value\n kusion config set backends.mysql-pre.configs \'{"dbName":"kusion","user":"kk","host":"127.0.0.1","port":3306}\'\n')),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for set\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-config"},"kusion config"),"\t - Interact with the Kusion config")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/38900147.30d2af4f.js b/assets/js/38900147.30d2af4f.js new file mode 100644 index 00000000000..3fb18766354 --- /dev/null +++ b/assets/js/38900147.30d2af4f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5601],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var r=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,l=e.parentName,p=a(e,["components","mdxType","originalType","parentName"]),d=c(n),f=i,v=d["".concat(l,".").concat(f)]||d[f]||u[f]||o;return n?r.createElement(v,s(s({ref:t},p),{},{components:n})):r.createElement(v,s({ref:t},p))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,s=new Array(o);s[0]=d;var a={};for(var l in t)hasOwnProperty.call(t,l)&&(a[l]=t[l]);a.originalType=e,a.mdxType="string"==typeof e?e:i,s[1]=a;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>a,toc:()=>c});var r=n(87462),i=(n(67294),n(3905));const o={},s="kusion preview",a={unversionedId:"reference/cli/kusion/kusion_preview",id:"version-v0.9/reference/cli/kusion/kusion_preview",title:"kusion preview",description:"Preview a series of resource changes within the stack",source:"@site/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_preview.md",sourceDirName:"reference/cli/kusion",slug:"/reference/cli/kusion/kusion_preview",permalink:"/docs/v0.9/reference/cli/kusion/kusion_preview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_preview.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion init",permalink:"/docs/v0.9/reference/cli/kusion/kusion_init"},next:{title:"kusion version",permalink:"/docs/v0.9/reference/cli/kusion/kusion_version"}},l={},c=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 28-Sep-2023",id:"auto-generated-by-spf13cobra-on-28-sep-2023",level:6}],p={toc:c};function u(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"kusion-preview"},"kusion preview"),(0,i.kt)("p",null,"Preview a series of resource changes within the stack"),(0,i.kt)("h3",{id:"synopsis"},"Synopsis"),(0,i.kt)("p",null,"Preview a series of resource changes within the stack."),(0,i.kt)("p",null," Create or update or delete resources according to the KCL files within a stack. By default, Kusion will generate an execution plan and present it for your approval before taking any action."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"kusion preview [flags]\n")),(0,i.kt)("h3",{id:"examples"},"Examples"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},' # Preview with specifying work directory\n kusion preview -w /path/to/workdir\n \n # Preview with specifying arguments\n kusion preview -D name=test -D age=18\n \n # Preview with specifying setting file\n kusion preview -Y settings.yaml\n \n # Preview with specifying spec file\n kusion preview --spec-file spec.yaml\n \n # Preview with ignored fields\n kusion preview --ignore-fields="metadata.generation,metadata.managedFields\n \n # Preview with json format result\n kusion preview -o json\n \n # Preview without output style and color\n kusion preview --no-style=true\n')),(0,i.kt)("h3",{id:"options"},"Options"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"}," -a, --all --detail Automatically show all plan details, combined use with flag --detail\n -D, --argument stringToString Specify the top-level argument (default [])\n -C, --backend-config strings backend-config config state storage backend\n --backend-type string backend-type specify state storage backend\n -d, --detail Automatically show plan details with interactive options\n -h, --help help for preview\n --ignore-fields strings Ignore differences of target fields\n --no-style no-style sets to RawOutput mode and disables all of styling\n --operator string Specify the operator\n -o, --output string Specify the output format\n -O, --overrides strings Specify the configuration override path and value\n -Y, --setting strings Specify the command line setting files\n --spec-file string Specify the spec file path as input, and the spec file must be located in the working directory or its subdirectories\n -w, --workdir string Specify the work directory\n")),(0,i.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/docs/v0.9/reference/cli/kusion/"},"kusion"),"\t - Kusion is the platform engineering engine of KusionStack")),(0,i.kt)("h6",{id:"auto-generated-by-spf13cobra-on-28-sep-2023"},"Auto generated by spf13/cobra on 28-Sep-2023"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/38900147.9b2f5f1c.js b/assets/js/38900147.9b2f5f1c.js deleted file mode 100644 index 3873fa54652..00000000000 --- a/assets/js/38900147.9b2f5f1c.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5601],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var r=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,l=e.parentName,p=a(e,["components","mdxType","originalType","parentName"]),d=c(n),f=i,v=d["".concat(l,".").concat(f)]||d[f]||u[f]||o;return n?r.createElement(v,s(s({ref:t},p),{},{components:n})):r.createElement(v,s({ref:t},p))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,s=new Array(o);s[0]=d;var a={};for(var l in t)hasOwnProperty.call(t,l)&&(a[l]=t[l]);a.originalType=e,a.mdxType="string"==typeof e?e:i,s[1]=a;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>u,frontMatter:()=>o,metadata:()=>a,toc:()=>c});var r=n(87462),i=(n(67294),n(3905));const o={},s="kusion preview",a={unversionedId:"reference/cli/kusion/kusion_preview",id:"version-v0.9/reference/cli/kusion/kusion_preview",title:"kusion preview",description:"Preview a series of resource changes within the stack",source:"@site/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_preview.md",sourceDirName:"reference/cli/kusion",slug:"/reference/cli/kusion/kusion_preview",permalink:"/docs/v0.9/reference/cli/kusion/kusion_preview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_preview.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion init",permalink:"/docs/v0.9/reference/cli/kusion/kusion_init"},next:{title:"kusion version",permalink:"/docs/v0.9/reference/cli/kusion/kusion_version"}},l={},c=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 28-Sep-2023",id:"auto-generated-by-spf13cobra-on-28-sep-2023",level:6}],p={toc:c};function u(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"kusion-preview"},"kusion preview"),(0,i.kt)("p",null,"Preview a series of resource changes within the stack"),(0,i.kt)("h3",{id:"synopsis"},"Synopsis"),(0,i.kt)("p",null,"Preview a series of resource changes within the stack."),(0,i.kt)("p",null," Create or update or delete resources according to the KCL files within a stack. By default, Kusion will generate an execution plan and present it for your approval before taking any action."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"kusion preview [flags]\n")),(0,i.kt)("h3",{id:"examples"},"Examples"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},' # Preview with specifying work directory\n kusion preview -w /path/to/workdir\n \n # Preview with specifying arguments\n kusion preview -D name=test -D age=18\n \n # Preview with specifying setting file\n kusion preview -Y settings.yaml\n \n # Preview with specifying spec file\n kusion preview --spec-file spec.yaml\n \n # Preview with ignored fields\n kusion preview --ignore-fields="metadata.generation,metadata.managedFields\n \n # Preview with json format result\n kusion preview -o json\n \n # Preview without output style and color\n kusion preview --no-style=true\n')),(0,i.kt)("h3",{id:"options"},"Options"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"}," -a, --all --detail Automatically show all plan details, combined use with flag --detail\n -D, --argument stringToString Specify the top-level argument (default [])\n -C, --backend-config strings backend-config config state storage backend\n --backend-type string backend-type specify state storage backend\n -d, --detail Automatically show plan details with interactive options\n -h, --help help for preview\n --ignore-fields strings Ignore differences of target fields\n --no-style no-style sets to RawOutput mode and disables all of styling\n --operator string Specify the operator\n -o, --output string Specify the output format\n -O, --overrides strings Specify the configuration override path and value\n -Y, --setting strings Specify the command line setting files\n --spec-file string Specify the spec file path as input, and the spec file must be located in the working directory or its subdirectories\n -w, --workdir string Specify the work directory\n")),(0,i.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/docs/v0.9/reference/cli/kusion/"},"kusion"),"\t - Kusion is the platform engineering engine of KusionStack")),(0,i.kt)("h6",{id:"auto-generated-by-spf13cobra-on-28-sep-2023"},"Auto generated by spf13/cobra on 28-Sep-2023"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/389ba035.4e81bd6b.js b/assets/js/389ba035.4e81bd6b.js new file mode 100644 index 00000000000..05193fa4611 --- /dev/null +++ b/assets/js/389ba035.4e81bd6b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7386],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=c(r),m=a,k=d["".concat(s,".").concat(m)]||d[m]||u[m]||l;return r?n.createElement(k,o(o({ref:t},p),{},{components:r})):n.createElement(k,o({ref:t},p))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var c=2;c{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>l,metadata:()=>i,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const l={},o="service",i={unversionedId:"reference/modules/workspace-configs/workload/service",id:"version-v0.10/reference/modules/workspace-configs/workload/service",title:"service",description:"service can be used to define workspace-level service configuration.",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/workload/service.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/workload",slug:"/reference/modules/workspace-configs/workload/service",permalink:"/docs/v0.10/reference/modules/workspace-configs/workload/service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/workload/service.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"job",permalink:"/docs/v0.10/reference/modules/workspace-configs/workload/job"},next:{title:"Resource Naming Conventions",permalink:"/docs/v0.10/reference/modules/naming-conventions"}},s={},c=[{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:c};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"service"},"service"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"service")," can be used to define workspace-level service configuration."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"replicas"),(0,a.kt)("br",null),"Number of container replicas based on this configuration that should be ran."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"2"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels"),(0,a.kt)("br",null),"Labels are key/value pairs that are attached to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations"),(0,a.kt)("br",null),"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"type"),(0,a.kt)("br",null),"Type represents the type of workload used by this Service. Currently, it supports several",(0,a.kt)("br",null),"types, including Deployment and CollaSet."),(0,a.kt)("td",{parentName:"tr",align:null},'"Deployment" ',"|",' "CollaSet"'),(0,a.kt)("td",{parentName:"tr",align:null},"Deployment"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n service:\n default:\n replicas: 3\n labels:\n label-key: label-value\n annotations:\n annotation-key: annotation-value\n type: CollaSet\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/389ba035.951fd21a.js b/assets/js/389ba035.951fd21a.js deleted file mode 100644 index e5327075ae7..00000000000 --- a/assets/js/389ba035.951fd21a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7386],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=c(r),m=a,k=d["".concat(s,".").concat(m)]||d[m]||u[m]||l;return r?n.createElement(k,o(o({ref:t},p),{},{components:r})):n.createElement(k,o({ref:t},p))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var c=2;c{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>l,metadata:()=>i,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const l={},o="service",i={unversionedId:"reference/modules/workspace-configs/workload/service",id:"version-v0.10/reference/modules/workspace-configs/workload/service",title:"service",description:"service can be used to define workspace-level service configuration.",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/workload/service.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/workload",slug:"/reference/modules/workspace-configs/workload/service",permalink:"/docs/v0.10/reference/modules/workspace-configs/workload/service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/workload/service.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"job",permalink:"/docs/v0.10/reference/modules/workspace-configs/workload/job"},next:{title:"Resource Naming Conventions",permalink:"/docs/v0.10/reference/modules/naming-conventions"}},s={},c=[{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:c};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"service"},"service"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"service")," can be used to define workspace-level service configuration."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"replicas"),(0,a.kt)("br",null),"Number of container replicas based on this configuration that should be ran."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"2"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels"),(0,a.kt)("br",null),"Labels are key/value pairs that are attached to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations"),(0,a.kt)("br",null),"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"type"),(0,a.kt)("br",null),"Type represents the type of workload used by this Service. Currently, it supports several",(0,a.kt)("br",null),"types, including Deployment and CollaSet."),(0,a.kt)("td",{parentName:"tr",align:null},'"Deployment" ',"|",' "CollaSet"'),(0,a.kt)("td",{parentName:"tr",align:null},"Deployment"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n service:\n default:\n replicas: 3\n labels:\n label-key: label-value\n annotations:\n annotation-key: annotation-value\n type: CollaSet\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3ab8bb90.a84f7ca5.js b/assets/js/3ab8bb90.a84f7ca5.js deleted file mode 100644 index 178487eb46e..00000000000 --- a/assets/js/3ab8bb90.a84f7ca5.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3257],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>u});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),s=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},d=function(e){var t=s(e.components);return n.createElement(i.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),m=s(r),u=a,k=m["".concat(i,".").concat(u)]||m[u]||c[u]||l;return r?n.createElement(k,o(o({ref:t},d),{},{components:r})):n.createElement(k,o({ref:t},d))}));function u(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=m;var p={};for(var i in t)hasOwnProperty.call(t,i)&&(p[i]=t[i]);p.originalType=e,p.mdxType="string"==typeof e?e:a,o[1]=p;for(var s=2;s{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>c,frontMatter:()=>l,metadata:()=>p,toc:()=>s});var n=r(87462),a=(r(67294),r(3905));const l={},o="network",p={unversionedId:"reference/modules/developer-schemas/network/network",id:"reference/modules/developer-schemas/network/network",title:"network",description:"Schema Network",source:"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/network/network.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/network",slug:"/reference/modules/developer-schemas/network/",permalink:"/docs/next/reference/modules/developer-schemas/network/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/1-developer-schemas/network/network.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"prometheus",permalink:"/docs/next/reference/modules/developer-schemas/monitoring/prometheus"},next:{title:"opsrule",permalink:"/docs/next/reference/modules/developer-schemas/opsrule/"}},i={},s=[{value:"Schema Network",id:"schema-network",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Schema Port",id:"schema-port",level:2},{value:"Examples",id:"examples-1",level:3}],d={toc:s};function c(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"network"},"network"),(0,a.kt)("h2",{id:"schema-network"},"Schema Network"),(0,a.kt)("p",null,"Network defines the exposed port of Service, which can be used to describe how the Service",(0,a.kt)("br",null),"get accessed."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"ports")),(0,a.kt)("td",{parentName:"tr",align:null},"[",(0,a.kt)("a",{parentName:"td",href:"#schema-port"},"Port"),"]"),(0,a.kt)("td",{parentName:"tr",align:null},"The list of ports which the Workload should get exposed."),(0,a.kt)("td",{parentName:"tr",align:null})))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import network as n\n\n"network": n.Network {\n ports: [\n n.Port {\n port: 80\n public: True\n }\n ]\n}\n')),(0,a.kt)("h2",{id:"schema-port"},"Schema Port"),(0,a.kt)("p",null,"Port defines the exposed port of Workload, which can be used to describe how the Workload get accessed."),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"port")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"The exposed port of the Workload."),(0,a.kt)("td",{parentName:"tr",align:null},"80")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"protocol")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},'"TCP"'),(0,a.kt)("td",{parentName:"tr",align:null},'"UDP"'),(0,a.kt)("td",{parentName:"tr",align:null},"The protocol to access the port.")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"public")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},"bool"),(0,a.kt)("td",{parentName:"tr",align:null},"Public defines whether the port can be accessed through Internet."),(0,a.kt)("td",{parentName:"tr",align:null},"False")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"targetPort")),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"The backend container port. If empty, set it the same as the port."),(0,a.kt)("td",{parentName:"tr",align:null})))),(0,a.kt)("h3",{id:"examples-1"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import network as n\n\nport = n.Port {\n port: 80\n targetPort: 8080\n protocol: "TCP"\n public: True\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3ab8bb90.b62d3cca.js b/assets/js/3ab8bb90.b62d3cca.js new file mode 100644 index 00000000000..0759839be2e --- /dev/null +++ b/assets/js/3ab8bb90.b62d3cca.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3257],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),s=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},d=function(e){var t=s(e.components);return n.createElement(i.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),u=s(r),m=a,k=u["".concat(i,".").concat(m)]||u[m]||c[m]||l;return r?n.createElement(k,o(o({ref:t},d),{},{components:r})):n.createElement(k,o({ref:t},d))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=u;var p={};for(var i in t)hasOwnProperty.call(t,i)&&(p[i]=t[i]);p.originalType=e,p.mdxType="string"==typeof e?e:a,o[1]=p;for(var s=2;s{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>c,frontMatter:()=>l,metadata:()=>p,toc:()=>s});var n=r(87462),a=(r(67294),r(3905));const l={},o="network",p={unversionedId:"reference/modules/developer-schemas/network/network",id:"reference/modules/developer-schemas/network/network",title:"network",description:"Schema Network",source:"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/network/network.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/network",slug:"/reference/modules/developer-schemas/network/",permalink:"/docs/next/reference/modules/developer-schemas/network/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/1-developer-schemas/network/network.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"prometheus",permalink:"/docs/next/reference/modules/developer-schemas/monitoring/prometheus"},next:{title:"opsrule",permalink:"/docs/next/reference/modules/developer-schemas/opsrule/"}},i={},s=[{value:"Schema Network",id:"schema-network",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Schema Port",id:"schema-port",level:2},{value:"Examples",id:"examples-1",level:3}],d={toc:s};function c(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"network"},"network"),(0,a.kt)("h2",{id:"schema-network"},"Schema Network"),(0,a.kt)("p",null,"Network defines the exposed port of Service, which can be used to describe how the Service",(0,a.kt)("br",null),"get accessed."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"ports")),(0,a.kt)("td",{parentName:"tr",align:null},"[",(0,a.kt)("a",{parentName:"td",href:"#schema-port"},"Port"),"]"),(0,a.kt)("td",{parentName:"tr",align:null},"The list of ports which the Workload should get exposed."),(0,a.kt)("td",{parentName:"tr",align:null})))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import network as n\n\n"network": n.Network {\n ports: [\n n.Port {\n port: 80\n public: True\n }\n ]\n}\n')),(0,a.kt)("h2",{id:"schema-port"},"Schema Port"),(0,a.kt)("p",null,"Port defines the exposed port of Workload, which can be used to describe how the Workload get accessed."),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"port")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"The exposed port of the Workload."),(0,a.kt)("td",{parentName:"tr",align:null},"80")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"protocol")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},'"TCP"'),(0,a.kt)("td",{parentName:"tr",align:null},'"UDP"'),(0,a.kt)("td",{parentName:"tr",align:null},"The protocol to access the port.")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"public")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},"bool"),(0,a.kt)("td",{parentName:"tr",align:null},"Public defines whether the port can be accessed through Internet."),(0,a.kt)("td",{parentName:"tr",align:null},"False")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"targetPort")),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"The backend container port. If empty, set it the same as the port."),(0,a.kt)("td",{parentName:"tr",align:null})))),(0,a.kt)("h3",{id:"examples-1"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import network as n\n\nport = n.Port {\n port: 80\n targetPort: 8080\n protocol: "TCP"\n public: True\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3c3bc024.7d0384fb.js b/assets/js/3c3bc024.7d0384fb.js deleted file mode 100644 index 4f759c2a7a1..00000000000 --- a/assets/js/3c3bc024.7d0384fb.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[617],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,k=d["".concat(s,".").concat(m)]||d[m]||u[m]||l;return n?r.createElement(k,o(o({ref:t},p),{},{components:n})):r.createElement(k,o({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,o=new Array(l);o[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>l,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const l={},o="service",i={unversionedId:"reference/modules/workspace-configs/workload/service",id:"reference/modules/workspace-configs/workload/service",title:"service",description:"service can be used to define workspace-level service configuration.",source:"@site/docs/kusion/6-reference/2-modules/2-workspace-configs/workload/service.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/workload",slug:"/reference/modules/workspace-configs/workload/service",permalink:"/docs/next/reference/modules/workspace-configs/workload/service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/2-workspace-configs/workload/service.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"job",permalink:"/docs/next/reference/modules/workspace-configs/workload/job"},next:{title:"Resource Naming Conventions",permalink:"/docs/next/reference/modules/naming-conventions"}},s={},c=[{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:c};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"service"},"service"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"service")," can be used to define workspace-level service configuration."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"replicas"),(0,a.kt)("br",null),"Number of container replicas based on this configuration that should be ran."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"2"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels"),(0,a.kt)("br",null),"Labels are key/value pairs that are attached to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations"),(0,a.kt)("br",null),"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"type"),(0,a.kt)("br",null),"Type represents the type of workload used by this Service. Currently, it supports several",(0,a.kt)("br",null),"types, including Deployment and CollaSet."),(0,a.kt)("td",{parentName:"tr",align:null},'"Deployment" ',"|",' "CollaSet"'),(0,a.kt)("td",{parentName:"tr",align:null},"Deployment"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n service:\n default:\n replicas: 3\n labels:\n label-key: label-value\n annotations:\n annotation-key: annotation-value\n type: CollaSet\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3c3bc024.84151040.js b/assets/js/3c3bc024.84151040.js new file mode 100644 index 00000000000..2d643448549 --- /dev/null +++ b/assets/js/3c3bc024.84151040.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[617],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,k=d["".concat(s,".").concat(m)]||d[m]||u[m]||l;return n?r.createElement(k,o(o({ref:t},p),{},{components:n})):r.createElement(k,o({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,o=new Array(l);o[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>l,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const l={},o="service",i={unversionedId:"reference/modules/workspace-configs/workload/service",id:"reference/modules/workspace-configs/workload/service",title:"service",description:"service can be used to define workspace-level service configuration.",source:"@site/docs/kusion/6-reference/2-modules/2-workspace-configs/workload/service.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/workload",slug:"/reference/modules/workspace-configs/workload/service",permalink:"/docs/next/reference/modules/workspace-configs/workload/service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/2-workspace-configs/workload/service.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"job",permalink:"/docs/next/reference/modules/workspace-configs/workload/job"},next:{title:"Resource Naming Conventions",permalink:"/docs/next/reference/modules/naming-conventions"}},s={},c=[{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:c};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"service"},"service"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"service")," can be used to define workspace-level service configuration."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"replicas"),(0,a.kt)("br",null),"Number of container replicas based on this configuration that should be ran."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"2"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels"),(0,a.kt)("br",null),"Labels are key/value pairs that are attached to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations"),(0,a.kt)("br",null),"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"type"),(0,a.kt)("br",null),"Type represents the type of workload used by this Service. Currently, it supports several",(0,a.kt)("br",null),"types, including Deployment and CollaSet."),(0,a.kt)("td",{parentName:"tr",align:null},'"Deployment" ',"|",' "CollaSet"'),(0,a.kt)("td",{parentName:"tr",align:null},"Deployment"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n service:\n default:\n replicas: 3\n labels:\n label-key: label-value\n annotations:\n annotation-key: annotation-value\n type: CollaSet\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3de1edc5.1527b90a.js b/assets/js/3de1edc5.1527b90a.js new file mode 100644 index 00000000000..86353de5219 --- /dev/null +++ b/assets/js/3de1edc5.1527b90a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3190],{3905:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>u});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),d=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},m=function(e){var t=d(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,s=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),c=d(n),u=r,k=c["".concat(s,".").concat(u)]||c[u]||p[u]||l;return n?a.createElement(k,i(i({ref:t},m),{},{components:n})):a.createElement(k,i({ref:t},m))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,i=new Array(l);i[0]=c;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var d=2;d{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>l,metadata:()=>o,toc:()=>d});var a=n(87462),r=(n(67294),n(3905));const l={},i="container",o={unversionedId:"reference/modules/catalog-models/internal/container/container",id:"version-v0.10/reference/modules/catalog-models/internal/container/container",title:"container",description:"Schema Container",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/container/container.md",sourceDirName:"6-reference/2-modules/1-catalog-models/internal/container",slug:"/reference/modules/catalog-models/internal/container/",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/container/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/container/container.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"common",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/common"},next:{title:"lifecycle",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/container/lifecycle/"}},s={},d=[{value:"Schema Container",id:"schema-container",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Schema FileSpec",id:"schema-filespec",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3}],m={toc:d};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"container"},"container"),(0,r.kt)("h2",{id:"schema-container"},"Schema Container"),(0,r.kt)("p",null,"Container describes how the Application's tasks are expected to be run. Depending on",(0,r.kt)("br",null),"the replicas parameter 1 or more containers can be created from each template."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"image"),(0,r.kt)("br",null),"Image refers to the Docker image name to run for this container.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/images"},"https://kubernetes.io/docs/concepts/containers/images")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command"),(0,r.kt)("br",null),"Entrypoint array. Not executed within a shell.",(0,r.kt)("br",null),"Command will overwrite the ENTRYPOINT value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's ENTRYPOINT is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"args"),(0,r.kt)("br",null),"Arguments to the entrypoint.",(0,r.kt)("br",null),"Args will overwrite the CMD value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's CMD is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"env"),(0,r.kt)("br",null),"List of environment variables to set in the container.",(0,r.kt)("br",null),"The value of the environment variable may be static text or a value from a secret."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"workingDir"),(0,r.kt)("br",null),"The working directory of the running process defined in entrypoint.",(0,r.kt)("br",null),"Default container runtime will be used if this is not specified."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"resources"),(0,r.kt)("br",null),"Map of resource requirements the container should run with.",(0,r.kt)("br",null),"The resources parameter is a dict with the key being the resource name and the value being",(0,r.kt)("br",null),"the resource value."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"files"),(0,r.kt)("br",null),"List of files to create in the container.",(0,r.kt)("br",null),"The files parameter is a dict with the key being the file name in the container and the value",(0,r.kt)("br",null),"being the target file specification."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-filespec"},"container.FileSpec"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"dirs"),(0,r.kt)("br",null),"Collection of volumes mount into the container's filesystem.",(0,r.kt)("br",null),"The dirs parameter is a dict with the key being the folder name in the container and the value",(0,r.kt)("br",null),"being the referenced volume."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"livenessProbe"),(0,r.kt)("br",null),"LivenessProbe indicates if a running process is healthy.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/v0.10/reference/modules/catalog-models/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"readinessProbe"),(0,r.kt)("br",null),"ReadinessProbe indicates whether an application is available to handle requests."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/v0.10/reference/modules/catalog-models/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"startupProbe"),(0,r.kt)("br",null),"StartupProbe indicates that the container has started for the first time.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/v0.10/reference/modules/catalog-models/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"lifecycle"),(0,r.kt)("br",null),"Lifecycle refers to actions that the management system should take in response to container lifecycle events."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/v0.10/reference/modules/catalog-models/internal/container/lifecycle/#schema-lifecycle"},"lc.Lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container as c\n\nweb = c.Container {\n image: "nginx:latest"\n command: ["/bin/sh", "-c", "echo hi"]\n env: {\n "name": "value"\n }\n resources: {\n "cpu": "2"\n "memory": "4Gi"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-filespec"},"Schema FileSpec"),(0,r.kt)("p",null,"FileSpec defines the target file in a Container."),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"content"),(0,r.kt)("br",null),"File content in plain text."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"contentFrom"),(0,r.kt)("br",null),"Source for the file content, reference to a secret of configmap value."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"mode"),(0,r.kt)("br",null),"Mode bits used to set permissions on this file, must be an octal value",(0,r.kt)("br",null),"between 0000 and 0777 or a decimal value between 0 and 511"),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container as c\n\ntmpFile = c.FileSpec {\n content: "some file contents"\n mode: "0777"\n}\n')))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3de1edc5.271177f3.js b/assets/js/3de1edc5.271177f3.js deleted file mode 100644 index 84d9b1228b7..00000000000 --- a/assets/js/3de1edc5.271177f3.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3190],{3905:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>u});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),d=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},m=function(e){var t=d(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,s=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),c=d(n),u=r,k=c["".concat(s,".").concat(u)]||c[u]||p[u]||l;return n?a.createElement(k,i(i({ref:t},m),{},{components:n})):a.createElement(k,i({ref:t},m))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,i=new Array(l);i[0]=c;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var d=2;d{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>p,frontMatter:()=>l,metadata:()=>o,toc:()=>d});var a=n(87462),r=(n(67294),n(3905));const l={},i="container",o={unversionedId:"reference/modules/catalog-models/internal/container/container",id:"version-v0.10/reference/modules/catalog-models/internal/container/container",title:"container",description:"Schema Container",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/container/container.md",sourceDirName:"6-reference/2-modules/1-catalog-models/internal/container",slug:"/reference/modules/catalog-models/internal/container/",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/container/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/container/container.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"common",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/common"},next:{title:"lifecycle",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/container/lifecycle/"}},s={},d=[{value:"Schema Container",id:"schema-container",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Schema FileSpec",id:"schema-filespec",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3}],m={toc:d};function p(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"container"},"container"),(0,r.kt)("h2",{id:"schema-container"},"Schema Container"),(0,r.kt)("p",null,"Container describes how the Application's tasks are expected to be run. Depending on",(0,r.kt)("br",null),"the replicas parameter 1 or more containers can be created from each template."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"image"),(0,r.kt)("br",null),"Image refers to the Docker image name to run for this container.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/images"},"https://kubernetes.io/docs/concepts/containers/images")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command"),(0,r.kt)("br",null),"Entrypoint array. Not executed within a shell.",(0,r.kt)("br",null),"Command will overwrite the ENTRYPOINT value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's ENTRYPOINT is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"args"),(0,r.kt)("br",null),"Arguments to the entrypoint.",(0,r.kt)("br",null),"Args will overwrite the CMD value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's CMD is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"env"),(0,r.kt)("br",null),"List of environment variables to set in the container.",(0,r.kt)("br",null),"The value of the environment variable may be static text or a value from a secret."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"workingDir"),(0,r.kt)("br",null),"The working directory of the running process defined in entrypoint.",(0,r.kt)("br",null),"Default container runtime will be used if this is not specified."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"resources"),(0,r.kt)("br",null),"Map of resource requirements the container should run with.",(0,r.kt)("br",null),"The resources parameter is a dict with the key being the resource name and the value being",(0,r.kt)("br",null),"the resource value."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"files"),(0,r.kt)("br",null),"List of files to create in the container.",(0,r.kt)("br",null),"The files parameter is a dict with the key being the file name in the container and the value",(0,r.kt)("br",null),"being the target file specification."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-filespec"},"container.FileSpec"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"dirs"),(0,r.kt)("br",null),"Collection of volumes mount into the container's filesystem.",(0,r.kt)("br",null),"The dirs parameter is a dict with the key being the folder name in the container and the value",(0,r.kt)("br",null),"being the referenced volume."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"livenessProbe"),(0,r.kt)("br",null),"LivenessProbe indicates if a running process is healthy.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/v0.10/reference/modules/catalog-models/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"readinessProbe"),(0,r.kt)("br",null),"ReadinessProbe indicates whether an application is available to handle requests."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/v0.10/reference/modules/catalog-models/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"startupProbe"),(0,r.kt)("br",null),"StartupProbe indicates that the container has started for the first time.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/v0.10/reference/modules/catalog-models/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"lifecycle"),(0,r.kt)("br",null),"Lifecycle refers to actions that the management system should take in response to container lifecycle events."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/v0.10/reference/modules/catalog-models/internal/container/lifecycle/#schema-lifecycle"},"lc.Lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container as c\n\nweb = c.Container {\n image: "nginx:latest"\n command: ["/bin/sh", "-c", "echo hi"]\n env: {\n "name": "value"\n }\n resources: {\n "cpu": "2"\n "memory": "4Gi"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-filespec"},"Schema FileSpec"),(0,r.kt)("p",null,"FileSpec defines the target file in a Container."),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"content"),(0,r.kt)("br",null),"File content in plain text."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"contentFrom"),(0,r.kt)("br",null),"Source for the file content, reference to a secret of configmap value."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"mode"),(0,r.kt)("br",null),"Mode bits used to set permissions on this file, must be an octal value",(0,r.kt)("br",null),"between 0000 and 0777 or a decimal value between 0 and 511"),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container as c\n\ntmpFile = c.FileSpec {\n content: "some file contents"\n mode: "0777"\n}\n')))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3f78da0c.546f6f37.js b/assets/js/3f78da0c.546f6f37.js new file mode 100644 index 00000000000..b937421e0d2 --- /dev/null +++ b/assets/js/3f78da0c.546f6f37.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8356],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>u});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var i=n.createContext({}),d=function(e){var t=n.useContext(i),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},p=function(e){var t=d(e.components);return n.createElement(i.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),m=d(a),u=r,g=m["".concat(i,".").concat(u)]||m[u]||c[u]||o;return a?n.createElement(g,l(l({ref:t},p),{},{components:a})):n.createElement(g,l({ref:t},p))}));function u(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,l=new Array(o);l[0]=m;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:r,l[1]=s;for(var d=2;d{a.r(t),a.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>s,toc:()=>d});var n=a(87462),r=(a(67294),a(3905));const o={},l="postgres",s={unversionedId:"reference/modules/catalog-models/database/postgres",id:"version-v0.10/reference/modules/catalog-models/database/postgres",title:"postgres",description:"Schema PostgreSQL",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/database/postgres.md",sourceDirName:"6-reference/2-modules/1-catalog-models/database",slug:"/reference/modules/catalog-models/database/postgres",permalink:"/docs/v0.10/reference/modules/catalog-models/database/postgres",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/database/postgres.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"mysql",permalink:"/docs/v0.10/reference/modules/catalog-models/database/mysql"},next:{title:"common",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/common"}},i={},d=[{value:"Schema PostgreSQL",id:"schema-postgresql",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Credentials and Connectivity",id:"credentials-and-connectivity",level:3}],p={toc:d};function c(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"postgres"},"postgres"),(0,r.kt)("h2",{id:"schema-postgresql"},"Schema PostgreSQL"),(0,r.kt)("p",null,"PostgreSQL describes the attributes to locally deploy or create a cloud provider",(0,r.kt)("br",null),"managed postgresql database instance for the workload. "),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type"),(0,r.kt)("br",null),"Type defines whether the postgresql database is deployed locally or provided by",(0,r.kt)("br",null),"cloud vendor."),(0,r.kt)("td",{parentName:"tr",align:null},'"local" ',"|",' "cloud"'),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"version"),(0,r.kt)("br",null),"Version defines the mysql version to use."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'Instantiate a local postgresql database with image version of 14.0. \n\nimport catalog.models.schema.v1.accessories.postgres\n\npostgres: postgres.PostgreSQL {\n type: "local"\n version: "14.0"\n}\n')),(0,r.kt)("h3",{id:"credentials-and-connectivity"},"Credentials and Connectivity"),(0,r.kt)("p",null,"For sensitive information such as the ",(0,r.kt)("strong",{parentName:"p"},"host"),", ",(0,r.kt)("strong",{parentName:"p"},"username")," and ",(0,r.kt)("strong",{parentName:"p"},"password")," for the database instance, Kusion will automatically inject them into the application container for users through environment variables. The relevant environment variables are listed in the table below. "),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Explanation"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","HOST","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Host address for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","USERNAME","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Account username for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","PASSWORD","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Account password for accessing the database instance")))),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"")," is composed of two parts, one of which is the ",(0,r.kt)("inlineCode",{parentName:"p"},"key")," of database declared in ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," and the other is the ",(0,r.kt)("inlineCode",{parentName:"p"},"suffix")," declared in ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace")," configuration. Kusion will concatenate the database key and suffix, convert them to uppercase, and replace ",(0,r.kt)("inlineCode",{parentName:"p"},"-")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"_"),". And the ",(0,r.kt)("inlineCode",{parentName:"p"},"")," supported now includes ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"postgres"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3f78da0c.f5d61cbf.js b/assets/js/3f78da0c.f5d61cbf.js deleted file mode 100644 index 2daa1ebe3a9..00000000000 --- a/assets/js/3f78da0c.f5d61cbf.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8356],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>u});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var i=n.createContext({}),d=function(e){var t=n.useContext(i),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},p=function(e){var t=d(e.components);return n.createElement(i.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),m=d(a),u=r,g=m["".concat(i,".").concat(u)]||m[u]||c[u]||o;return a?n.createElement(g,l(l({ref:t},p),{},{components:a})):n.createElement(g,l({ref:t},p))}));function u(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,l=new Array(o);l[0]=m;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:r,l[1]=s;for(var d=2;d{a.r(t),a.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>s,toc:()=>d});var n=a(87462),r=(a(67294),a(3905));const o={},l="postgres",s={unversionedId:"reference/modules/catalog-models/database/postgres",id:"version-v0.10/reference/modules/catalog-models/database/postgres",title:"postgres",description:"Schema PostgreSQL",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/database/postgres.md",sourceDirName:"6-reference/2-modules/1-catalog-models/database",slug:"/reference/modules/catalog-models/database/postgres",permalink:"/docs/v0.10/reference/modules/catalog-models/database/postgres",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/database/postgres.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"mysql",permalink:"/docs/v0.10/reference/modules/catalog-models/database/mysql"},next:{title:"common",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/common"}},i={},d=[{value:"Schema PostgreSQL",id:"schema-postgresql",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Credentials and Connectivity",id:"credentials-and-connectivity",level:3}],p={toc:d};function c(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"postgres"},"postgres"),(0,r.kt)("h2",{id:"schema-postgresql"},"Schema PostgreSQL"),(0,r.kt)("p",null,"PostgreSQL describes the attributes to locally deploy or create a cloud provider",(0,r.kt)("br",null),"managed postgresql database instance for the workload. "),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type"),(0,r.kt)("br",null),"Type defines whether the postgresql database is deployed locally or provided by",(0,r.kt)("br",null),"cloud vendor."),(0,r.kt)("td",{parentName:"tr",align:null},'"local" ',"|",' "cloud"'),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"version"),(0,r.kt)("br",null),"Version defines the mysql version to use."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'Instantiate a local postgresql database with image version of 14.0. \n\nimport catalog.models.schema.v1.accessories.postgres\n\npostgres: postgres.PostgreSQL {\n type: "local"\n version: "14.0"\n}\n')),(0,r.kt)("h3",{id:"credentials-and-connectivity"},"Credentials and Connectivity"),(0,r.kt)("p",null,"For sensitive information such as the ",(0,r.kt)("strong",{parentName:"p"},"host"),", ",(0,r.kt)("strong",{parentName:"p"},"username")," and ",(0,r.kt)("strong",{parentName:"p"},"password")," for the database instance, Kusion will automatically inject them into the application container for users through environment variables. The relevant environment variables are listed in the table below. "),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Explanation"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","HOST","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Host address for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","USERNAME","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Account username for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","PASSWORD","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Account password for accessing the database instance")))),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"")," is composed of two parts, one of which is the ",(0,r.kt)("inlineCode",{parentName:"p"},"key")," of database declared in ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," and the other is the ",(0,r.kt)("inlineCode",{parentName:"p"},"suffix")," declared in ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace")," configuration. Kusion will concatenate the database key and suffix, convert them to uppercase, and replace ",(0,r.kt)("inlineCode",{parentName:"p"},"-")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"_"),". And the ",(0,r.kt)("inlineCode",{parentName:"p"},"")," supported now includes ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"postgres"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3ff7cb20.ce0dcfda.js b/assets/js/3ff7cb20.ce0dcfda.js new file mode 100644 index 00000000000..b958b62b683 --- /dev/null +++ b/assets/js/3ff7cb20.ce0dcfda.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3356],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>u});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function o(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),d=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},p=function(e){var t=d(e.components);return n.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),m=d(a),u=r,y=m["".concat(s,".").concat(u)]||m[u]||c[u]||l;return a?n.createElement(y,o(o({ref:t},p),{},{components:a})):n.createElement(y,o({ref:t},p))}));function u(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,o=new Array(l);o[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,o[1]=i;for(var d=2;d{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>c,frontMatter:()=>l,metadata:()=>i,toc:()=>d});var n=a(87462),r=(a(67294),a(3905));const l={},o="mysql",i={unversionedId:"reference/modules/catalog-models/database/mysql",id:"version-v0.10/reference/modules/catalog-models/database/mysql",title:"mysql",description:"Schema MySQL",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/database/mysql.md",sourceDirName:"6-reference/2-modules/1-catalog-models/database",slug:"/reference/modules/catalog-models/database/mysql",permalink:"/docs/v0.10/reference/modules/catalog-models/database/mysql",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/database/mysql.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"appconfiguration",permalink:"/docs/v0.10/reference/modules/catalog-models/app-configuration"},next:{title:"postgres",permalink:"/docs/v0.10/reference/modules/catalog-models/database/postgres"}},s={},d=[{value:"Schema MySQL",id:"schema-mysql",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Credentials and Connectivity",id:"credentials-and-connectivity",level:3}],p={toc:d};function c(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"mysql"},"mysql"),(0,r.kt)("h2",{id:"schema-mysql"},"Schema MySQL"),(0,r.kt)("p",null,"MySQL describes the attributes to locally deploy or create a cloud provider",(0,r.kt)("br",null),"managed mysql database instance for the workload. "),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type"),(0,r.kt)("br",null),"Type defines whether the mysql database is deployed locally or provided by ",(0,r.kt)("br",null),"cloud vendor."),(0,r.kt)("td",{parentName:"tr",align:null},'"local" ',"|",' "cloud"'),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"version"),(0,r.kt)("br",null),"Version defines the mysql version to use."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'Instantiate a local mysql database with version of 5.7. \n\nimport catalog.models.schema.v1.accessories.mysql\n\nmysql: mysql.MySQL {\n type: "local"\n version: "5.7"\n}\n')),(0,r.kt)("h3",{id:"credentials-and-connectivity"},"Credentials and Connectivity"),(0,r.kt)("p",null,"For sensitive information such as the ",(0,r.kt)("strong",{parentName:"p"},"host"),", ",(0,r.kt)("strong",{parentName:"p"},"username")," and ",(0,r.kt)("strong",{parentName:"p"},"password")," for the database instance, Kusion will automatically inject them into the application container for users through environment variables. The relevant environment variables are listed in the table below. "),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Explanation"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","HOST","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Host address for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","USERNAME","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Account username for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","PASSWORD","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Account password for accessing the database instance")))),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"")," is composed of two parts, one of which is the ",(0,r.kt)("inlineCode",{parentName:"p"},"key")," of database declared in ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," and the other is the ",(0,r.kt)("inlineCode",{parentName:"p"},"suffix")," declared in ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace")," configuration. Kusion will concatenate the database key and suffix, convert them to uppercase, and replace ",(0,r.kt)("inlineCode",{parentName:"p"},"-")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"_"),". And the ",(0,r.kt)("inlineCode",{parentName:"p"},"")," supported now includes ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"postgres"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3ff7cb20.d303ba5e.js b/assets/js/3ff7cb20.d303ba5e.js deleted file mode 100644 index d6d469f5d4c..00000000000 --- a/assets/js/3ff7cb20.d303ba5e.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3356],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>u});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function o(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),d=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},p=function(e){var t=d(e.components);return n.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),m=d(a),u=r,k=m["".concat(s,".").concat(u)]||m[u]||c[u]||l;return a?n.createElement(k,o(o({ref:t},p),{},{components:a})):n.createElement(k,o({ref:t},p))}));function u(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,o=new Array(l);o[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,o[1]=i;for(var d=2;d{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>c,frontMatter:()=>l,metadata:()=>i,toc:()=>d});var n=a(87462),r=(a(67294),a(3905));const l={},o="mysql",i={unversionedId:"reference/modules/catalog-models/database/mysql",id:"version-v0.10/reference/modules/catalog-models/database/mysql",title:"mysql",description:"Schema MySQL",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/database/mysql.md",sourceDirName:"6-reference/2-modules/1-catalog-models/database",slug:"/reference/modules/catalog-models/database/mysql",permalink:"/docs/v0.10/reference/modules/catalog-models/database/mysql",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/database/mysql.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"appconfiguration",permalink:"/docs/v0.10/reference/modules/catalog-models/app-configuration"},next:{title:"postgres",permalink:"/docs/v0.10/reference/modules/catalog-models/database/postgres"}},s={},d=[{value:"Schema MySQL",id:"schema-mysql",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Credentials and Connectivity",id:"credentials-and-connectivity",level:3}],p={toc:d};function c(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"mysql"},"mysql"),(0,r.kt)("h2",{id:"schema-mysql"},"Schema MySQL"),(0,r.kt)("p",null,"MySQL describes the attributes to locally deploy or create a cloud provider",(0,r.kt)("br",null),"managed mysql database instance for the workload. "),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type"),(0,r.kt)("br",null),"Type defines whether the mysql database is deployed locally or provided by ",(0,r.kt)("br",null),"cloud vendor."),(0,r.kt)("td",{parentName:"tr",align:null},'"local" ',"|",' "cloud"'),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"version"),(0,r.kt)("br",null),"Version defines the mysql version to use."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'Instantiate a local mysql database with version of 5.7. \n\nimport catalog.models.schema.v1.accessories.mysql\n\nmysql: mysql.MySQL {\n type: "local"\n version: "5.7"\n}\n')),(0,r.kt)("h3",{id:"credentials-and-connectivity"},"Credentials and Connectivity"),(0,r.kt)("p",null,"For sensitive information such as the ",(0,r.kt)("strong",{parentName:"p"},"host"),", ",(0,r.kt)("strong",{parentName:"p"},"username")," and ",(0,r.kt)("strong",{parentName:"p"},"password")," for the database instance, Kusion will automatically inject them into the application container for users through environment variables. The relevant environment variables are listed in the table below. "),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Explanation"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","HOST","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Host address for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","USERNAME","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Account username for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","PASSWORD","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Account password for accessing the database instance")))),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"")," is composed of two parts, one of which is the ",(0,r.kt)("inlineCode",{parentName:"p"},"key")," of database declared in ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," and the other is the ",(0,r.kt)("inlineCode",{parentName:"p"},"suffix")," declared in ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace")," configuration. Kusion will concatenate the database key and suffix, convert them to uppercase, and replace ",(0,r.kt)("inlineCode",{parentName:"p"},"-")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"_"),". And the ",(0,r.kt)("inlineCode",{parentName:"p"},"")," supported now includes ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"postgres"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/40870e5b.d9050fb9.js b/assets/js/40870e5b.d9050fb9.js deleted file mode 100644 index ef833e68eaf..00000000000 --- a/assets/js/40870e5b.d9050fb9.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4671],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>d});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),l=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return a.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),m=l(n),d=r,h=m["".concat(c,".").concat(d)]||m[d]||u[d]||o;return n?a.createElement(h,i(i({ref:t},p),{},{components:n})):a.createElement(h,i({ref:t},p))}));function d(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=m;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>l});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:7},i="Secret Management",s={unversionedId:"config-walkthrough/secret",id:"version-v0.9/config-walkthrough/secret",title:"Secret Management",description:"You can manage application secrets via the secrets attribute in the workload schema. Depending on the context of your application, this might include pieces of credentials required to access a third-party application.",source:"@site/docs_versioned_docs/version-v0.9/config-walkthrough/secret.md",sourceDirName:"config-walkthrough",slug:"/config-walkthrough/secret",permalink:"/docs/v0.9/config-walkthrough/secret",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/config-walkthrough/secret.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:7,frontMatter:{sidebar_position:7},sidebar:"kusion",previous:{title:"Managed Databases",permalink:"/docs/v0.9/config-walkthrough/database"},next:{title:"Application Monitoring",permalink:"/docs/v0.9/config-walkthrough/monitoring"}},c={},l=[{value:"Import",id:"import",level:2},{value:"Creating a secret",id:"creating-a-secret",level:2},{value:"Immutable secrets",id:"immutable-secrets",level:2}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"secret-management"},"Secret Management"),(0,r.kt)("p",null,"You can manage application secrets via the ",(0,r.kt)("inlineCode",{parentName:"p"},"secrets")," attribute in the ",(0,r.kt)("inlineCode",{parentName:"p"},"workload")," schema. Depending on the context of your application, this might include pieces of credentials required to access a third-party application."),(0,r.kt)("p",null,"If your application depends on any cloud resources that are managed by Kusion, their credentials are automatically managed by Kusion (generated and injected into application runtime environment variable). You shouldn't have to manually create those."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"If your application workloads are also running on the cloud, it's recommended to leverage identity-based keyless authentication as much as possible to minimize the nuisance of secret management. Application identities will be supported in a future version of Kusion.")),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"catalog")," package. For more details on KCL package import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.secret as sec\n")),(0,r.kt)("h2",{id:"creating-a-secret"},"Creating a secret"),(0,r.kt)("p",null,"As of version 0.9.0, Kusion supports creating secrets by turning the ",(0,r.kt)("inlineCode",{parentName:"p"},"secrets")," declared in the configuration files into Kubernetes secrets."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"As a general principle, storing secrets in a plain text configuration file is highly discouraged. The recommended approach is to store the secrets in a third-party vault (such as Hashicorp Vault, AWS Secrets Manager and KMS, Azure Key Vault, etc) and retrieve the secret in the runtime only.")),(0,r.kt)("p",null,"Create a secret with the type ",(0,r.kt)("inlineCode",{parentName:"p"},"Opaque"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "my-secret": sec.Secret {\n type: "opaque"\n data: {\n "hello": "world"\n "foo": "bar"\n }\n }\n }\n }\n}\n')),(0,r.kt)("p",null,"Create a secret with the type ",(0,r.kt)("inlineCode",{parentName:"p"},"kubernetes.io/basic-auth"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "my-secret": sec.Secret {\n type: "basic"\n data: {\n "username": "admin"\n "password": "******"\n }\n }\n }\n }\n}\n')),(0,r.kt)("p",null,"When creating a ",(0,r.kt)("inlineCode",{parentName:"p"},"kubernetes.io/basic-auth")," type secret, the ",(0,r.kt)("inlineCode",{parentName:"p"},"data")," field must have at least one of ",(0,r.kt)("inlineCode",{parentName:"p"},"username")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"password"),"."),(0,r.kt)("p",null,"For more details about the secret types, please see the ",(0,r.kt)("a",{parentName:"p",href:"https://kubernetes.io/docs/concepts/configuration/secret/"},"Kubernetes secret documentation"),"."),(0,r.kt)("h2",{id:"immutable-secrets"},"Immutable secrets"),(0,r.kt)("p",null,"You can also declare a secret as immutable to prevent it from being changed accidentally."),(0,r.kt)("p",null,"To declare a secret as immutable:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "my-secret": sec.Secret {\n # ...\n immutable: True\n }\n }\n }\n}\n')),(0,r.kt)("p",null,"You can change a secret from mutable to immutable but not the other way around. That is because the Kubelet will stop watching secrets that are immutable. As the name suggests, you can only delete and re-create immutable secrets but you cannot change them."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/40870e5b.fd31b514.js b/assets/js/40870e5b.fd31b514.js new file mode 100644 index 00000000000..694ea03081c --- /dev/null +++ b/assets/js/40870e5b.fd31b514.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4671],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),l=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return a.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=l(n),m=r,h=d["".concat(c,".").concat(m)]||d[m]||u[m]||o;return n?a.createElement(h,i(i({ref:t},p),{},{components:n})):a.createElement(h,i({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>l});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:7},i="Secret Management",s={unversionedId:"config-walkthrough/secret",id:"version-v0.9/config-walkthrough/secret",title:"Secret Management",description:"You can manage application secrets via the secrets attribute in the workload schema. Depending on the context of your application, this might include pieces of credentials required to access a third-party application.",source:"@site/docs_versioned_docs/version-v0.9/config-walkthrough/secret.md",sourceDirName:"config-walkthrough",slug:"/config-walkthrough/secret",permalink:"/docs/v0.9/config-walkthrough/secret",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/config-walkthrough/secret.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:7,frontMatter:{sidebar_position:7},sidebar:"kusion",previous:{title:"Managed Databases",permalink:"/docs/v0.9/config-walkthrough/database"},next:{title:"Application Monitoring",permalink:"/docs/v0.9/config-walkthrough/monitoring"}},c={},l=[{value:"Import",id:"import",level:2},{value:"Creating a secret",id:"creating-a-secret",level:2},{value:"Immutable secrets",id:"immutable-secrets",level:2}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"secret-management"},"Secret Management"),(0,r.kt)("p",null,"You can manage application secrets via the ",(0,r.kt)("inlineCode",{parentName:"p"},"secrets")," attribute in the ",(0,r.kt)("inlineCode",{parentName:"p"},"workload")," schema. Depending on the context of your application, this might include pieces of credentials required to access a third-party application."),(0,r.kt)("p",null,"If your application depends on any cloud resources that are managed by Kusion, their credentials are automatically managed by Kusion (generated and injected into application runtime environment variable). You shouldn't have to manually create those."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"If your application workloads are also running on the cloud, it's recommended to leverage identity-based keyless authentication as much as possible to minimize the nuisance of secret management. Application identities will be supported in a future version of Kusion.")),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"catalog")," package. For more details on KCL package import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.secret as sec\n")),(0,r.kt)("h2",{id:"creating-a-secret"},"Creating a secret"),(0,r.kt)("p",null,"As of version 0.9.0, Kusion supports creating secrets by turning the ",(0,r.kt)("inlineCode",{parentName:"p"},"secrets")," declared in the configuration files into Kubernetes secrets."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"As a general principle, storing secrets in a plain text configuration file is highly discouraged. The recommended approach is to store the secrets in a third-party vault (such as Hashicorp Vault, AWS Secrets Manager and KMS, Azure Key Vault, etc) and retrieve the secret in the runtime only.")),(0,r.kt)("p",null,"Create a secret with the type ",(0,r.kt)("inlineCode",{parentName:"p"},"Opaque"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "my-secret": sec.Secret {\n type: "opaque"\n data: {\n "hello": "world"\n "foo": "bar"\n }\n }\n }\n }\n}\n')),(0,r.kt)("p",null,"Create a secret with the type ",(0,r.kt)("inlineCode",{parentName:"p"},"kubernetes.io/basic-auth"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "my-secret": sec.Secret {\n type: "basic"\n data: {\n "username": "admin"\n "password": "******"\n }\n }\n }\n }\n}\n')),(0,r.kt)("p",null,"When creating a ",(0,r.kt)("inlineCode",{parentName:"p"},"kubernetes.io/basic-auth")," type secret, the ",(0,r.kt)("inlineCode",{parentName:"p"},"data")," field must have at least one of ",(0,r.kt)("inlineCode",{parentName:"p"},"username")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"password"),"."),(0,r.kt)("p",null,"For more details about the secret types, please see the ",(0,r.kt)("a",{parentName:"p",href:"https://kubernetes.io/docs/concepts/configuration/secret/"},"Kubernetes secret documentation"),"."),(0,r.kt)("h2",{id:"immutable-secrets"},"Immutable secrets"),(0,r.kt)("p",null,"You can also declare a secret as immutable to prevent it from being changed accidentally."),(0,r.kt)("p",null,"To declare a secret as immutable:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "my-secret": sec.Secret {\n # ...\n immutable: True\n }\n }\n }\n}\n')),(0,r.kt)("p",null,"You can change a secret from mutable to immutable but not the other way around. That is because the Kubelet will stop watching secrets that are immutable. As the name suggests, you can only delete and re-create immutable secrets but you cannot change them."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/426f7ee9.32946274.js b/assets/js/426f7ee9.32946274.js deleted file mode 100644 index f407fcf60d0..00000000000 --- a/assets/js/426f7ee9.32946274.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9175],{3905:(e,n,r)=>{r.d(n,{Zo:()=>c,kt:()=>m});var t=r(67294);function i(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function a(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,t)}return r}function o(e){for(var n=1;n=0||(i[r]=e[r]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var p=t.createContext({}),l=function(e){var n=t.useContext(p),r=n;return e&&(r="function"==typeof e?e(n):o(o({},n),e)),r},c=function(e){var n=l(e.components);return t.createElement(p.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},d=t.forwardRef((function(e,n){var r=e.components,i=e.mdxType,a=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=l(r),m=i,g=d["".concat(p,".").concat(m)]||d[m]||u[m]||a;return r?t.createElement(g,o(o({ref:n},c),{},{components:r})):t.createElement(g,o({ref:n},c))}));function m(e,n){var r=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var a=r.length,o=new Array(a);o[0]=d;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s.mdxType="string"==typeof e?e:i,o[1]=s;for(var l=2;l{r.r(n),r.d(n,{assets:()=>p,contentTitle:()=>o,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var t=r(87462),i=(r(67294),r(3905));const a={id:"resource-spec"},o="Configure Resource Specification",s={unversionedId:"user-guides/working-with-k8s/resource-spec",id:"version-v0.11/user-guides/working-with-k8s/resource-spec",title:"Configure Resource Specification",description:"You can manage container-level resource specification in the AppConfiguration model via the resources field (under the Container schema).",source:"@site/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/5-resource-spec.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/resource-spec",permalink:"/docs/user-guides/working-with-k8s/resource-spec",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/5-resource-spec.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:5,frontMatter:{id:"resource-spec"},sidebar:"kusion",previous:{title:"Upgrade Image",permalink:"/docs/user-guides/working-with-k8s/image-upgrade"},next:{title:"Set up Operational Rules",permalink:"/docs/user-guides/working-with-k8s/set-up-operational-rules"}},p={},l=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],c={toc:l};function u(e){let{components:n,...r}=e;return(0,i.kt)("wrapper",(0,t.Z)({},c,r,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"configure-resource-specification"},"Configure Resource Specification"),(0,i.kt)("p",null,"You can manage container-level resource specification in the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model via the ",(0,i.kt)("inlineCode",{parentName:"p"},"resources")," field (under the ",(0,i.kt)("inlineCode",{parentName:"p"},"Container")," schema)."),(0,i.kt)("p",null,"For the full ",(0,i.kt)("inlineCode",{parentName:"p"},"Container")," schema reference, please see ",(0,i.kt)("a",{parentName:"p",href:"../../reference/modules/developer-schemas/workload/service#schema-container"},"here")," for more details."),(0,i.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,i.kt)("p",null,"Please refer to the ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,i.kt)("p",null,"The example below also requires you to have ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,i.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,i.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,i.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,i.kt)("h2",{id:"example"},"Example"),(0,i.kt)("p",null,"Update the resources value in ",(0,i.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-py"},'import kam.v1.app_configuration as ac\n\nhelloworld: ac.AppConfiguration {\n workload.containers.helloworld: {\n ...\n # before:\n # resources: {\n # "cpu": "500m"\n # "memory": "512M"\n # }\n # after: \n resources: {\n "cpu": "250m"\n "memory": "256Mi"\n }\n ...\n }\n}\n')),(0,i.kt)("p",null,"Everything else in ",(0,i.kt)("inlineCode",{parentName:"p"},"main.k")," stay the same."),(0,i.kt)("h2",{id:"applying"},"Applying"),(0,i.kt)("p",null,"Re-run steps in ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", resource scaling is completed."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private UnChanged\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Update\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS UnChanged v1:Service:simple-service:simple-service-dev-helloworld-private, skip \n SUCCESS Update apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \nUpdate apps/v1:Deployment:simple-service:simple-service-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,i.kt)("h2",{id:"validation"},"Validation"),(0,i.kt)("p",null,"We can verify the application container (in the deployment template) now has the updated resources attributes (cpu:250m, memory:256Mi) as defined in the container configuration:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"kubectl get deployment -n simple-service -o yaml\n...\n template:\n ...\n spec:\n containers:\n - env:\n ...\n image: gcr.io/google-samples/gb-frontend:v5\n ...\n resources:\n limits:\n cpu: 250m\n memory: 256Mi\n...\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/426f7ee9.9dee291a.js b/assets/js/426f7ee9.9dee291a.js new file mode 100644 index 00000000000..cb8a5aa1b8b --- /dev/null +++ b/assets/js/426f7ee9.9dee291a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9175],{3905:(e,n,r)=>{r.d(n,{Zo:()=>c,kt:()=>m});var t=r(67294);function i(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function a(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,t)}return r}function o(e){for(var n=1;n=0||(i[r]=e[r]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var p=t.createContext({}),l=function(e){var n=t.useContext(p),r=n;return e&&(r="function"==typeof e?e(n):o(o({},n),e)),r},c=function(e){var n=l(e.components);return t.createElement(p.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},d=t.forwardRef((function(e,n){var r=e.components,i=e.mdxType,a=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=l(r),m=i,g=d["".concat(p,".").concat(m)]||d[m]||u[m]||a;return r?t.createElement(g,o(o({ref:n},c),{},{components:r})):t.createElement(g,o({ref:n},c))}));function m(e,n){var r=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var a=r.length,o=new Array(a);o[0]=d;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s.mdxType="string"==typeof e?e:i,o[1]=s;for(var l=2;l{r.r(n),r.d(n,{assets:()=>p,contentTitle:()=>o,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var t=r(87462),i=(r(67294),r(3905));const a={id:"resource-spec"},o="Configure Resource Specification",s={unversionedId:"user-guides/working-with-k8s/resource-spec",id:"version-v0.11/user-guides/working-with-k8s/resource-spec",title:"Configure Resource Specification",description:"You can manage container-level resource specification in the AppConfiguration model via the resources field (under the Container schema).",source:"@site/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/5-resource-spec.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/resource-spec",permalink:"/docs/user-guides/working-with-k8s/resource-spec",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/5-resource-spec.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:5,frontMatter:{id:"resource-spec"},sidebar:"kusion",previous:{title:"Upgrade Image",permalink:"/docs/user-guides/working-with-k8s/image-upgrade"},next:{title:"Set up Operational Rules",permalink:"/docs/user-guides/working-with-k8s/set-up-operational-rules"}},p={},l=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],c={toc:l};function u(e){let{components:n,...r}=e;return(0,i.kt)("wrapper",(0,t.Z)({},c,r,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"configure-resource-specification"},"Configure Resource Specification"),(0,i.kt)("p",null,"You can manage container-level resource specification in the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model via the ",(0,i.kt)("inlineCode",{parentName:"p"},"resources")," field (under the ",(0,i.kt)("inlineCode",{parentName:"p"},"Container")," schema)."),(0,i.kt)("p",null,"For the full ",(0,i.kt)("inlineCode",{parentName:"p"},"Container")," schema reference, please see ",(0,i.kt)("a",{parentName:"p",href:"../../reference/modules/developer-schemas/workload/service#schema-container"},"here")," for more details."),(0,i.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,i.kt)("p",null,"Please refer to the ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,i.kt)("p",null,"The example below also requires you to have ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,i.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,i.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,i.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,i.kt)("h2",{id:"example"},"Example"),(0,i.kt)("p",null,"Update the resources value in ",(0,i.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-py"},'import kam.v1.app_configuration as ac\n\nhelloworld: ac.AppConfiguration {\n workload.containers.helloworld: {\n ...\n # before:\n # resources: {\n # "cpu": "500m"\n # "memory": "512M"\n # }\n # after: \n resources: {\n "cpu": "250m"\n "memory": "256Mi"\n }\n ...\n }\n}\n')),(0,i.kt)("p",null,"Everything else in ",(0,i.kt)("inlineCode",{parentName:"p"},"main.k")," stay the same."),(0,i.kt)("h2",{id:"applying"},"Applying"),(0,i.kt)("p",null,"Re-run steps in ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", resource scaling is completed."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private UnChanged\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Update\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS UnChanged v1:Service:simple-service:simple-service-dev-helloworld-private, skip \n SUCCESS Update apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \nUpdate apps/v1:Deployment:simple-service:simple-service-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,i.kt)("h2",{id:"validation"},"Validation"),(0,i.kt)("p",null,"We can verify the application container (in the deployment template) now has the updated resources attributes (cpu:250m, memory:256Mi) as defined in the container configuration:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"kubectl get deployment -n simple-service -o yaml\n...\n template:\n ...\n spec:\n containers:\n - env:\n ...\n image: gcr.io/google-samples/gb-frontend:v5\n ...\n resources:\n limits:\n cpu: 250m\n memory: 256Mi\n...\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/42dede29.3498f3da.js b/assets/js/42dede29.3498f3da.js new file mode 100644 index 00000000000..b44d1e024e9 --- /dev/null +++ b/assets/js/42dede29.3498f3da.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8986],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>h});var o=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function a(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=o.createContext({}),p=function(e){var n=o.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},c=function(e){var n=p(e.components);return o.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},d=o.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(t),h=r,m=d["".concat(s,".").concat(h)]||d[h]||u[h]||i;return t?o.createElement(m,a(a({ref:n},c),{},{components:t})):o.createElement(m,a({ref:n},c))}));function h(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,a=new Array(i);a[0]=d;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,a[1]=l;for(var p=2;p{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var o=t(87462),r=(t(67294),t(3905));const i={id:"job"},a="Schedule a Job",l={unversionedId:"user-guides/working-with-k8s/job",id:"version-v0.11/user-guides/working-with-k8s/job",title:"Schedule a Job",description:"The guides above provide examples on how to configure workloads of the type wl.Service, which is typically used for long-running web applications that should never go down. Alternatively, you could also schedule another kind of workload profile, namely wl.Job which corresponds to a one-off or recurring execution of tasks that run to completion and then stop.",source:"@site/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/7-job.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/job",permalink:"/docs/user-guides/working-with-k8s/job",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/7-job.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:7,frontMatter:{id:"job"},sidebar:"kusion",previous:{title:"Set up Operational Rules",permalink:"/docs/user-guides/working-with-k8s/set-up-operational-rules"},next:{title:"Configure Monitoring Behavior With Prometheus",permalink:"/docs/user-guides/observability/prometheus"}},s={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],c={toc:p};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,o.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"schedule-a-job"},"Schedule a Job"),(0,r.kt)("p",null,"The guides above provide examples on how to configure workloads of the type ",(0,r.kt)("inlineCode",{parentName:"p"},"wl.Service"),", which is typically used for long-running web applications that should ",(0,r.kt)("strong",{parentName:"p"},"never")," go down. Alternatively, you could also schedule another kind of workload profile, namely ",(0,r.kt)("inlineCode",{parentName:"p"},"wl.Job")," which corresponds to a one-off or recurring execution of tasks that run to completion and then stop."),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("p",null,"Please refer to the ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for scheduling a job."),(0,r.kt)("p",null,"The example below also requires you to have ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,r.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,r.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,r.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there. Alternatively, if you have updated your workspace config in the previous guides, no changes need to be made either."),(0,r.kt)("p",null,"However, if you (or the platform team) would like to set default values for the workloads to standardize the behavior of applications in the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace, you can do so by updating the ",(0,r.kt)("inlineCode",{parentName:"p"},"~/dev.yaml"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n service:\n default:\n replicas: 3\n labels:\n label-key: label-value\n annotations:\n annotation-key: annotation-value\n")),(0,r.kt)("p",null,"Please note that the ",(0,r.kt)("inlineCode",{parentName:"p"},"replicas")," in the workspace configuration only works as a default value and will be overridden by the value set in the application configuration."),(0,r.kt)("p",null,"The workspace configuration need to be updated with the command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace update dev -f ~/dev.yaml\n")),(0,r.kt)("p",null,"For a full reference of what can be configured in the workspace level, please see the ",(0,r.kt)("a",{parentName:"p",href:"../../reference/modules/workspace-configs/workload/job"},"workspace reference"),"."),(0,r.kt)("h2",{id:"example"},"Example"),(0,r.kt)("p",null,"To schedule a job with cron expression, update ",(0,r.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k")," to the following:"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-py"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Job {\n containers: {\n "busybox": c.Container {\n # The target image\n image: "busybox:1.28"\n # Run the following command as defined\n command: ["/bin/sh", "-c", "echo hello"]\n }\n }\n # Run every minute.\n schedule: "* * * * *"\n }\n}\n')),(0,r.kt)("p",null,"The KCL snippet above schedules a job. Alternatively, if you want a one-time job without cron, simply remove the ",(0,r.kt)("inlineCode",{parentName:"p"},"schedule")," from the configuration."),(0,r.kt)("p",null,"You can find the full example in here in the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/tree/main/example/simple-job"},"konfig repo"),"."),(0,r.kt)("h2",{id:"applying"},"Applying"),(0,r.kt)("p",null,"Re-run steps in ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying")," and schedule the job. Your output might look like one of the following:"),(0,r.kt)("p",null,"If you are starting from scratch, all resources are created on the spot:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service Create\n* \u2514\u2500 batch/v1:CronJob:simple-service:simple-service-dev-helloworld Create\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS Create v1:Namespace:simple-service success \n SUCCESS Create batch/v1:CronJob:simple-service:helloworld-dev-helloworld success \nCreate batch/v1:CronJob:simple-service:simple-service-dev-helloworld success [2/2] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 2 created, 0 updated, 0 deleted.\n")),(0,r.kt)("p",null,"If you are starting from the last guide which configures an ",(0,r.kt)("inlineCode",{parentName:"p"},"opsrule"),", the output looks like the following which destroys the ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployment")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Service")," and replace it with a ",(0,r.kt)("inlineCode",{parentName:"p"},"CronJob"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 batch/v1:CronJob:simple-service:simple-service-dev-helloworld Create\n* \u251c\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Delete\n* \u2514\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private Delete\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS Delete apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \n SUCCESS Create batch/v1:CronJob:simple-service:simple-service-dev-helloworld success \n SUCCESS Delete v1:Service:simple-service:simple-service-dev-helloworld-private success \nDelete v1:Service:simple-service:simple-service-dev-helloworld-private success [4/4] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 1 created, 0 updated, 2 deleted.\n")),(0,r.kt)("h2",{id:"validation"},"Validation"),(0,r.kt)("p",null,"We can verify the job has now been scheduled:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"$ kubectl get cronjob -n simple-service\nNAME SCHEDULE SUSPEND ACTIVE LAST SCHEDULE AGE\nsimple-service-dev-helloworld * * * * * False 0 2m18s\n")),(0,r.kt)("p",null,"Verify the job has been triggered after the minute mark since we scheduled it to run every minute:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"$ kubectl get job -n simple-service\nNAME COMPLETIONS DURATION AGE\nsimple-service-dev-helloworld-28415748 1/1 5s 11s\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/42dede29.a76fdbec.js b/assets/js/42dede29.a76fdbec.js deleted file mode 100644 index 4a90e0ecb79..00000000000 --- a/assets/js/42dede29.a76fdbec.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8986],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>h});var o=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function a(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=o.createContext({}),p=function(e){var n=o.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},c=function(e){var n=p(e.components);return o.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},d=o.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(t),h=r,m=d["".concat(s,".").concat(h)]||d[h]||u[h]||i;return t?o.createElement(m,a(a({ref:n},c),{},{components:t})):o.createElement(m,a({ref:n},c))}));function h(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,a=new Array(i);a[0]=d;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,a[1]=l;for(var p=2;p{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var o=t(87462),r=(t(67294),t(3905));const i={id:"job"},a="Schedule a Job",l={unversionedId:"user-guides/working-with-k8s/job",id:"version-v0.11/user-guides/working-with-k8s/job",title:"Schedule a Job",description:"The guides above provide examples on how to configure workloads of the type wl.Service, which is typically used for long-running web applications that should never go down. Alternatively, you could also schedule another kind of workload profile, namely wl.Job which corresponds to a one-off or recurring execution of tasks that run to completion and then stop.",source:"@site/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/7-job.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/job",permalink:"/docs/user-guides/working-with-k8s/job",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/7-job.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:7,frontMatter:{id:"job"},sidebar:"kusion",previous:{title:"Set up Operational Rules",permalink:"/docs/user-guides/working-with-k8s/set-up-operational-rules"},next:{title:"Configure Monitoring Behavior With Prometheus",permalink:"/docs/user-guides/observability/prometheus"}},s={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],c={toc:p};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,o.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"schedule-a-job"},"Schedule a Job"),(0,r.kt)("p",null,"The guides above provide examples on how to configure workloads of the type ",(0,r.kt)("inlineCode",{parentName:"p"},"wl.Service"),", which is typically used for long-running web applications that should ",(0,r.kt)("strong",{parentName:"p"},"never")," go down. Alternatively, you could also schedule another kind of workload profile, namely ",(0,r.kt)("inlineCode",{parentName:"p"},"wl.Job")," which corresponds to a one-off or recurring execution of tasks that run to completion and then stop."),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("p",null,"Please refer to the ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for scheduling a job."),(0,r.kt)("p",null,"The example below also requires you to have ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,r.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,r.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,r.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there. Alternatively, if you have updated your workspace config in the previous guides, no changes need to be made either."),(0,r.kt)("p",null,"However, if you (or the platform team) would like to set default values for the workloads to standardize the behavior of applications in the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace, you can do so by updating the ",(0,r.kt)("inlineCode",{parentName:"p"},"~/dev.yaml"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n service:\n default:\n replicas: 3\n labels:\n label-key: label-value\n annotations:\n annotation-key: annotation-value\n")),(0,r.kt)("p",null,"Please note that the ",(0,r.kt)("inlineCode",{parentName:"p"},"replicas")," in the workspace configuration only works as a default value and will be overridden by the value set in the application configuration."),(0,r.kt)("p",null,"The workspace configuration need to be updated with the command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace update dev -f ~/dev.yaml\n")),(0,r.kt)("p",null,"For a full reference of what can be configured in the workspace level, please see the ",(0,r.kt)("a",{parentName:"p",href:"../../reference/modules/workspace-configs/workload/job"},"workspace reference"),"."),(0,r.kt)("h2",{id:"example"},"Example"),(0,r.kt)("p",null,"To schedule a job with cron expression, update ",(0,r.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k")," to the following:"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-py"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Job {\n containers: {\n "busybox": c.Container {\n # The target image\n image: "busybox:1.28"\n # Run the following command as defined\n command: ["/bin/sh", "-c", "echo hello"]\n }\n }\n # Run every minute.\n schedule: "* * * * *"\n }\n}\n')),(0,r.kt)("p",null,"The KCL snippet above schedules a job. Alternatively, if you want a one-time job without cron, simply remove the ",(0,r.kt)("inlineCode",{parentName:"p"},"schedule")," from the configuration."),(0,r.kt)("p",null,"You can find the full example in here in the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/tree/main/example/simple-job"},"konfig repo"),"."),(0,r.kt)("h2",{id:"applying"},"Applying"),(0,r.kt)("p",null,"Re-run steps in ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying")," and schedule the job. Your output might look like one of the following:"),(0,r.kt)("p",null,"If you are starting from scratch, all resources are created on the spot:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service Create\n* \u2514\u2500 batch/v1:CronJob:simple-service:simple-service-dev-helloworld Create\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS Create v1:Namespace:simple-service success \n SUCCESS Create batch/v1:CronJob:simple-service:helloworld-dev-helloworld success \nCreate batch/v1:CronJob:simple-service:simple-service-dev-helloworld success [2/2] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 2 created, 0 updated, 0 deleted.\n")),(0,r.kt)("p",null,"If you are starting from the last guide which configures an ",(0,r.kt)("inlineCode",{parentName:"p"},"opsrule"),", the output looks like the following which destroys the ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployment")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Service")," and replace it with a ",(0,r.kt)("inlineCode",{parentName:"p"},"CronJob"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 batch/v1:CronJob:simple-service:simple-service-dev-helloworld Create\n* \u251c\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Delete\n* \u2514\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private Delete\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS Delete apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \n SUCCESS Create batch/v1:CronJob:simple-service:simple-service-dev-helloworld success \n SUCCESS Delete v1:Service:simple-service:simple-service-dev-helloworld-private success \nDelete v1:Service:simple-service:simple-service-dev-helloworld-private success [4/4] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 1 created, 0 updated, 2 deleted.\n")),(0,r.kt)("h2",{id:"validation"},"Validation"),(0,r.kt)("p",null,"We can verify the job has now been scheduled:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"$ kubectl get cronjob -n simple-service\nNAME SCHEDULE SUSPEND ACTIVE LAST SCHEDULE AGE\nsimple-service-dev-helloworld * * * * * False 0 2m18s\n")),(0,r.kt)("p",null,"Verify the job has been triggered after the minute mark since we scheduled it to run every minute:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"$ kubectl get job -n simple-service\nNAME COMPLETIONS DURATION AGE\nsimple-service-dev-helloworld-28415748 1/1 5s 11s\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/434d80d9.9b3696cc.js b/assets/js/434d80d9.9b3696cc.js new file mode 100644 index 00000000000..db5bccae04c --- /dev/null +++ b/assets/js/434d80d9.9b3696cc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1132],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=l(r),f=o,m=d["".concat(p,".").concat(f)]||d[f]||u[f]||i;return r?n.createElement(m,a(a({ref:t},c),{},{components:r})):n.createElement(m,a({ref:t},c))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=d;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var l=2;l{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const i={},a="kusion preview",s={unversionedId:"reference/commands/kusion-preview",id:"reference/commands/kusion-preview",title:"kusion preview",description:"Preview a series of resource changes within the stack",source:"@site/docs/kusion/6-reference/1-commands/kusion-preview.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-preview",permalink:"/docs/next/reference/commands/kusion-preview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-preview.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion options",permalink:"/docs/next/reference/commands/kusion-options"},next:{title:"kusion project create",permalink:"/docs/next/reference/commands/kusion-project-create"}},p={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],c={toc:l};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-preview"},"kusion preview"),(0,o.kt)("p",null,"Preview a series of resource changes within the stack"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Preview a series of resource changes within the stack."),(0,o.kt)("p",null," Create, update or delete resources according to the intent described in the stack. By default, Kusion will generate an execution preview and present it for your approval before taking any action."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion preview [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' # Preview with specified work directory\n kusion preview -w /path/to/workdir\n \n # Preview with specified arguments\n kusion preview -D name=test -D age=18\n \n # Preview with ignored fields\n kusion preview --ignore-fields="metadata.generation,metadata.managedFields\n \n # Preview with json format result\n kusion preview -o json\n \n # Preview without output style and color\n kusion preview --no-style=true\n')),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -a, --all --detail Automatically show all preview details, combined use with flag --detail\n --backend string The backend to use, supports 'local', 'oss' and 's3'.\n -d, --detail Automatically show preview details with interactive options (default true)\n -h, --help help for preview\n --ignore-fields strings Ignore differences of target fields\n --no-style no-style sets to RawOutput mode and disables all of styling\n --operator string Specify the operator\n -o, --output string Specify the output format\n -w, --workdir string The work directory to run Kusion CLI.\n --workspace string The name of target workspace to operate in.\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/434d80d9.daa91dd9.js b/assets/js/434d80d9.daa91dd9.js deleted file mode 100644 index c576ebcd7c4..00000000000 --- a/assets/js/434d80d9.daa91dd9.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1132],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=l(r),f=o,m=d["".concat(p,".").concat(f)]||d[f]||u[f]||i;return r?n.createElement(m,a(a({ref:t},c),{},{components:r})):n.createElement(m,a({ref:t},c))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=d;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var l=2;l{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const i={},a="kusion preview",s={unversionedId:"reference/commands/kusion-preview",id:"reference/commands/kusion-preview",title:"kusion preview",description:"Preview a series of resource changes within the stack",source:"@site/docs/kusion/6-reference/1-commands/kusion-preview.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-preview",permalink:"/docs/next/reference/commands/kusion-preview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-preview.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion options",permalink:"/docs/next/reference/commands/kusion-options"},next:{title:"kusion project create",permalink:"/docs/next/reference/commands/kusion-project-create"}},p={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],c={toc:l};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-preview"},"kusion preview"),(0,o.kt)("p",null,"Preview a series of resource changes within the stack"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Preview a series of resource changes within the stack."),(0,o.kt)("p",null," Create, update or delete resources according to the intent described in the stack. By default, Kusion will generate an execution preview and present it for your approval before taking any action."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion preview [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' # Preview with specified work directory\n kusion preview -w /path/to/workdir\n \n # Preview with specified arguments\n kusion preview -D name=test -D age=18\n \n # Preview with ignored fields\n kusion preview --ignore-fields="metadata.generation,metadata.managedFields\n \n # Preview with json format result\n kusion preview -o json\n \n # Preview without output style and color\n kusion preview --no-style=true\n')),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -a, --all --detail Automatically show all preview details, combined use with flag --detail\n --backend string The backend to use, supports 'local', 'oss' and 's3'.\n -d, --detail Automatically show preview details with interactive options (default true)\n -h, --help help for preview\n --ignore-fields strings Ignore differences of target fields\n --no-style no-style sets to RawOutput mode and disables all of styling\n --operator string Specify the operator\n -o, --output string Specify the output format\n -w, --workdir string The work directory to run Kusion CLI.\n --workspace string The name of target workspace to operate in.\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/44a7a3de.11cacf55.js b/assets/js/44a7a3de.11cacf55.js new file mode 100644 index 00000000000..898e508e140 --- /dev/null +++ b/assets/js/44a7a3de.11cacf55.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5911],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var u=a.createContext({}),i=function(e){var t=a.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=i(e.components);return a.createElement(u.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,u=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=i(n),m=r,k=d["".concat(u,".").concat(m)]||d[m]||p[m]||s;return n?a.createElement(k,o(o({ref:t},c),{},{components:n})):a.createElement(k,o({ref:t},c))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=d;var l={};for(var u in t)hasOwnProperty.call(t,u)&&(l[u]=t[u]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var i=2;i{n.d(t,{Z:()=>o});var a=n(67294),r=n(86010);const s="tabItem_Ymn6";function o(e){let{children:t,hidden:n,className:o}=e;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(s,o),hidden:n},t)}},74866:(e,t,n)=>{n.d(t,{Z:()=>N});var a=n(87462),r=n(67294),s=n(86010),o=n(12466),l=n(76775),u=n(91980),i=n(67392),c=n(50012);function p(e){return function(e){var t;return(null==(t=r.Children.map(e,(e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})))?void 0:t.filter(Boolean))??[]}(e).map((e=>{let{props:{value:t,label:n,attributes:a,default:r}}=e;return{value:t,label:n,attributes:a,default:r}}))}function d(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??p(n);return function(e){const t=(0,i.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function k(e){let{queryString:t=!1,groupId:n}=e;const a=(0,l.k6)(),s=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,u._X)(s),(0,r.useCallback)((e=>{if(!s)return;const t=new URLSearchParams(a.location.search);t.set(s,e),a.replace({...a.location,search:t.toString()})}),[s,a])]}function h(e){const{defaultValue:t,queryString:n=!1,groupId:a}=e,s=d(e),[o,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const a=n.find((e=>e.default))??n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:t,tabValues:s}))),[u,i]=k({queryString:n,groupId:a}),[p,h]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[a,s]=(0,c.Nk)(n);return[a,(0,r.useCallback)((e=>{n&&s.set(e)}),[n,s])]}({groupId:a}),f=(()=>{const e=u??p;return m({value:e,tabValues:s})?e:null})();(0,r.useLayoutEffect)((()=>{f&&l(f)}),[f]);return{selectedValue:o,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:s}))throw new Error(`Can't select invalid tab value=${e}`);l(e),i(e),h(e)}),[i,h,s]),tabValues:s}}var f=n(72389);const b="tabList__CuJ",g="tabItem_LNqP";function v(e){let{className:t,block:n,selectedValue:l,selectValue:u,tabValues:i}=e;const c=[],{blockElementScrollPositionUntilNextRender:p}=(0,o.o5)(),d=e=>{const t=e.currentTarget,n=c.indexOf(t),a=i[n].value;a!==l&&(p(t),u(a))},m=e=>{var t;let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=c.indexOf(e.currentTarget)+1;n=c[t]??c[0];break}case"ArrowLeft":{const t=c.indexOf(e.currentTarget)-1;n=c[t]??c[c.length-1];break}}null==(t=n)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.Z)("tabs",{"tabs--block":n},t)},i.map((e=>{let{value:t,label:n,attributes:o}=e;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:l===t?0:-1,"aria-selected":l===t,key:t,ref:e=>c.push(e),onKeyDown:m,onClick:d},o,{className:(0,s.Z)("tabs__item",g,null==o?void 0:o.className,{"tabs__item--active":l===t})}),n??t)})))}function w(e){let{lazy:t,children:n,selectedValue:a}=e;const s=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=s.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},s.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a}))))}function y(e){const t=h(e);return r.createElement("div",{className:(0,s.Z)("tabs-container",b)},r.createElement(v,(0,a.Z)({},e,t)),r.createElement(w,(0,a.Z)({},e,t)))}function N(e){const t=(0,f.Z)();return r.createElement(y,(0,a.Z)({key:String(t)},e))}},58748:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>l,metadata:()=>i,toc:()=>p});var a=n(87462),r=(n(67294),n(3905)),s=n(74866),o=n(85162);const l={},u="Install Kusion",i={unversionedId:"getting-started/install-kusion",id:"getting-started/install-kusion",title:"Install Kusion",description:"You can install the latest Kusion CLI on MacOS, Linux and Windows.",source:"@site/docs/kusion/2-getting-started/1-install-kusion.md",sourceDirName:"2-getting-started",slug:"/getting-started/install-kusion",permalink:"/docs/next/getting-started/install-kusion",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/2-getting-started/1-install-kusion.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{},sidebar:"kusion",previous:{title:"Kusion vs Other Software",permalink:"/docs/next/what-is-kusion/kusion-vs-x"},next:{title:"Run Your First App on Kubernetes with Kusion",permalink:"/docs/next/getting-started/deliver-quickstart"}},c={},p=[{value:"MacOs/Linux",id:"macoslinux",level:2},{value:"Windows",id:"windows",level:2}],d={toc:p};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"install-kusion"},"Install Kusion"),(0,r.kt)("p",null,"You can install the latest Kusion CLI on MacOS, Linux and Windows."),(0,r.kt)("h2",{id:"macoslinux"},"MacOs/Linux"),(0,r.kt)("p",null,"For the MacOs and Linux, Homebrew and sh script are supported. Choose the one you prefer from the methods below."),(0,r.kt)(s.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"Homebrew",mdxType:"TabItem"},(0,r.kt)("p",null,"The recommended method for installing on MacOS and Linux is to use the brew package manager."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Install Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# tap formula repository Kusionstack/tap\nbrew tap KusionStack/tap\n\n# install Kusion \nbrew install KusionStack/tap/kusion\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Update Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# update formulae from remote\nbrew update\n\n# update Kusion\nbrew upgrade KusionStack/tap/kusion\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Uninstall Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# uninstall Kusion\nbrew uninstall KusionStack/tap/kusion\n"))),(0,r.kt)(o.Z,{value:"curl | sh",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Install Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# install Kusion, default latest version\ncurl https://www.kusionstack.io/scripts/install.sh | sh\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Install the Specified Version of Kusion")),(0,r.kt)("p",null,"You can also install the specified version of Kusion by appointing the version as shell script parameter, where the version is the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/tags"},"available tag"),' trimming prefix "v", such as 0.11.0, 0.10.0, etc. In general, you don\'t need to specify Kusion version, just use the command above to install the latest version.'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# install Kusion of specified version 0.11.0\ncurl https://www.kusionstack.io/scripts/install.sh | sh -s 0.11.0\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Uninstall Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# uninstall Kusion\ncurl https://www.kusionstack.io/scripts/uninstall.sh | sh\n")))),(0,r.kt)("h2",{id:"windows"},"Windows"),(0,r.kt)("p",null,"For the Windows, Scoop and Powershell script are supported. Choose the one you prefer from the methods below."),(0,r.kt)(s.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"Scoop",mdxType:"TabItem"},(0,r.kt)("p",null,"The recommended method for installing on Windows is to use the scoop package manager."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Install Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# add scoop bucket KusionStack\nscoop bucket add KusionStack https://github.com/KusionStack/scoop-bucket.git\n\n# install kusion\nscoop install KusionStack/kusion\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Update Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# update manifest from remote\nscoop update\n\n# update Kusion\nscoop install KusionStack/kusion\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Uninstall Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# uninstall Kusion\nbrew uninstall KusionStack/kusion\n"))),(0,r.kt)(o.Z,{value:"Powershell",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Install Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'# install Kusion, default latest version\npowershell -Command "iwr -useb https://www.kusionstack.io/scripts/install.ps1 | iex"\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Install the Specified Version of Kusion")),(0,r.kt)("p",null,"You can also install the specified version of Kusion by appointing the version as shell script parameter, where the version is the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/tags"},"available tag"),' trimming prefix "v", such as 0.11.0, etc. In general, you don\'t need to specify Kusion version, just use the command above to install the latest version.'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'# install Kusion of specified version 0.10.0\npowershell {"& { $(irm https://www.kusionstack.io/scripts/install.ps1) } -Version 0.11.0" | iex}\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Uninstall Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'# uninstall Kusion\npowershell -Command "iwr -useb https://www.kusionstack.io/scripts/uninstall.ps1 | iex"\n')))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/44a7a3de.275109cb.js b/assets/js/44a7a3de.275109cb.js deleted file mode 100644 index 2a4bf77a307..00000000000 --- a/assets/js/44a7a3de.275109cb.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5911],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),u=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=u(e.components);return a.createElement(i.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=u(n),m=r,k=d["".concat(i,".").concat(m)]||d[m]||p[m]||s;return n?a.createElement(k,o(o({ref:t},c),{},{components:n})):a.createElement(k,o({ref:t},c))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=d;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var u=2;u{n.d(t,{Z:()=>o});var a=n(67294),r=n(86010);const s="tabItem_Ymn6";function o(e){let{children:t,hidden:n,className:o}=e;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(s,o),hidden:n},t)}},74866:(e,t,n)=>{n.d(t,{Z:()=>N});var a=n(87462),r=n(67294),s=n(86010),o=n(12466),l=n(76775),i=n(91980),u=n(67392),c=n(50012);function p(e){return function(e){var t;return(null==(t=r.Children.map(e,(e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})))?void 0:t.filter(Boolean))??[]}(e).map((e=>{let{props:{value:t,label:n,attributes:a,default:r}}=e;return{value:t,label:n,attributes:a,default:r}}))}function d(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??p(n);return function(e){const t=(0,u.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function k(e){let{queryString:t=!1,groupId:n}=e;const a=(0,l.k6)(),s=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i._X)(s),(0,r.useCallback)((e=>{if(!s)return;const t=new URLSearchParams(a.location.search);t.set(s,e),a.replace({...a.location,search:t.toString()})}),[s,a])]}function h(e){const{defaultValue:t,queryString:n=!1,groupId:a}=e,s=d(e),[o,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const a=n.find((e=>e.default))??n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:t,tabValues:s}))),[i,u]=k({queryString:n,groupId:a}),[p,h]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[a,s]=(0,c.Nk)(n);return[a,(0,r.useCallback)((e=>{n&&s.set(e)}),[n,s])]}({groupId:a}),f=(()=>{const e=i??p;return m({value:e,tabValues:s})?e:null})();(0,r.useLayoutEffect)((()=>{f&&l(f)}),[f]);return{selectedValue:o,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:s}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),h(e)}),[u,h,s]),tabValues:s}}var f=n(72389);const b="tabList__CuJ",g="tabItem_LNqP";function v(e){let{className:t,block:n,selectedValue:l,selectValue:i,tabValues:u}=e;const c=[],{blockElementScrollPositionUntilNextRender:p}=(0,o.o5)(),d=e=>{const t=e.currentTarget,n=c.indexOf(t),a=u[n].value;a!==l&&(p(t),i(a))},m=e=>{var t;let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=c.indexOf(e.currentTarget)+1;n=c[t]??c[0];break}case"ArrowLeft":{const t=c.indexOf(e.currentTarget)-1;n=c[t]??c[c.length-1];break}}null==(t=n)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.Z)("tabs",{"tabs--block":n},t)},u.map((e=>{let{value:t,label:n,attributes:o}=e;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:l===t?0:-1,"aria-selected":l===t,key:t,ref:e=>c.push(e),onKeyDown:m,onClick:d},o,{className:(0,s.Z)("tabs__item",g,null==o?void 0:o.className,{"tabs__item--active":l===t})}),n??t)})))}function w(e){let{lazy:t,children:n,selectedValue:a}=e;const s=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=s.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},s.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a}))))}function y(e){const t=h(e);return r.createElement("div",{className:(0,s.Z)("tabs-container",b)},r.createElement(v,(0,a.Z)({},e,t)),r.createElement(w,(0,a.Z)({},e,t)))}function N(e){const t=(0,f.Z)();return r.createElement(y,(0,a.Z)({key:String(t)},e))}},58748:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>u,toc:()=>p});var a=n(87462),r=(n(67294),n(3905)),s=n(74866),o=n(85162);const l={},i="Install Kusion",u={unversionedId:"getting-started/install-kusion",id:"getting-started/install-kusion",title:"Install Kusion",description:"You can install the latest Kusion CLI on MacOS, Linux and Windows.",source:"@site/docs/kusion/2-getting-started/1-install-kusion.md",sourceDirName:"2-getting-started",slug:"/getting-started/install-kusion",permalink:"/docs/next/getting-started/install-kusion",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/2-getting-started/1-install-kusion.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{},sidebar:"kusion",previous:{title:"Kusion vs Other Software",permalink:"/docs/next/what-is-kusion/kusion-vs-x"},next:{title:"Run Your First App on Kubernetes with Kusion",permalink:"/docs/next/getting-started/deliver-quickstart"}},c={},p=[{value:"MacOs/Linux",id:"macoslinux",level:2},{value:"Windows",id:"windows",level:2}],d={toc:p};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"install-kusion"},"Install Kusion"),(0,r.kt)("p",null,"You can install the latest Kusion CLI on MacOS, Linux and Windows."),(0,r.kt)("h2",{id:"macoslinux"},"MacOs/Linux"),(0,r.kt)("p",null,"For the MacOs and Linux, Homebrew and sh script are supported. Choose the one you prefer from the methods below."),(0,r.kt)(s.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"Homebrew",mdxType:"TabItem"},(0,r.kt)("p",null,"The recommended method for installing on MacOS and Linux is to use the brew package manager."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Install Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# tap formula repository Kusionstack/tap\nbrew tap KusionStack/tap\n\n# install Kusion \nbrew install KusionStack/tap/kusion\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Update Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# update formulae from remote\nbrew update\n\n# update Kusion\nbrew upgrade KusionStack/tap/kusion\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Uninstall Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# uninstall Kusion\nbrew uninstall KusionStack/tap/kusion\n"))),(0,r.kt)(o.Z,{value:"curl | sh",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Install Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# install Kusion, default latest version\ncurl https://www.kusionstack.io/scripts/install.sh | sh\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Install the Specified Version of Kusion")),(0,r.kt)("p",null,"You can also install the specified version of Kusion by appointing the version as shell script parameter, where the version is the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/tags"},"available tag"),' trimming prefix "v", such as 0.11.0, 0.10.0, etc. In general, you don\'t need to specify Kusion version, just use the command above to install the latest version.'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# install Kusion of specified version 0.11.0\ncurl https://www.kusionstack.io/scripts/install.sh | sh -s 0.11.0\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Uninstall Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# uninstall Kusion\ncurl https://www.kusionstack.io/scripts/uninstall.sh | sh\n")))),(0,r.kt)("h2",{id:"windows"},"Windows"),(0,r.kt)("p",null,"For the Windows, Scoop and Powershell script are supported. Choose the one you prefer from the methods below."),(0,r.kt)(s.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"Scoop",mdxType:"TabItem"},(0,r.kt)("p",null,"The recommended method for installing on Windows is to use the scoop package manager."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Install Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# add scoop bucket KusionStack\nscoop bucket add KusionStack https://github.com/KusionStack/scoop-bucket.git\n\n# install kusion\nscoop install KusionStack/kusion\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Update Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# update manifest from remote\nscoop update\n\n# update Kusion\nscoop install KusionStack/kusion\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Uninstall Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# uninstall Kusion\nbrew uninstall KusionStack/kusion\n"))),(0,r.kt)(o.Z,{value:"Powershell",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Install Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'# install Kusion, default latest version\npowershell -Command "iwr -useb https://www.kusionstack.io/scripts/install.ps1 | iex"\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Install the Specified Version of Kusion")),(0,r.kt)("p",null,"You can also install the specified version of Kusion by appointing the version as shell script parameter, where the version is the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/tags"},"available tag"),' trimming prefix "v", such as 0.11.0, etc. In general, you don\'t need to specify Kusion version, just use the command above to install the latest version.'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'# install Kusion of specified version 0.10.0\npowershell {"& { $(irm https://www.kusionstack.io/scripts/install.ps1) } -Version 0.11.0" | iex}\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Uninstall Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'# uninstall Kusion\npowershell -Command "iwr -useb https://www.kusionstack.io/scripts/uninstall.ps1 | iex"\n')))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/44ecec25.8162efd8.js b/assets/js/44ecec25.8162efd8.js deleted file mode 100644 index e121704270f..00000000000 --- a/assets/js/44ecec25.8162efd8.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2508],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var r=t(67294);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var s=r.createContext({}),l=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=l(e.components);return r.createElement(s.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),u=l(t),m=i,k=u["".concat(s,".").concat(m)]||u[m]||d[m]||a;return t?r.createElement(k,o(o({ref:n},c),{},{components:t})):r.createElement(k,o({ref:n},c))}));function m(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var a=t.length,o=new Array(a);o[0]=u;var p={};for(var s in n)hasOwnProperty.call(n,s)&&(p[s]=n[s]);p.originalType=e,p.mdxType="string"==typeof e?e:i,o[1]=p;for(var l=2;l{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>p,toc:()=>l});var r=t(87462),i=(t(67294),t(3905));const a={id:"service"},o="Expose Service",p={unversionedId:"user-guides/working-with-k8s/service",id:"version-v0.11/user-guides/working-with-k8s/service",title:"Expose Service",description:"You can determine how to expose your service in the AppConfiguration model via the ports field (under the network accessory). The ports field defines a list of all the Ports you want to expose for the application (and their corresponding listening ports on the container, if they don't match the service ports), so that it can be consumed by other applications.",source:"@site/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/3-service.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/service",permalink:"/docs/user-guides/working-with-k8s/service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/3-service.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{id:"service"},sidebar:"kusion",previous:{title:"Configure Containers",permalink:"/docs/user-guides/working-with-k8s/container"},next:{title:"Upgrade Image",permalink:"/docs/user-guides/working-with-k8s/image-upgrade"}},s={},l=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],c={toc:l};function d(e){let{components:n,...a}=e;return(0,i.kt)("wrapper",(0,r.Z)({},c,a,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"expose-service"},"Expose Service"),(0,i.kt)("p",null,"You can determine how to expose your service in the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model via the ",(0,i.kt)("inlineCode",{parentName:"p"},"ports")," field (under the ",(0,i.kt)("inlineCode",{parentName:"p"},"network")," accessory). The ",(0,i.kt)("inlineCode",{parentName:"p"},"ports")," field defines a list of all the ",(0,i.kt)("inlineCode",{parentName:"p"},"Port"),"s you want to expose for the application (and their corresponding listening ports on the container, if they don't match the service ports), so that it can be consumed by other applications."),(0,i.kt)("p",null,"Unless explicitly defined, each of the ports exposed is by default exposed privately as a ",(0,i.kt)("inlineCode",{parentName:"p"},"ClusterIP")," type service. You can expose a port publicly by specifying the ",(0,i.kt)("inlineCode",{parentName:"p"},"public")," field in the ",(0,i.kt)("inlineCode",{parentName:"p"},"Port")," schema. At the moment, the implementation for publicly access is done via Load Balancer type service backed by cloud providers. Ingress will be supported in a future version of kusion."),(0,i.kt)("p",null,"For the ",(0,i.kt)("inlineCode",{parentName:"p"},"Port")," schema reference, please see ",(0,i.kt)("a",{parentName:"p",href:"../../reference/modules/developer-schemas/workload/service#schema-port"},"here")," for more details."),(0,i.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,i.kt)("p",null,"Please refer to the ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,i.kt)("p",null,"The example below also requires you to have ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,i.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,i.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,i.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,i.kt)("p",null,"However, if you (or the platform team) would like to set default values for the services to standardize the behavior of applications in the ",(0,i.kt)("inlineCode",{parentName:"p"},"dev")," workspace, you can do so by updating the ",(0,i.kt)("inlineCode",{parentName:"p"},"~/dev.yaml"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n kusionstack/network@0.1.0: \n default:\n port: \n type: alicloud\n labels:\n kusionstack.io/control: "true"\n annotations:\n service.beta.kubernetes.io/alibaba-cloud-loadbalancer-spec: slb.s1.small\n')),(0,i.kt)("p",null,"The workspace configuration need to be updated with the command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace update dev -f ~/dev.yaml\n")),(0,i.kt)("p",null,"For a full reference of what can be configured in the workspace level, please see the ",(0,i.kt)("a",{parentName:"p",href:"../../reference/modules/workspace-configs/networking/network"},"workspace reference"),"."),(0,i.kt)("h2",{id:"example"},"Example"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\n\n"helloworld": ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "helloworld": c.Container {\n image = "gcr.io/google-samples/gb-frontend:v4"\n env: {\n "env1": "VALUE"\n "env2": "VALUE2"\n }\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n # Configure an HTTP readiness probe\n readinessProbe: p.Probe {\n probeHandler: p.Http {\n url: "http://localhost:80"\n }\n initialDelaySeconds: 10\n }\n }\n }\n replicas: 2\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 8080\n targetPort: 80\n }\n ]\n }\n }\n}\n')),(0,i.kt)("p",null,"The code above changes the service port to expose from ",(0,i.kt)("inlineCode",{parentName:"p"},"80")," in the last guide to ",(0,i.kt)("inlineCode",{parentName:"p"},"8080"),", but still targeting the container port ",(0,i.kt)("inlineCode",{parentName:"p"},"80")," because that's what the application is listening on."),(0,i.kt)("h2",{id:"applying"},"Applying"),(0,i.kt)("p",null,"Re-run steps in ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", new service configuration can be applied."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private Update\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld UnChanged\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS Update v1:Service:simple-service:simple-service-dev-helloworld-private success \n SUCCESS UnChanged apps/v1:Deployment:simple-service:simple-service-dev-helloworld, skip \nUnChanged apps/v1:Deployment:simple-service:simple-service-dev-helloworld, skip [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,i.kt)("h2",{id:"validation"},"Validation"),(0,i.kt)("p",null,"We can verify the Kubernetes service now has the updated attributes (mapping service port 8080 to container port 80) as defined in the ",(0,i.kt)("inlineCode",{parentName:"p"},"ports")," configuration:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"kubectl get svc -n simple-service -o yaml\n...\n spec:\n ...\n ports:\n - name: simple-service-dev-helloworld-private-8080-tcp\n port: 8080\n protocol: TCP\n targetPort: 80\n...\n")),(0,i.kt)("p",null,"Exposing service port 8080:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"kubectl port-forward svc/simple-service-dev-helloworld-private -n simple-service 30000:8080\n")),(0,i.kt)("p",null,"Open browser and visit ",(0,i.kt)("a",{parentName:"p",href:"http://127.0.0.1:30000"},"http://127.0.0.1:30000"),", the application should be up and running\uff1a"),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"app-preview",src:t(92287).Z,width:"1830",height:"330"})))}d.isMDXComponent=!0},92287:(e,n,t)=>{t.d(n,{Z:()=>r});const r=t.p+"assets/images/app-preview-de5274f4267fa725d2a65099e47c6c2c.png"}}]); \ No newline at end of file diff --git a/assets/js/44ecec25.e74a971f.js b/assets/js/44ecec25.e74a971f.js new file mode 100644 index 00000000000..31a1772b4fe --- /dev/null +++ b/assets/js/44ecec25.e74a971f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2508],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var r=t(67294);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var s=r.createContext({}),l=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=l(e.components);return r.createElement(s.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),u=l(t),m=i,k=u["".concat(s,".").concat(m)]||u[m]||d[m]||a;return t?r.createElement(k,o(o({ref:n},c),{},{components:t})):r.createElement(k,o({ref:n},c))}));function m(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var a=t.length,o=new Array(a);o[0]=u;var p={};for(var s in n)hasOwnProperty.call(n,s)&&(p[s]=n[s]);p.originalType=e,p.mdxType="string"==typeof e?e:i,o[1]=p;for(var l=2;l{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>p,toc:()=>l});var r=t(87462),i=(t(67294),t(3905));const a={id:"service"},o="Expose Service",p={unversionedId:"user-guides/working-with-k8s/service",id:"version-v0.11/user-guides/working-with-k8s/service",title:"Expose Service",description:"You can determine how to expose your service in the AppConfiguration model via the ports field (under the network accessory). The ports field defines a list of all the Ports you want to expose for the application (and their corresponding listening ports on the container, if they don't match the service ports), so that it can be consumed by other applications.",source:"@site/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/3-service.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/service",permalink:"/docs/user-guides/working-with-k8s/service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/3-service.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{id:"service"},sidebar:"kusion",previous:{title:"Configure Containers",permalink:"/docs/user-guides/working-with-k8s/container"},next:{title:"Upgrade Image",permalink:"/docs/user-guides/working-with-k8s/image-upgrade"}},s={},l=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],c={toc:l};function d(e){let{components:n,...a}=e;return(0,i.kt)("wrapper",(0,r.Z)({},c,a,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"expose-service"},"Expose Service"),(0,i.kt)("p",null,"You can determine how to expose your service in the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model via the ",(0,i.kt)("inlineCode",{parentName:"p"},"ports")," field (under the ",(0,i.kt)("inlineCode",{parentName:"p"},"network")," accessory). The ",(0,i.kt)("inlineCode",{parentName:"p"},"ports")," field defines a list of all the ",(0,i.kt)("inlineCode",{parentName:"p"},"Port"),"s you want to expose for the application (and their corresponding listening ports on the container, if they don't match the service ports), so that it can be consumed by other applications."),(0,i.kt)("p",null,"Unless explicitly defined, each of the ports exposed is by default exposed privately as a ",(0,i.kt)("inlineCode",{parentName:"p"},"ClusterIP")," type service. You can expose a port publicly by specifying the ",(0,i.kt)("inlineCode",{parentName:"p"},"public")," field in the ",(0,i.kt)("inlineCode",{parentName:"p"},"Port")," schema. At the moment, the implementation for publicly access is done via Load Balancer type service backed by cloud providers. Ingress will be supported in a future version of kusion."),(0,i.kt)("p",null,"For the ",(0,i.kt)("inlineCode",{parentName:"p"},"Port")," schema reference, please see ",(0,i.kt)("a",{parentName:"p",href:"../../reference/modules/developer-schemas/workload/service#schema-port"},"here")," for more details."),(0,i.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,i.kt)("p",null,"Please refer to the ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,i.kt)("p",null,"The example below also requires you to have ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,i.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,i.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,i.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,i.kt)("p",null,"However, if you (or the platform team) would like to set default values for the services to standardize the behavior of applications in the ",(0,i.kt)("inlineCode",{parentName:"p"},"dev")," workspace, you can do so by updating the ",(0,i.kt)("inlineCode",{parentName:"p"},"~/dev.yaml"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n kusionstack/network@0.1.0: \n default:\n port: \n type: alicloud\n labels:\n kusionstack.io/control: "true"\n annotations:\n service.beta.kubernetes.io/alibaba-cloud-loadbalancer-spec: slb.s1.small\n')),(0,i.kt)("p",null,"The workspace configuration need to be updated with the command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace update dev -f ~/dev.yaml\n")),(0,i.kt)("p",null,"For a full reference of what can be configured in the workspace level, please see the ",(0,i.kt)("a",{parentName:"p",href:"../../reference/modules/workspace-configs/networking/network"},"workspace reference"),"."),(0,i.kt)("h2",{id:"example"},"Example"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\n\n"helloworld": ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "helloworld": c.Container {\n image = "gcr.io/google-samples/gb-frontend:v4"\n env: {\n "env1": "VALUE"\n "env2": "VALUE2"\n }\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n # Configure an HTTP readiness probe\n readinessProbe: p.Probe {\n probeHandler: p.Http {\n url: "http://localhost:80"\n }\n initialDelaySeconds: 10\n }\n }\n }\n replicas: 2\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 8080\n targetPort: 80\n }\n ]\n }\n }\n}\n')),(0,i.kt)("p",null,"The code above changes the service port to expose from ",(0,i.kt)("inlineCode",{parentName:"p"},"80")," in the last guide to ",(0,i.kt)("inlineCode",{parentName:"p"},"8080"),", but still targeting the container port ",(0,i.kt)("inlineCode",{parentName:"p"},"80")," because that's what the application is listening on."),(0,i.kt)("h2",{id:"applying"},"Applying"),(0,i.kt)("p",null,"Re-run steps in ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", new service configuration can be applied."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private Update\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld UnChanged\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS Update v1:Service:simple-service:simple-service-dev-helloworld-private success \n SUCCESS UnChanged apps/v1:Deployment:simple-service:simple-service-dev-helloworld, skip \nUnChanged apps/v1:Deployment:simple-service:simple-service-dev-helloworld, skip [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,i.kt)("h2",{id:"validation"},"Validation"),(0,i.kt)("p",null,"We can verify the Kubernetes service now has the updated attributes (mapping service port 8080 to container port 80) as defined in the ",(0,i.kt)("inlineCode",{parentName:"p"},"ports")," configuration:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"kubectl get svc -n simple-service -o yaml\n...\n spec:\n ...\n ports:\n - name: simple-service-dev-helloworld-private-8080-tcp\n port: 8080\n protocol: TCP\n targetPort: 80\n...\n")),(0,i.kt)("p",null,"Exposing service port 8080:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"kubectl port-forward svc/simple-service-dev-helloworld-private -n simple-service 30000:8080\n")),(0,i.kt)("p",null,"Open browser and visit ",(0,i.kt)("a",{parentName:"p",href:"http://127.0.0.1:30000"},"http://127.0.0.1:30000"),", the application should be up and running\uff1a"),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"app-preview",src:t(92287).Z,width:"1830",height:"330"})))}d.isMDXComponent=!0},92287:(e,n,t)=>{t.d(n,{Z:()=>r});const r=t.p+"assets/images/app-preview-de5274f4267fa725d2a65099e47c6c2c.png"}}]); \ No newline at end of file diff --git a/assets/js/4559f654.c457d849.js b/assets/js/4559f654.c457d849.js deleted file mode 100644 index b4f27798a31..00000000000 --- a/assets/js/4559f654.c457d849.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6873],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=p(r),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(f,s(s({ref:t},l),{},{components:r})):n.createElement(f,s({ref:t},l))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion generate",i={unversionedId:"reference/commands/kusion-generate",id:"version-v0.11/reference/commands/kusion-generate",title:"kusion generate",description:"Generate and print the resulting Spec resources of target Stack",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-generate.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-generate",permalink:"/docs/reference/commands/kusion-generate",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-generate.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion destroy",permalink:"/docs/reference/commands/kusion-destroy"},next:{title:"kusion init",permalink:"/docs/reference/commands/kusion-init"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-generate"},"kusion generate"),(0,o.kt)("p",null,"Generate and print the resulting Spec resources of target Stack"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," This command generates Spec resources with given values, then write the resulting Spec resources to specific output file or stdout.\n\n The nearest parent folder containing a stack.yaml file is loaded from the project in the current directory.\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion generate [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"\n # Generate and write Spec resources to specific output file\n kusion generate -o /tmp/spec.yaml\n\n # Generate spec with custom workspace\n kusion generate -o /tmp/spec.yaml --workspace dev\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string The backend to use, supports 'local', 'oss' and 's3'.\n -h, --help help for generate\n --no-style no-style sets to RawOutput mode and disables all of styling\n -o, --output string File to write generated Spec resources to\n --set stringArray Set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)\n -w, --workdir string The work directory to run Kusion CLI.\n --workspace string The name of target workspace to operate in.\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4559f654.f8b6f069.js b/assets/js/4559f654.f8b6f069.js new file mode 100644 index 00000000000..cb3d885c771 --- /dev/null +++ b/assets/js/4559f654.f8b6f069.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6873],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=p(r),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(f,s(s({ref:t},l),{},{components:r})):n.createElement(f,s({ref:t},l))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion generate",i={unversionedId:"reference/commands/kusion-generate",id:"version-v0.11/reference/commands/kusion-generate",title:"kusion generate",description:"Generate and print the resulting Spec resources of target Stack",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-generate.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-generate",permalink:"/docs/reference/commands/kusion-generate",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-generate.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion destroy",permalink:"/docs/reference/commands/kusion-destroy"},next:{title:"kusion init",permalink:"/docs/reference/commands/kusion-init"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-generate"},"kusion generate"),(0,o.kt)("p",null,"Generate and print the resulting Spec resources of target Stack"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," This command generates Spec resources with given values, then write the resulting Spec resources to specific output file or stdout.\n\n The nearest parent folder containing a stack.yaml file is loaded from the project in the current directory.\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion generate [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"\n # Generate and write Spec resources to specific output file\n kusion generate -o /tmp/spec.yaml\n\n # Generate spec with custom workspace\n kusion generate -o /tmp/spec.yaml --workspace dev\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string The backend to use, supports 'local', 'oss' and 's3'.\n -h, --help help for generate\n --no-style no-style sets to RawOutput mode and disables all of styling\n -o, --output string File to write generated Spec resources to\n --set stringArray Set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2)\n -w, --workdir string The work directory to run Kusion CLI.\n --workspace string The name of target workspace to operate in.\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/462b352b.e82a1cb3.js b/assets/js/462b352b.e82a1cb3.js deleted file mode 100644 index c159736fd70..00000000000 --- a/assets/js/462b352b.e82a1cb3.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7240],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),c=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},p=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=c(n),m=i,k=u["".concat(s,".").concat(m)]||u[m]||d[m]||o;return n?a.createElement(k,r(r({ref:t},p),{},{components:n})):a.createElement(k,r({ref:t},p))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,r=new Array(o);r[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>r,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var a=n(87462),i=(n(67294),n(3905));const o={sidebar_position:1},r="Configuration File Overview",l={unversionedId:"config-walkthrough/overview",id:"version-v0.9/config-walkthrough/overview",title:"Configuration File Overview",description:"Kusion consumes one or more declarative configuration files (written in KCL) that describe the application, and delivers intent to the target runtime including Kubernetes, clouds, or on-prem infrastructure.",source:"@site/docs_versioned_docs/version-v0.9/config-walkthrough/overview.md",sourceDirName:"config-walkthrough",slug:"/config-walkthrough/overview",permalink:"/docs/v0.9/config-walkthrough/overview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/config-walkthrough/overview.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"kusion",previous:{title:"Intent",permalink:"/docs/v0.9/concepts/intent"},next:{title:"KCL Basics",permalink:"/docs/v0.9/config-walkthrough/kcl_basics"}},s={},c=[{value:"Table of Content",id:"table-of-content",level:2},{value:"Directory Structure",id:"directory-structure",level:2},{value:"AppConfiguration Model",id:"appconfiguration-model",level:2},{value:"Authoring Configuration Files",id:"authoring-configuration-files",level:2},{value:"Identifying KCL file",id:"identifying-kcl-file",level:3},{value:"KCL Packages and Import",id:"kcl-packages-and-import",level:3},{value:"Understanding kcl.mod",id:"understanding-kclmod",level:3},{value:"Building Blocks",id:"building-blocks",level:3},{value:"Instantiating an application",id:"instantiating-an-application",level:3},{value:"Using kusion init",id:"using-kusion-init",level:3},{value:"Using references",id:"using-references",level:3}],p={toc:c};function d(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"configuration-file-overview"},"Configuration File Overview"),(0,i.kt)("p",null,"Kusion consumes one or more declarative configuration files (written in KCL) that describe the application, and delivers intent to the target runtime including Kubernetes, clouds, or on-prem infrastructure."),(0,i.kt)("p",null,"This documentation series walks you through the odds and ends of managing such configuration files."),(0,i.kt)("h2",{id:"table-of-content"},"Table of Content"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#directory-structure"},"Directory Structure")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#appconfiguration-model"},"AppConfiguration Model")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#authoring-configuration-files"},"Authoring Configuration Files"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#identifying-kcl-file"},"Identifying KCL file")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#kcl-packages-and-import"},"KCL Packages and imports")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#understanding-kclmod"},"Understanding kcl.mod")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#building-blocks"},"Building blocks")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#instantiating-an-application"},"Instantiate an application")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#using-kusion-init"},"Using kusion init")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#using-references"},"Using references"))))),(0,i.kt)("h2",{id:"directory-structure"},"Directory Structure"),(0,i.kt)("p",null,"Kusion expects the configuration file to be placed in a certain directory structure because it might need some metadata (that is not stored in the application configuration itself) in order to proceed."),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"See ",(0,i.kt)("a",{parentName:"p",href:"../concepts/glossary"},"Glossary")," for more details about Project and Stack.")),(0,i.kt)("p",null,"A sample multi-stack directory structure looks like the following:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"~/playground$ tree multi-stack-project/\nmulti-stack-project/\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 base\n\u2502\xa0\xa0 \u2514\u2500\u2500 base.k\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod.lock\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u251c\u2500\u2500 prod\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod.lock\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n")),(0,i.kt)("p",null,"In general, the directory structure follows a hierarchy where the top-level is the project configurations, and the sub-directories represent stack-level configurations."),(0,i.kt)("p",null,"You may notice there is a ",(0,i.kt)("inlineCode",{parentName:"p"},"base")," directory besides all the stacks. The ",(0,i.kt)("inlineCode",{parentName:"p"},"base")," directory is not mandatory, but rather a place to store common configurations between different stacks. A common pattern we observed is to use stacks to represent different stages (dev, stage, prod, etc.) in the software development lifecycle, and/or different deployment targets (azure-eastus, aws-us-east-1, etc). A project can have as many stacks as needed."),(0,i.kt)("p",null,"In practice, the applications deployed into dev and prod might very likely end up with a similar set of configurations except a few fields such as the application image (dev might be on newer versions), resource requirements (prod might require more resources), etc."),(0,i.kt)("p",null,"As a general best practice, we recommend managing the common configurations in ",(0,i.kt)("inlineCode",{parentName:"p"},"base.k")," as much as possible to minimize duplicate code. We will cover how override works in ",(0,i.kt)("a",{parentName:"p",href:"base_override"},"Base and Override"),"."),(0,i.kt)("h2",{id:"appconfiguration-model"},"AppConfiguration Model"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," is the out-of-the-box model we build that describes an application. It serves as the declarative intent for a given application."),(0,i.kt)("p",null,"The schema for ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," is defined in the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"KusionStack/catalog")," repository. It is designed as a unified, application-centric model that encapsulates the comprehensive configuration details and in the meantime, hides the complexity of the infrastructure as much as possible."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," consists of multiple sub-components that each represent either the application workload itself, its dependencies, relevant workflows or operational expectations. We will deep dive into the details on how to author each of these elements in this upcoming documentation series."),(0,i.kt)("p",null,"For more details on the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),", please refer to the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/pull/420/files"},"design documentation - WIP"),"."),(0,i.kt)("h2",{id:"authoring-configuration-files"},"Authoring Configuration Files"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/"},"KCL")," is the choice of configuration language consumed by Kusion. KCL is an open source constraint-based record and functional language. KCL works well with a large number of complex configurations via modern programming language technology and practice, and is committed to provide better modularity, scalability, stability and extensibility."),(0,i.kt)("h3",{id:"identifying-kcl-file"},"Identifying KCL file"),(0,i.kt)("p",null,"KCL files are identified with ",(0,i.kt)("inlineCode",{parentName:"p"},".k")," suffix in the filename."),(0,i.kt)("h3",{id:"kcl-packages-and-import"},"KCL Packages and Import"),(0,i.kt)("p",null,"Similar to most modern General Programming Languages (GPLs), KCL packages are used to organize collections of related KCL source files into modular and re-usable units."),(0,i.kt)("p",null,"In the context of Kusion, we use KCL packages to define models that could best abstract the behavior of an application. Specifically, we provide an official out-of-the-box KCL package(will keep iterating) with the name ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"catalog"),". When authoring an application configuration file, you can simply import the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"catalog")," package in the source code and use all the schemas (including AppConfiguration) defined in the ",(0,i.kt)("inlineCode",{parentName:"p"},"catalog")," package."),(0,i.kt)("p",null,"Similarly, if the schemas in the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"catalog")," package does not meet your needs, you can always fork it and make modifications, then import the modified package; or create a brand new package altogether and import it."),(0,i.kt)("p",null,"The Kusion ecosystem can be easily expanded in this manner."),(0,i.kt)("p",null,"An example of the import looks like the following:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"### import from the official catalog package\nimport catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\n\n### import my own modified package\nimport my_own_catalog.models.schema.v1 as moc\nimport my_other_package.schema.v1.redis as myredis\n")),(0,i.kt)("p",null,"Take ",(0,i.kt)("inlineCode",{parentName:"p"},"import catalog.models.schema.v1.workload as wl")," as an example, the ",(0,i.kt)("inlineCode",{parentName:"p"},".models.schema.v1.workload")," part after ",(0,i.kt)("inlineCode",{parentName:"p"},"import catalog")," represents the relative path of a specific schema to import. In this case, the ",(0,i.kt)("inlineCode",{parentName:"p"},"workload")," schemas is defined under ",(0,i.kt)("inlineCode",{parentName:"p"},"models/schema/v1/workload")," directory in the ",(0,i.kt)("inlineCode",{parentName:"p"},"catalog")," package."),(0,i.kt)("h3",{id:"understanding-kclmod"},"Understanding kcl.mod"),(0,i.kt)("p",null,"Much similar to the concept of ",(0,i.kt)("inlineCode",{parentName:"p"},"go.mod"),", Kusion uses ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod")," as the source of truth to manage metadata (such as package name, dependencies, etc.) for the current package. Kusion will also auto-generate a ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod.lock")," as the dependency lock file."),(0,i.kt)("p",null,"The most common usage for ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod")," is to manage the dependency of your application configurations. "),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"Please note this ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod")," will be automatically generated if you are using ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," to initialize a project with a template. You will only need to modify this file if you are modifying the project metadata outside the initialization process, such as upgrading the dependency version or adding a new dependency altogether, etc.")),(0,i.kt)("p",null,"There are 3 sections in a ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"package"),", representing the metadata for the current package."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"dependencies"),", describing the packages the current package depend on. Supports referencing either a git repository or an OCI artifact."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"profile"),", defining the behavior for Kusion. In the example below, it describes the list of files Kusion should look for when parsing the application configuration.")),(0,i.kt)("p",null,"An example of ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'[package]\nname = "multi-stack-project"\nedition = "0.5.0"\nversion = "0.1.0"\n\n[dependencies]\ncatalog = { git = "https://github.com/KusionStack/catalog.git", tag = "0.1.0" }\n# Uncomment the line below to use your own modified package\n# my-package = ghcr.io/kcl-lang/my-package\n\n[profile]\nentries = ["../base/base.k", "main.k"]\n')),(0,i.kt)("h3",{id:"building-blocks"},"Building Blocks"),(0,i.kt)("p",null,"Configuration files consist of building blocks that are made of instances of schemas. An ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance consists of several child schemas, most of which are optional. The only mandatory one is the ",(0,i.kt)("inlineCode",{parentName:"p"},"workload")," instance. We will take a closer look in the ",(0,i.kt)("a",{parentName:"p",href:"workload"},"workload walkthrough"),". The order of the building blocks does NOT matter."),(0,i.kt)("p",null,"The major building blocks as of version ",(0,i.kt)("inlineCode",{parentName:"p"},"0.9.0"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {}\n ...\n }\n ports: []\n secrets: {}\n }\n database: d.Database{}\n monitoring: m.Prometheus{}\n opsRule: t.OpsRule {}\n ...\n}\n')),(0,i.kt)("p",null,"We will deep dive into each one of the building blocks in this documentation series."),(0,i.kt)("h3",{id:"instantiating-an-application"},"Instantiating an application"),(0,i.kt)("p",null,"In Kusion's out-of-the-box experience, an application is identified with an instance of ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),". You may have more than one application in the same project or stack."),(0,i.kt)("p",null,"Here's an example of a configuration that can be consumed by Kusion (assuming it is placed inside the proper directory structure that includes project and stack configurations, with a ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod")," present):"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.network as n\nimport catalog.models.schema.v1.workload.container as c\n\ngocity: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "gocity": c.Container {\n image = "howieyuen/gocity:latest"\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n ports: [\n n.Port {\n port: 4000\n }\n ]\n }\n}\n')),(0,i.kt)("p",null,"Don't worry about what ",(0,i.kt)("inlineCode",{parentName:"p"},"workload")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"ports")," stand for at the moment. We will deep dive into each one of them in this upcoming documentation series."),(0,i.kt)("h3",{id:"using-kusion-init"},"Using ",(0,i.kt)("inlineCode",{parentName:"h3"},"kusion init")),(0,i.kt)("p",null,"Kusion offers a ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," sub-command which initializes a new project using some pre-built templates, which saves you from the hassle to manually build the aforementioned directory structure that Kusion expects."),(0,i.kt)("p",null,"There is a built-in template ",(0,i.kt)("inlineCode",{parentName:"p"},"single-stack-sample")," in the kusion binary that can be used offline. "),(0,i.kt)("p",null,"We also maintain a ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion-templates"},"kusion-templates repository")," that hosts a list of more comprehensive project scaffolds. You can access them via ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init --online")," command which requires connectivity to ",(0,i.kt)("inlineCode",{parentName:"p"},"github.com"),"."),(0,i.kt)("p",null,"The pre-built templates are meant to help you get off the ground quickly with some simple out-of-the-box examples. You can refer to the ",(0,i.kt)("a",{parentName:"p",href:"../getting-started/deliver-wordpress"},"QuickStart documentation")," for some step-by-step tutorials."),(0,i.kt)("h3",{id:"using-references"},"Using references"),(0,i.kt)("p",null,"The reference documentation for the ",(0,i.kt)("inlineCode",{parentName:"p"},"catalog")," package is located in ",(0,i.kt)("a",{parentName:"p",href:"../reference/model/catalog_models/doc_app_configuration"},"Reference"),"."),(0,i.kt)("p",null,"If you are using the ",(0,i.kt)("inlineCode",{parentName:"p"},"catalog")," package out of the box, the reference documentation provides a comprehensive view for each schema involved, including all the attribute names and description, their types, default value if any, and whether a particular attribute is required or not. There will also be an example attached to each schema reference."),(0,i.kt)("p",null,"We will also deep dive into some common examples in the upcoming sections."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/462b352b.f462ffde.js b/assets/js/462b352b.f462ffde.js new file mode 100644 index 00000000000..685f767231c --- /dev/null +++ b/assets/js/462b352b.f462ffde.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7240],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),c=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},p=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=c(n),m=i,k=u["".concat(s,".").concat(m)]||u[m]||d[m]||o;return n?a.createElement(k,r(r({ref:t},p),{},{components:n})):a.createElement(k,r({ref:t},p))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,r=new Array(o);r[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>r,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var a=n(87462),i=(n(67294),n(3905));const o={sidebar_position:1},r="Configuration File Overview",l={unversionedId:"config-walkthrough/overview",id:"version-v0.9/config-walkthrough/overview",title:"Configuration File Overview",description:"Kusion consumes one or more declarative configuration files (written in KCL) that describe the application, and delivers intent to the target runtime including Kubernetes, clouds, or on-prem infrastructure.",source:"@site/docs_versioned_docs/version-v0.9/config-walkthrough/overview.md",sourceDirName:"config-walkthrough",slug:"/config-walkthrough/overview",permalink:"/docs/v0.9/config-walkthrough/overview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/config-walkthrough/overview.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"kusion",previous:{title:"Intent",permalink:"/docs/v0.9/concepts/intent"},next:{title:"KCL Basics",permalink:"/docs/v0.9/config-walkthrough/kcl_basics"}},s={},c=[{value:"Table of Content",id:"table-of-content",level:2},{value:"Directory Structure",id:"directory-structure",level:2},{value:"AppConfiguration Model",id:"appconfiguration-model",level:2},{value:"Authoring Configuration Files",id:"authoring-configuration-files",level:2},{value:"Identifying KCL file",id:"identifying-kcl-file",level:3},{value:"KCL Packages and Import",id:"kcl-packages-and-import",level:3},{value:"Understanding kcl.mod",id:"understanding-kclmod",level:3},{value:"Building Blocks",id:"building-blocks",level:3},{value:"Instantiating an application",id:"instantiating-an-application",level:3},{value:"Using kusion init",id:"using-kusion-init",level:3},{value:"Using references",id:"using-references",level:3}],p={toc:c};function d(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"configuration-file-overview"},"Configuration File Overview"),(0,i.kt)("p",null,"Kusion consumes one or more declarative configuration files (written in KCL) that describe the application, and delivers intent to the target runtime including Kubernetes, clouds, or on-prem infrastructure."),(0,i.kt)("p",null,"This documentation series walks you through the odds and ends of managing such configuration files."),(0,i.kt)("h2",{id:"table-of-content"},"Table of Content"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#directory-structure"},"Directory Structure")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#appconfiguration-model"},"AppConfiguration Model")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#authoring-configuration-files"},"Authoring Configuration Files"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#identifying-kcl-file"},"Identifying KCL file")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#kcl-packages-and-import"},"KCL Packages and imports")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#understanding-kclmod"},"Understanding kcl.mod")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#building-blocks"},"Building blocks")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#instantiating-an-application"},"Instantiate an application")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#using-kusion-init"},"Using kusion init")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#using-references"},"Using references"))))),(0,i.kt)("h2",{id:"directory-structure"},"Directory Structure"),(0,i.kt)("p",null,"Kusion expects the configuration file to be placed in a certain directory structure because it might need some metadata (that is not stored in the application configuration itself) in order to proceed."),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"See ",(0,i.kt)("a",{parentName:"p",href:"../concepts/glossary"},"Glossary")," for more details about Project and Stack.")),(0,i.kt)("p",null,"A sample multi-stack directory structure looks like the following:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"~/playground$ tree multi-stack-project/\nmulti-stack-project/\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 base\n\u2502\xa0\xa0 \u2514\u2500\u2500 base.k\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod.lock\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u251c\u2500\u2500 prod\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod.lock\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n")),(0,i.kt)("p",null,"In general, the directory structure follows a hierarchy where the top-level is the project configurations, and the sub-directories represent stack-level configurations."),(0,i.kt)("p",null,"You may notice there is a ",(0,i.kt)("inlineCode",{parentName:"p"},"base")," directory besides all the stacks. The ",(0,i.kt)("inlineCode",{parentName:"p"},"base")," directory is not mandatory, but rather a place to store common configurations between different stacks. A common pattern we observed is to use stacks to represent different stages (dev, stage, prod, etc.) in the software development lifecycle, and/or different deployment targets (azure-eastus, aws-us-east-1, etc). A project can have as many stacks as needed."),(0,i.kt)("p",null,"In practice, the applications deployed into dev and prod might very likely end up with a similar set of configurations except a few fields such as the application image (dev might be on newer versions), resource requirements (prod might require more resources), etc."),(0,i.kt)("p",null,"As a general best practice, we recommend managing the common configurations in ",(0,i.kt)("inlineCode",{parentName:"p"},"base.k")," as much as possible to minimize duplicate code. We will cover how override works in ",(0,i.kt)("a",{parentName:"p",href:"base_override"},"Base and Override"),"."),(0,i.kt)("h2",{id:"appconfiguration-model"},"AppConfiguration Model"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," is the out-of-the-box model we build that describes an application. It serves as the declarative intent for a given application."),(0,i.kt)("p",null,"The schema for ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," is defined in the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"KusionStack/catalog")," repository. It is designed as a unified, application-centric model that encapsulates the comprehensive configuration details and in the meantime, hides the complexity of the infrastructure as much as possible."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," consists of multiple sub-components that each represent either the application workload itself, its dependencies, relevant workflows or operational expectations. We will deep dive into the details on how to author each of these elements in this upcoming documentation series."),(0,i.kt)("p",null,"For more details on the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),", please refer to the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/pull/420/files"},"design documentation - WIP"),"."),(0,i.kt)("h2",{id:"authoring-configuration-files"},"Authoring Configuration Files"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/"},"KCL")," is the choice of configuration language consumed by Kusion. KCL is an open source constraint-based record and functional language. KCL works well with a large number of complex configurations via modern programming language technology and practice, and is committed to provide better modularity, scalability, stability and extensibility."),(0,i.kt)("h3",{id:"identifying-kcl-file"},"Identifying KCL file"),(0,i.kt)("p",null,"KCL files are identified with ",(0,i.kt)("inlineCode",{parentName:"p"},".k")," suffix in the filename."),(0,i.kt)("h3",{id:"kcl-packages-and-import"},"KCL Packages and Import"),(0,i.kt)("p",null,"Similar to most modern General Programming Languages (GPLs), KCL packages are used to organize collections of related KCL source files into modular and re-usable units."),(0,i.kt)("p",null,"In the context of Kusion, we use KCL packages to define models that could best abstract the behavior of an application. Specifically, we provide an official out-of-the-box KCL package(will keep iterating) with the name ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"catalog"),". When authoring an application configuration file, you can simply import the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"catalog")," package in the source code and use all the schemas (including AppConfiguration) defined in the ",(0,i.kt)("inlineCode",{parentName:"p"},"catalog")," package."),(0,i.kt)("p",null,"Similarly, if the schemas in the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"catalog")," package does not meet your needs, you can always fork it and make modifications, then import the modified package; or create a brand new package altogether and import it."),(0,i.kt)("p",null,"The Kusion ecosystem can be easily expanded in this manner."),(0,i.kt)("p",null,"An example of the import looks like the following:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"### import from the official catalog package\nimport catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\n\n### import my own modified package\nimport my_own_catalog.models.schema.v1 as moc\nimport my_other_package.schema.v1.redis as myredis\n")),(0,i.kt)("p",null,"Take ",(0,i.kt)("inlineCode",{parentName:"p"},"import catalog.models.schema.v1.workload as wl")," as an example, the ",(0,i.kt)("inlineCode",{parentName:"p"},".models.schema.v1.workload")," part after ",(0,i.kt)("inlineCode",{parentName:"p"},"import catalog")," represents the relative path of a specific schema to import. In this case, the ",(0,i.kt)("inlineCode",{parentName:"p"},"workload")," schemas is defined under ",(0,i.kt)("inlineCode",{parentName:"p"},"models/schema/v1/workload")," directory in the ",(0,i.kt)("inlineCode",{parentName:"p"},"catalog")," package."),(0,i.kt)("h3",{id:"understanding-kclmod"},"Understanding kcl.mod"),(0,i.kt)("p",null,"Much similar to the concept of ",(0,i.kt)("inlineCode",{parentName:"p"},"go.mod"),", Kusion uses ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod")," as the source of truth to manage metadata (such as package name, dependencies, etc.) for the current package. Kusion will also auto-generate a ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod.lock")," as the dependency lock file."),(0,i.kt)("p",null,"The most common usage for ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod")," is to manage the dependency of your application configurations. "),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"Please note this ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod")," will be automatically generated if you are using ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," to initialize a project with a template. You will only need to modify this file if you are modifying the project metadata outside the initialization process, such as upgrading the dependency version or adding a new dependency altogether, etc.")),(0,i.kt)("p",null,"There are 3 sections in a ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"package"),", representing the metadata for the current package."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"dependencies"),", describing the packages the current package depend on. Supports referencing either a git repository or an OCI artifact."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"profile"),", defining the behavior for Kusion. In the example below, it describes the list of files Kusion should look for when parsing the application configuration.")),(0,i.kt)("p",null,"An example of ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'[package]\nname = "multi-stack-project"\nedition = "0.5.0"\nversion = "0.1.0"\n\n[dependencies]\ncatalog = { git = "https://github.com/KusionStack/catalog.git", tag = "0.1.0" }\n# Uncomment the line below to use your own modified package\n# my-package = ghcr.io/kcl-lang/my-package\n\n[profile]\nentries = ["../base/base.k", "main.k"]\n')),(0,i.kt)("h3",{id:"building-blocks"},"Building Blocks"),(0,i.kt)("p",null,"Configuration files consist of building blocks that are made of instances of schemas. An ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance consists of several child schemas, most of which are optional. The only mandatory one is the ",(0,i.kt)("inlineCode",{parentName:"p"},"workload")," instance. We will take a closer look in the ",(0,i.kt)("a",{parentName:"p",href:"workload"},"workload walkthrough"),". The order of the building blocks does NOT matter."),(0,i.kt)("p",null,"The major building blocks as of version ",(0,i.kt)("inlineCode",{parentName:"p"},"0.9.0"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {}\n ...\n }\n ports: []\n secrets: {}\n }\n database: d.Database{}\n monitoring: m.Prometheus{}\n opsRule: t.OpsRule {}\n ...\n}\n')),(0,i.kt)("p",null,"We will deep dive into each one of the building blocks in this documentation series."),(0,i.kt)("h3",{id:"instantiating-an-application"},"Instantiating an application"),(0,i.kt)("p",null,"In Kusion's out-of-the-box experience, an application is identified with an instance of ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),". You may have more than one application in the same project or stack."),(0,i.kt)("p",null,"Here's an example of a configuration that can be consumed by Kusion (assuming it is placed inside the proper directory structure that includes project and stack configurations, with a ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod")," present):"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.network as n\nimport catalog.models.schema.v1.workload.container as c\n\ngocity: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "gocity": c.Container {\n image = "howieyuen/gocity:latest"\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n ports: [\n n.Port {\n port: 4000\n }\n ]\n }\n}\n')),(0,i.kt)("p",null,"Don't worry about what ",(0,i.kt)("inlineCode",{parentName:"p"},"workload")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"ports")," stand for at the moment. We will deep dive into each one of them in this upcoming documentation series."),(0,i.kt)("h3",{id:"using-kusion-init"},"Using ",(0,i.kt)("inlineCode",{parentName:"h3"},"kusion init")),(0,i.kt)("p",null,"Kusion offers a ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," sub-command which initializes a new project using some pre-built templates, which saves you from the hassle to manually build the aforementioned directory structure that Kusion expects."),(0,i.kt)("p",null,"There is a built-in template ",(0,i.kt)("inlineCode",{parentName:"p"},"single-stack-sample")," in the kusion binary that can be used offline. "),(0,i.kt)("p",null,"We also maintain a ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion-templates"},"kusion-templates repository")," that hosts a list of more comprehensive project scaffolds. You can access them via ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init --online")," command which requires connectivity to ",(0,i.kt)("inlineCode",{parentName:"p"},"github.com"),"."),(0,i.kt)("p",null,"The pre-built templates are meant to help you get off the ground quickly with some simple out-of-the-box examples. You can refer to the ",(0,i.kt)("a",{parentName:"p",href:"../getting-started/deliver-wordpress"},"QuickStart documentation")," for some step-by-step tutorials."),(0,i.kt)("h3",{id:"using-references"},"Using references"),(0,i.kt)("p",null,"The reference documentation for the ",(0,i.kt)("inlineCode",{parentName:"p"},"catalog")," package is located in ",(0,i.kt)("a",{parentName:"p",href:"../reference/model/catalog_models/doc_app_configuration"},"Reference"),"."),(0,i.kt)("p",null,"If you are using the ",(0,i.kt)("inlineCode",{parentName:"p"},"catalog")," package out of the box, the reference documentation provides a comprehensive view for each schema involved, including all the attribute names and description, their types, default value if any, and whether a particular attribute is required or not. There will also be an example attached to each schema reference."),(0,i.kt)("p",null,"We will also deep dive into some common examples in the upcoming sections."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/47943cb5.c0e6220e.js b/assets/js/47943cb5.c0e6220e.js new file mode 100644 index 00000000000..fa87018aa58 --- /dev/null +++ b/assets/js/47943cb5.c0e6220e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9029],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>u});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=a.createContext({}),c=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=c(e.components);return a.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},k=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,l=e.parentName,p=r(e,["components","mdxType","originalType","parentName"]),k=c(n),u=i,m=k["".concat(l,".").concat(u)]||k[u]||d[u]||o;return n?a.createElement(m,s(s({ref:t},p),{},{components:n})):a.createElement(m,s({ref:t},p))}));function u(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,s=new Array(o);s[0]=k;var r={};for(var l in t)hasOwnProperty.call(t,l)&&(r[l]=t[l]);r.originalType=e,r.mdxType="string"==typeof e?e:i,s[1]=r;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>o,metadata:()=>r,toc:()=>c});var a=n(87462),i=(n(67294),n(3905));const o={id:"backend",sidebar_label:"Backend"},s="Backend",r={unversionedId:"concepts/backend",id:"version-v0.11/concepts/backend",title:"Backend",description:"Backend is Kusion's storage, which defines the place to store Workspace, Spec and State. By default, Kusion uses the local type of backend to store the state on the local disk. While in the scenario of team collaboration, the Workspace, Spec and State can be stored on a remote backend, such as mysql, oss and s3, to allow multiple users' access.",source:"@site/docs_versioned_docs/version-v0.11/3-concepts/7-backend.md",sourceDirName:"3-concepts",slug:"/concepts/backend",permalink:"/docs/concepts/backend",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/3-concepts/7-backend.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:7,frontMatter:{id:"backend",sidebar_label:"Backend"},sidebar:"kusion",previous:{title:"Spec",permalink:"/docs/concepts/spec"},next:{title:"Configuration",permalink:"/docs/concepts/configuration"}},l={},c=[{value:"Available Backend Types",id:"available-backend-types",level:2},{value:"local",id:"local",level:3},{value:"mysql",id:"mysql",level:3},{value:"oss",id:"oss",level:3},{value:"s3",id:"s3",level:3},{value:"Setting a Backend",id:"setting-a-backend",level:2},{value:"Setting a Whole Backend",id:"setting-a-whole-backend",level:3},{value:"Setting a Backend Type",id:"setting-a-backend-type",level:3},{value:"Setting a Whole Set of Backend Config Items",id:"setting-a-whole-set-of-backend-config-items",level:3},{value:"Setting a Backend Config Item",id:"setting-a-backend-config-item",level:3},{value:"Unsetting a Backend",id:"unsetting-a-backend",level:2},{value:"Setting the Current Backend",id:"setting-the-current-backend",level:2},{value:"Getting Backend Configuration",id:"getting-backend-configuration",level:2},{value:"Using Backend",id:"using-backend",level:2}],p={toc:c};function d(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"backend"},"Backend"),(0,i.kt)("p",null,"Backend is Kusion's storage, which defines the place to store Workspace, Spec and State. By default, Kusion uses the ",(0,i.kt)("inlineCode",{parentName:"p"},"local")," type of backend to store the state on the local disk. While in the scenario of team collaboration, the Workspace, Spec and State can be stored on a remote backend, such as ",(0,i.kt)("inlineCode",{parentName:"p"},"mysql"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"oss")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"s3"),", to allow multiple users' access. "),(0,i.kt)("p",null,"The command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config")," is used to configure the backend configuration. Configuring a whole backend or an individual config item are both supported. For the sensitive data, the environment variables are supported, and with higher priority."),(0,i.kt)("p",null,"Furthermore, Kusion provides the operation of setting current backend. Thus, the trouble of specifying backend can be saved when executing operation commands and managing ",(0,i.kt)("inlineCode",{parentName:"p"},"workspace"),". "),(0,i.kt)("h2",{id:"available-backend-types"},"Available Backend Types"),(0,i.kt)("p",null,"There are four available backend types: ",(0,i.kt)("inlineCode",{parentName:"p"},"local"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"mysql"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"oss"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"s3"),"."),(0,i.kt)("h3",{id:"local"},"local"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"local")," type backend uses local file system as storage, which is suitable for local operations, but not ideal for multi-user collaboration. The supported config items are as below."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"path"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"optional"),", specify the directory to store the Workspace, Spec, and State files. The subdirectories ",(0,i.kt)("inlineCode",{parentName:"li"},"workspaces"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"specs")," and ",(0,i.kt)("inlineCode",{parentName:"li"},"states")," are used to store the corresponding files separately. It's recommended to use an empty or a Kusion exclusive directory as the local backend path. If not set, the default path ",(0,i.kt)("inlineCode",{parentName:"li"},"${KUSION_HOME}")," is in use.")),(0,i.kt)("p",null,"The whole local type backend configuration is as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},'{\n "type": "local",\n "configs": {\n "path": "${local_path}" # type string, optional, the directory to store files.\n }\n}\n')),(0,i.kt)("h3",{id:"mysql"},"mysql"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"mysql")," type backend uses mysql database as storage. The supported config items are as below."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"dbName"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", the name of the database."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"user"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", the username of the database. "),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"password"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"optional"),", the password of the database, support declaring by environment variable ",(0,i.kt)("inlineCode",{parentName:"li"},"KUSION_BACKEND_MYSQL_PASSWORD"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"host")," - ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", the access address for the database."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"port")," - ",(0,i.kt)("inlineCode",{parentName:"li"},"type int"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"optional"),", the port of the database. If not set, the default value ",(0,i.kt)("inlineCode",{parentName:"li"},"3306")," will be used.")),(0,i.kt)("p",null,"Please be attention, mysql type are not supported to store Spec for now. For Workspace and State, the table ",(0,i.kt)("inlineCode",{parentName:"p"},"worksapce")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"state")," are used to store the corresponding content separately, whose structures are determinate. The table structures are shown below. "),(0,i.kt)("p",null,"Noted that there are not fields ",(0,i.kt)("inlineCode",{parentName:"p"},"id"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"gmt_create(created_at)"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"gmt_modified(updated_at)"),", etc., which are usually automatically controlled by the database. Kusion does not use these fields, while the existence of them does not affect the normal operation of Kusion. And the length of the varchar can be changed according to the real scenario."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sql"},"-- table workspace\nCREATE TABLE `workspace` (\n `workspace` varchar(127) NOT NULL COMMENT 'workspace name',\n `content` longtext NOT NULL COMMENT 'workspace content, in JSON format',\n `is_current` tinyint(1) DEFAULT NULL COMMENT 'specify is current workspace or not',\n UNIQUE KEY `uk_workspace` (`name`),\n KEY `idx_is_current` (`is_current`)\n);\n\n-- table state\nCREATE TABLE `state` (\n `project` varchar(127) NOT NULL COMMENT 'project name',\n `stack` varchar(127) NOT NULL COMMENT 'stack name',\n `workspace` varchar(127) NOT NULL COMMENT 'workspace name',\n `content` longtext NOT NULL COMMENT 'state content, in JSON format',\n UNIQUE KEY `uk_state` (`project`, `stack`, `worksapce`)\n);\n")),(0,i.kt)("p",null,"The whole mysql type backend configuration is as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},'{\n "type": "mysql",\n "configs": {\n "dbName": "${mysql_db_name}", # type string, required, the database name.\n "user": "${mysql_user}", # type string, required, the database user.\n "password": "${mysql_password}", # type string, optional, the database password.\n "host": "${mysql_host}", # type string, required, the database host.\n "port": "${mysql_port}" # type string, optional, the database port. If not set, use the default port 3306.\n }\n}\n')),(0,i.kt)("p",null,"The supported environment variable is as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},'export KUSION_BACKEND_MYSQL_PASSWORD="${mysql_password}" # configure password\n')),(0,i.kt)("h3",{id:"oss"},"oss"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"oss")," type backend uses the Alicloud Object Storage Service (OSS) as storage. The supported config items are as below."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"endpoint"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the access endpoint for alicloud oss bucket. "),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"accessKeyID"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the alicloud account accessKeyID, support declaring by environment variable ",(0,i.kt)("inlineCode",{parentName:"li"},"OSS_ACCESS_KEY_ID"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"accessKeySecret"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the alicloud account accessKeySecret, support declaring by environment variable ",(0,i.kt)("inlineCode",{parentName:"li"},"OSS_ACCESS_KEY_SECRET"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"bucket"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the name of the alicloud oss bucket."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"prefix"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"optional"),", constitute the prefix to store the Workspace, Spec, and State files, whose prefixes are ",(0,i.kt)("inlineCode",{parentName:"li"},"${prefix}/workspaces"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"${prefix}/specs")," and ",(0,i.kt)("inlineCode",{parentName:"li"},"${prefix}/states"),' respectively. Using prefix can create a "dedicated space" for the Kusion data, which is beneficial for the management and reuse of the bucket. If not set, there is no prefix, the files are stored in the root path of the bucket if analogy to a file system.')),(0,i.kt)("p",null,"Noted that ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeyID")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeySecret")," are required for the whole configuration combined by the configuration managed by the command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config")," and the environment variables. For the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config")," alone, they are not obligatory. And for the safety reason, using environment variables is the recommended way."),(0,i.kt)("p",null,"The whole oss type backend configuration is as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},'{\n "type": "oss",\n "configs": {\n "endpoint": "${oss_endpoint}", # type string, required, the oss endpoint.\n "accessKeyID": "${oss_access_key_id}", # type string, ooptional for the command "kusion config", the oss access key id.\n "accessKeySecret": "${oss_access_key_secret}", # type string, optional for the command "kusion config", the oss access key secret.\n "bucket": "${oss_bucket}", # type string, required, the oss bucket.\n "prefix": "${oss_prefix}" # type string, optional, the prefix to store the files.\n }\n}\n')),(0,i.kt)("p",null,"The supported environment variables are as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},'export OSS_ACCESS_KEY_ID="${oss-access-key-id}" # configure accessKeyID\nexport OSS_ACCESS_KEY_SECRET="${oss-access-key-secret}" # configure accessKeySecret\n')),(0,i.kt)("h3",{id:"s3"},"s3"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"s3")," type backend uses the AWS Simple Storage Service (S3) as storage. The supported config items are as below."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"region"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the region of aws s3 bucket, support declaring by environment variable ",(0,i.kt)("inlineCode",{parentName:"li"},"AWS_DEFAULT_REGION")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"AWS_REGION"),", where the latter has higher priority."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"endpoint"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"optional"),", specify the access endpoint for aws s3 bucket."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"accessKeyID"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the aws account accessKeyID, support declaring by environment variable ",(0,i.kt)("inlineCode",{parentName:"li"},"AWS_ACCESS_KEY_ID"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"accessKeySecret"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the aws account.accessKeySecret, support declaring by environment variable ",(0,i.kt)("inlineCode",{parentName:"li"},"AWS_SECRET_ACCESS_KEY"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"bucket"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the name of the aws s3 bucket."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"prefix"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"optional"),", constitute the prefix to store the Workspace, Spec, and State files, whose prefixes are ",(0,i.kt)("inlineCode",{parentName:"li"},"${prefix}/workspaces"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"${prefix}/specs")," and ",(0,i.kt)("inlineCode",{parentName:"li"},"${prefix}/states")," respectively.")),(0,i.kt)("p",null,"Noted that ",(0,i.kt)("inlineCode",{parentName:"p"},"region"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeyID")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeySecret")," are optional for the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config")," command."),(0,i.kt)("p",null,"The whole s3 type backend configuration is as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},'{\n "type": "s3",\n "configs": {\n "region": "${s3_region}", # type string, optional for the command "kusion config", the aws region.\n "endpoint": "${s3_endpoint}", # type string, optional, the aws endpoint. \n "accessKeyID": "${s3_access_key_id}", # type string, optional for the command "kusion config", the aws access key id.\n "accessKeySecret": "${s3_access_key_secret}", # type string, optional for the command "kusion config", the aws access key secret.\n "bucket": "${s3_bucket}", # type string, required, the s3 bucket.\n "prefix": "${s3_prefix}" # type string, optional, the prefix to store the files.\n }\n}\n')),(0,i.kt)("p",null,"The supported environment variables are as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},'export AWS_DEFAULT_REGION="${s3_region}" # configure region, lower priority than AWS_REGION\nexport AWS_REGION="${s3_region}" # configure region, higher priority than AWS_DEFAULT_REGION\nexport AWS_ACCESS_KEY_ID="${s3_access_key_id}" # configure accessKeyID\nexport AWS_SECRET_ACCESS_KEY="${s3_access_key_secret}" # configure accessKeySecret\n')),(0,i.kt)("h2",{id:"setting-a-backend"},"Setting a Backend"),(0,i.kt)("p",null,"When there is a new backend or the backend configuration needs to update, use the command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config set ${key} ${value}")," to set a backend. A backend is identified by a unique name, and its whole configuration is made up of the backend type and its corresponding config items. "),(0,i.kt)("p",null,"Be attention, do not confuse backend with backend type. For example, a backend named ",(0,i.kt)("inlineCode",{parentName:"p"},"s3_prod")," uses ",(0,i.kt)("inlineCode",{parentName:"p"},"s3")," as its storage, the ",(0,i.kt)("inlineCode",{parentName:"p"},"s3_prod")," is the backend, while the ",(0,i.kt)("inlineCode",{parentName:"p"},"s3")," is the backend type."),(0,i.kt)("p",null,"There are four configuration modes:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"setting a whole backend"),(0,i.kt)("li",{parentName:"ul"},"setting a backend type "),(0,i.kt)("li",{parentName:"ul"},"setting a whole set of backend config items"),(0,i.kt)("li",{parentName:"ul"},"setting a backend config item")),(0,i.kt)("p",null,"A unique backend name is required to do the configuration. Take ",(0,i.kt)("inlineCode",{parentName:"p"},"s3")," type backend with name ",(0,i.kt)("inlineCode",{parentName:"p"},"s3_prod")," for an example to explain how these modes work."),(0,i.kt)("h3",{id:"setting-a-whole-backend"},"Setting a Whole Backend"),(0,i.kt)("p",null,"The key to configure a whole backend is ",(0,i.kt)("inlineCode",{parentName:"p"},"backends.${name}"),", whose value must be the JSON marshal result in a specified format, which is determined by the backend type. Enclosing the value in single quotation marks is a good choice, which can keep the format correct. "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},'# set a whole backend\nkusion config set backends.s3_prod \'{"type":"s3","configs":{"bucket":"kusion"}}\'\n')),(0,i.kt)("h3",{id:"setting-a-backend-type"},"Setting a Backend Type"),(0,i.kt)("p",null,"The key to set a backend type is ",(0,i.kt)("inlineCode",{parentName:"p"},"backends.${name}.type"),", whose value must be ",(0,i.kt)("inlineCode",{parentName:"p"},"local"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"mysql"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"oss")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"s3"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"# set a backend type\nkusion config set backends.s3_prod.type s3\n")),(0,i.kt)("h3",{id:"setting-a-whole-set-of-backend-config-items"},"Setting a Whole Set of Backend Config Items"),(0,i.kt)("p",null,"The key to set a whole set of backend config items is ",(0,i.kt)("inlineCode",{parentName:"p"},"backends.${name}.configs"),", whose value must be the JSON marshal result in a specified format, which is determined by the backend type. The backend config must be set after the backend type, and corresponds to the backend type."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},'# set a whole backend config\nkusion config set backends.s3_prod.configs \'{"bucket":"kusion"}\'\n')),(0,i.kt)("h3",{id:"setting-a-backend-config-item"},"Setting a Backend Config Item"),(0,i.kt)("p",null,"The key to set a backend config item is ",(0,i.kt)("inlineCode",{parentName:"p"},"backends.${name}.configs.${item}"),". The item name and value type both depend on the backend type. Like the whole backend config, the config item must be valid and set after the backend type."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"# set a backend config item\nkusion config set backends.s3_prod.configs.bucket kusion\n")),(0,i.kt)("p",null,"When executing ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config set"),", the configuration will be stored in a local file. For security reason, the environment variables are supported to configure some config items, such as ",(0,i.kt)("inlineCode",{parentName:"p"},"password"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeyID"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeySecret"),". Using environment variables rather than ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config")," set to set sensitive data is the best practice. If both configured, the environment variables have higher priority. For details about the supported environment variables, please see above."),(0,i.kt)("p",null,"Kusion has a default backend with ",(0,i.kt)("inlineCode",{parentName:"p"},"local")," type and the path is ",(0,i.kt)("inlineCode",{parentName:"p"},"$KUSION_HOME"),", whose name is exactly ",(0,i.kt)("inlineCode",{parentName:"p"},"default"),". The ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," backend is forbidden to modification, that is setting or unsetting the default backend is not allowed. Besides, the keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"current")," is also used by Kusion itself, please do not use it as the backend name."),(0,i.kt)("h2",{id:"unsetting-a-backend"},"Unsetting a Backend"),(0,i.kt)("p",null,"When a backend is not in use, or the configuration is out of date, use the command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config unset ${key}")," to unset a backend or a specified config item. Same as the setting, there are also four modes of unsetting."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"unsetting a whole backend"),(0,i.kt)("li",{parentName:"ul"},"unsetting a backend type"),(0,i.kt)("li",{parentName:"ul"},"unsetting a whole set of backend config items"),(0,i.kt)("li",{parentName:"ul"},"unsetting a backend config item")),(0,i.kt)("p",null,"When unsetting a whole backend, the backend must not be the current backend. When unsetting the backend type, the config items must be empty and the backend not be the current."),(0,i.kt)("p",null,"Unsetting the ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," backend is forbidden."),(0,i.kt)("h2",{id:"setting-the-current-backend"},"Setting the Current Backend"),(0,i.kt)("p",null,"In order not to specify backend for every operation command. Kusion provides the mechanism of setting current backend, then the current workspace will be use by default. This is very useful when you execute a series of Kusion operation commands, for they usually use the same backend."),(0,i.kt)("p",null,"Use the command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config set backends.current ${name}")," to set the current backend, where the ",(0,i.kt)("inlineCode",{parentName:"p"},"name")," must be the already set backend."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"# set the current workspace\nkusion config set backends.current s3_prod\n")),(0,i.kt)("p",null,"Setting the current backend to ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," is legal. Actually, if there is no backend related configuration, the current backend is the ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," backend."),(0,i.kt)("h2",{id:"getting-backend-configuration"},"Getting Backend Configuration"),(0,i.kt)("p",null,"Use the command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config get ${key}")," to get a whole backend configuration or a specified backend config item. The ",(0,i.kt)("inlineCode",{parentName:"p"},"key")," is same as setting and unsetting operation, the whole list can be found in the ",(0,i.kt)("a",{parentName:"p",href:"configuration"},"Configuration"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"# get a whole backend\nkusion config get backends.s3_prod\n\n# get a specified config item\nkusion config get backends.s3_prod.configs.bucekt\n")),(0,i.kt)("p",null,"Besides, the command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config list")," can also be used, which returns the whole kusion configuration, while the backend configuration is included."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"# get the whole Kusion configuration \nkusion config list\n")),(0,i.kt)("h2",{id:"using-backend"},"Using Backend"),(0,i.kt)("p",null,"The backend is used to store Workspace, Spec, and State. Thus, the following commands use the backend, shown as below."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"subcommands of ",(0,i.kt)("inlineCode",{parentName:"li"},"kusion workspace"),": use to store the Workspace;"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"kusion generate"),": use to store the Spec;"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"kusion preview"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"kusion apply"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"kusion destroy"),": use to store the State;")),(0,i.kt)("p",null,"For all the commands above, the flag ",(0,i.kt)("inlineCode",{parentName:"p"},"--backend")," is provided to specify the backend, or using the current backend. When using backend, you usually need to specify the sensitive data by environment variables. The example is shown below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},'# set environment variables of sensitive and other necessary data\nexport AWS_REGION="${s3_region}"\nexport AWS_ACCESS_KEY_ID="${s3_access_key_id}"\nexport AWS_SECRET_ACCESS_KEY="${s3_access_key_secret}"\n\n# use current backend\nkusion apply\n\n# use a specified backend\nkusion apply --backend s3_prod\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/47943cb5.c3bc9807.js b/assets/js/47943cb5.c3bc9807.js deleted file mode 100644 index 6bcf4988cd0..00000000000 --- a/assets/js/47943cb5.c3bc9807.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9029],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>u});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=a.createContext({}),c=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=c(e.components);return a.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},k=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,l=e.parentName,p=r(e,["components","mdxType","originalType","parentName"]),k=c(n),u=i,m=k["".concat(l,".").concat(u)]||k[u]||d[u]||o;return n?a.createElement(m,s(s({ref:t},p),{},{components:n})):a.createElement(m,s({ref:t},p))}));function u(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,s=new Array(o);s[0]=k;var r={};for(var l in t)hasOwnProperty.call(t,l)&&(r[l]=t[l]);r.originalType=e,r.mdxType="string"==typeof e?e:i,s[1]=r;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>o,metadata:()=>r,toc:()=>c});var a=n(87462),i=(n(67294),n(3905));const o={id:"backend",sidebar_label:"Backend"},s="Backend",r={unversionedId:"concepts/backend",id:"version-v0.11/concepts/backend",title:"Backend",description:"Backend is Kusion's storage, which defines the place to store Workspace, Spec and State. By default, Kusion uses the local type of backend to store the state on the local disk. While in the scenario of team collaboration, the Workspace, Spec and State can be stored on a remote backend, such as mysql, oss and s3, to allow multiple users' access.",source:"@site/docs_versioned_docs/version-v0.11/3-concepts/7-backend.md",sourceDirName:"3-concepts",slug:"/concepts/backend",permalink:"/docs/concepts/backend",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/3-concepts/7-backend.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:7,frontMatter:{id:"backend",sidebar_label:"Backend"},sidebar:"kusion",previous:{title:"Spec",permalink:"/docs/concepts/spec"},next:{title:"Configuration",permalink:"/docs/concepts/configuration"}},l={},c=[{value:"Available Backend Types",id:"available-backend-types",level:2},{value:"local",id:"local",level:3},{value:"mysql",id:"mysql",level:3},{value:"oss",id:"oss",level:3},{value:"s3",id:"s3",level:3},{value:"Setting a Backend",id:"setting-a-backend",level:2},{value:"Setting a Whole Backend",id:"setting-a-whole-backend",level:3},{value:"Setting a Backend Type",id:"setting-a-backend-type",level:3},{value:"Setting a Whole Set of Backend Config Items",id:"setting-a-whole-set-of-backend-config-items",level:3},{value:"Setting a Backend Config Item",id:"setting-a-backend-config-item",level:3},{value:"Unsetting a Backend",id:"unsetting-a-backend",level:2},{value:"Setting the Current Backend",id:"setting-the-current-backend",level:2},{value:"Getting Backend Configuration",id:"getting-backend-configuration",level:2},{value:"Using Backend",id:"using-backend",level:2}],p={toc:c};function d(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"backend"},"Backend"),(0,i.kt)("p",null,"Backend is Kusion's storage, which defines the place to store Workspace, Spec and State. By default, Kusion uses the ",(0,i.kt)("inlineCode",{parentName:"p"},"local")," type of backend to store the state on the local disk. While in the scenario of team collaboration, the Workspace, Spec and State can be stored on a remote backend, such as ",(0,i.kt)("inlineCode",{parentName:"p"},"mysql"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"oss")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"s3"),", to allow multiple users' access. "),(0,i.kt)("p",null,"The command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config")," is used to configure the backend configuration. Configuring a whole backend or an individual config item are both supported. For the sensitive data, the environment variables are supported, and with higher priority."),(0,i.kt)("p",null,"Furthermore, Kusion provides the operation of setting current backend. Thus, the trouble of specifying backend can be saved when executing operation commands and managing ",(0,i.kt)("inlineCode",{parentName:"p"},"workspace"),". "),(0,i.kt)("h2",{id:"available-backend-types"},"Available Backend Types"),(0,i.kt)("p",null,"There are four available backend types: ",(0,i.kt)("inlineCode",{parentName:"p"},"local"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"mysql"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"oss"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"s3"),"."),(0,i.kt)("h3",{id:"local"},"local"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"local")," type backend uses local file system as storage, which is suitable for local operations, but not ideal for multi-user collaboration. The supported config items are as below."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"path"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"optional"),", specify the directory to store the Workspace, Spec, and State files. The subdirectories ",(0,i.kt)("inlineCode",{parentName:"li"},"workspaces"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"specs")," and ",(0,i.kt)("inlineCode",{parentName:"li"},"states")," are used to store the corresponding files separately. It's recommended to use an empty or a Kusion exclusive directory as the local backend path. If not set, the default path ",(0,i.kt)("inlineCode",{parentName:"li"},"${KUSION_HOME}")," is in use.")),(0,i.kt)("p",null,"The whole local type backend configuration is as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},'{\n "type": "local",\n "configs": {\n "path": "${local_path}" # type string, optional, the directory to store files.\n }\n}\n')),(0,i.kt)("h3",{id:"mysql"},"mysql"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"mysql")," type backend uses mysql database as storage. The supported config items are as below."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"dbName"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", the name of the database."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"user"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", the username of the database. "),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"password"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"optional"),", the password of the database, support declaring by environment variable ",(0,i.kt)("inlineCode",{parentName:"li"},"KUSION_BACKEND_MYSQL_PASSWORD"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"host")," - ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", the access address for the database."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"port")," - ",(0,i.kt)("inlineCode",{parentName:"li"},"type int"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"optional"),", the port of the database. If not set, the default value ",(0,i.kt)("inlineCode",{parentName:"li"},"3306")," will be used.")),(0,i.kt)("p",null,"Please be attention, mysql type are not supported to store Spec for now. For Workspace and State, the table ",(0,i.kt)("inlineCode",{parentName:"p"},"worksapce")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"state")," are used to store the corresponding content separately, whose structures are determinate. The table structures are shown below. "),(0,i.kt)("p",null,"Noted that there are not fields ",(0,i.kt)("inlineCode",{parentName:"p"},"id"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"gmt_create(created_at)"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"gmt_modified(updated_at)"),", etc., which are usually automatically controlled by the database. Kusion does not use these fields, while the existence of them does not affect the normal operation of Kusion. And the length of the varchar can be changed according to the real scenario."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-sql"},"-- table workspace\nCREATE TABLE `workspace` (\n `workspace` varchar(127) NOT NULL COMMENT 'workspace name',\n `content` longtext NOT NULL COMMENT 'workspace content, in JSON format',\n `is_current` tinyint(1) DEFAULT NULL COMMENT 'specify is current workspace or not',\n UNIQUE KEY `uk_workspace` (`name`),\n KEY `idx_is_current` (`is_current`)\n);\n\n-- table state\nCREATE TABLE `state` (\n `project` varchar(127) NOT NULL COMMENT 'project name',\n `stack` varchar(127) NOT NULL COMMENT 'stack name',\n `workspace` varchar(127) NOT NULL COMMENT 'workspace name',\n `content` longtext NOT NULL COMMENT 'state content, in JSON format',\n UNIQUE KEY `uk_state` (`project`, `stack`, `worksapce`)\n);\n")),(0,i.kt)("p",null,"The whole mysql type backend configuration is as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},'{\n "type": "mysql",\n "configs": {\n "dbName": "${mysql_db_name}", # type string, required, the database name.\n "user": "${mysql_user}", # type string, required, the database user.\n "password": "${mysql_password}", # type string, optional, the database password.\n "host": "${mysql_host}", # type string, required, the database host.\n "port": "${mysql_port}" # type string, optional, the database port. If not set, use the default port 3306.\n }\n}\n')),(0,i.kt)("p",null,"The supported environment variable is as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},'export KUSION_BACKEND_MYSQL_PASSWORD="${mysql_password}" # configure password\n')),(0,i.kt)("h3",{id:"oss"},"oss"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"oss")," type backend uses the Alicloud Object Storage Service (OSS) as storage. The supported config items are as below."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"endpoint"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the access endpoint for alicloud oss bucket. "),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"accessKeyID"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the alicloud account accessKeyID, support declaring by environment variable ",(0,i.kt)("inlineCode",{parentName:"li"},"OSS_ACCESS_KEY_ID"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"accessKeySecret"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the alicloud account accessKeySecret, support declaring by environment variable ",(0,i.kt)("inlineCode",{parentName:"li"},"OSS_ACCESS_KEY_SECRET"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"bucket"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the name of the alicloud oss bucket."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"prefix"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"optional"),", constitute the prefix to store the Workspace, Spec, and State files, whose prefixes are ",(0,i.kt)("inlineCode",{parentName:"li"},"${prefix}/workspaces"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"${prefix}/specs")," and ",(0,i.kt)("inlineCode",{parentName:"li"},"${prefix}/states"),' respectively. Using prefix can create a "dedicated space" for the Kusion data, which is beneficial for the management and reuse of the bucket. If not set, there is no prefix, the files are stored in the root path of the bucket if analogy to a file system.')),(0,i.kt)("p",null,"Noted that ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeyID")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeySecret")," are required for the whole configuration combined by the configuration managed by the command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config")," and the environment variables. For the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config")," alone, they are not obligatory. And for the safety reason, using environment variables is the recommended way."),(0,i.kt)("p",null,"The whole oss type backend configuration is as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},'{\n "type": "oss",\n "configs": {\n "endpoint": "${oss_endpoint}", # type string, required, the oss endpoint.\n "accessKeyID": "${oss_access_key_id}", # type string, ooptional for the command "kusion config", the oss access key id.\n "accessKeySecret": "${oss_access_key_secret}", # type string, optional for the command "kusion config", the oss access key secret.\n "bucket": "${oss_bucket}", # type string, required, the oss bucket.\n "prefix": "${oss_prefix}" # type string, optional, the prefix to store the files.\n }\n}\n')),(0,i.kt)("p",null,"The supported environment variables are as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},'export OSS_ACCESS_KEY_ID="${oss-access-key-id}" # configure accessKeyID\nexport OSS_ACCESS_KEY_SECRET="${oss-access-key-secret}" # configure accessKeySecret\n')),(0,i.kt)("h3",{id:"s3"},"s3"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"s3")," type backend uses the AWS Simple Storage Service (S3) as storage. The supported config items are as below."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"region"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the region of aws s3 bucket, support declaring by environment variable ",(0,i.kt)("inlineCode",{parentName:"li"},"AWS_DEFAULT_REGION")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"AWS_REGION"),", where the latter has higher priority."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"endpoint"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"optional"),", specify the access endpoint for aws s3 bucket."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"accessKeyID"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the aws account accessKeyID, support declaring by environment variable ",(0,i.kt)("inlineCode",{parentName:"li"},"AWS_ACCESS_KEY_ID"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"accessKeySecret"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the aws account.accessKeySecret, support declaring by environment variable ",(0,i.kt)("inlineCode",{parentName:"li"},"AWS_SECRET_ACCESS_KEY"),"."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"bucket"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"required"),", specify the name of the aws s3 bucket."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("strong",{parentName:"li"},"prefix"),": ",(0,i.kt)("inlineCode",{parentName:"li"},"type string"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"optional"),", constitute the prefix to store the Workspace, Spec, and State files, whose prefixes are ",(0,i.kt)("inlineCode",{parentName:"li"},"${prefix}/workspaces"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"${prefix}/specs")," and ",(0,i.kt)("inlineCode",{parentName:"li"},"${prefix}/states")," respectively.")),(0,i.kt)("p",null,"Noted that ",(0,i.kt)("inlineCode",{parentName:"p"},"region"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeyID")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeySecret")," are optional for the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config")," command."),(0,i.kt)("p",null,"The whole s3 type backend configuration is as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},'{\n "type": "s3",\n "configs": {\n "region": "${s3_region}", # type string, optional for the command "kusion config", the aws region.\n "endpoint": "${s3_endpoint}", # type string, optional, the aws endpoint. \n "accessKeyID": "${s3_access_key_id}", # type string, optional for the command "kusion config", the aws access key id.\n "accessKeySecret": "${s3_access_key_secret}", # type string, optional for the command "kusion config", the aws access key secret.\n "bucket": "${s3_bucket}", # type string, required, the s3 bucket.\n "prefix": "${s3_prefix}" # type string, optional, the prefix to store the files.\n }\n}\n')),(0,i.kt)("p",null,"The supported environment variables are as below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},'export AWS_DEFAULT_REGION="${s3_region}" # configure region, lower priority than AWS_REGION\nexport AWS_REGION="${s3_region}" # configure region, higher priority than AWS_DEFAULT_REGION\nexport AWS_ACCESS_KEY_ID="${s3_access_key_id}" # configure accessKeyID\nexport AWS_SECRET_ACCESS_KEY="${s3_access_key_secret}" # configure accessKeySecret\n')),(0,i.kt)("h2",{id:"setting-a-backend"},"Setting a Backend"),(0,i.kt)("p",null,"When there is a new backend or the backend configuration needs to update, use the command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config set ${key} ${value}")," to set a backend. A backend is identified by a unique name, and its whole configuration is made up of the backend type and its corresponding config items. "),(0,i.kt)("p",null,"Be attention, do not confuse backend with backend type. For example, a backend named ",(0,i.kt)("inlineCode",{parentName:"p"},"s3_prod")," uses ",(0,i.kt)("inlineCode",{parentName:"p"},"s3")," as its storage, the ",(0,i.kt)("inlineCode",{parentName:"p"},"s3_prod")," is the backend, while the ",(0,i.kt)("inlineCode",{parentName:"p"},"s3")," is the backend type."),(0,i.kt)("p",null,"There are four configuration modes:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"setting a whole backend"),(0,i.kt)("li",{parentName:"ul"},"setting a backend type "),(0,i.kt)("li",{parentName:"ul"},"setting a whole set of backend config items"),(0,i.kt)("li",{parentName:"ul"},"setting a backend config item")),(0,i.kt)("p",null,"A unique backend name is required to do the configuration. Take ",(0,i.kt)("inlineCode",{parentName:"p"},"s3")," type backend with name ",(0,i.kt)("inlineCode",{parentName:"p"},"s3_prod")," for an example to explain how these modes work."),(0,i.kt)("h3",{id:"setting-a-whole-backend"},"Setting a Whole Backend"),(0,i.kt)("p",null,"The key to configure a whole backend is ",(0,i.kt)("inlineCode",{parentName:"p"},"backends.${name}"),", whose value must be the JSON marshal result in a specified format, which is determined by the backend type. Enclosing the value in single quotation marks is a good choice, which can keep the format correct. "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},'# set a whole backend\nkusion config set backends.s3_prod \'{"type":"s3","configs":{"bucket":"kusion"}}\'\n')),(0,i.kt)("h3",{id:"setting-a-backend-type"},"Setting a Backend Type"),(0,i.kt)("p",null,"The key to set a backend type is ",(0,i.kt)("inlineCode",{parentName:"p"},"backends.${name}.type"),", whose value must be ",(0,i.kt)("inlineCode",{parentName:"p"},"local"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"mysql"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"oss")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"s3"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"# set a backend type\nkusion config set backends.s3_prod.type s3\n")),(0,i.kt)("h3",{id:"setting-a-whole-set-of-backend-config-items"},"Setting a Whole Set of Backend Config Items"),(0,i.kt)("p",null,"The key to set a whole set of backend config items is ",(0,i.kt)("inlineCode",{parentName:"p"},"backends.${name}.configs"),", whose value must be the JSON marshal result in a specified format, which is determined by the backend type. The backend config must be set after the backend type, and corresponds to the backend type."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},'# set a whole backend config\nkusion config set backends.s3_prod.configs \'{"bucket":"kusion"}\'\n')),(0,i.kt)("h3",{id:"setting-a-backend-config-item"},"Setting a Backend Config Item"),(0,i.kt)("p",null,"The key to set a backend config item is ",(0,i.kt)("inlineCode",{parentName:"p"},"backends.${name}.configs.${item}"),". The item name and value type both depend on the backend type. Like the whole backend config, the config item must be valid and set after the backend type."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"# set a backend config item\nkusion config set backends.s3_prod.configs.bucket kusion\n")),(0,i.kt)("p",null,"When executing ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config set"),", the configuration will be stored in a local file. For security reason, the environment variables are supported to configure some config items, such as ",(0,i.kt)("inlineCode",{parentName:"p"},"password"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeyID"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"accessKeySecret"),". Using environment variables rather than ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config")," set to set sensitive data is the best practice. If both configured, the environment variables have higher priority. For details about the supported environment variables, please see above."),(0,i.kt)("p",null,"Kusion has a default backend with ",(0,i.kt)("inlineCode",{parentName:"p"},"local")," type and the path is ",(0,i.kt)("inlineCode",{parentName:"p"},"$KUSION_HOME"),", whose name is exactly ",(0,i.kt)("inlineCode",{parentName:"p"},"default"),". The ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," backend is forbidden to modification, that is setting or unsetting the default backend is not allowed. Besides, the keyword ",(0,i.kt)("inlineCode",{parentName:"p"},"current")," is also used by Kusion itself, please do not use it as the backend name."),(0,i.kt)("h2",{id:"unsetting-a-backend"},"Unsetting a Backend"),(0,i.kt)("p",null,"When a backend is not in use, or the configuration is out of date, use the command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config unset ${key}")," to unset a backend or a specified config item. Same as the setting, there are also four modes of unsetting."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"unsetting a whole backend"),(0,i.kt)("li",{parentName:"ul"},"unsetting a backend type"),(0,i.kt)("li",{parentName:"ul"},"unsetting a whole set of backend config items"),(0,i.kt)("li",{parentName:"ul"},"unsetting a backend config item")),(0,i.kt)("p",null,"When unsetting a whole backend, the backend must not be the current backend. When unsetting the backend type, the config items must be empty and the backend not be the current."),(0,i.kt)("p",null,"Unsetting the ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," backend is forbidden."),(0,i.kt)("h2",{id:"setting-the-current-backend"},"Setting the Current Backend"),(0,i.kt)("p",null,"In order not to specify backend for every operation command. Kusion provides the mechanism of setting current backend, then the current workspace will be use by default. This is very useful when you execute a series of Kusion operation commands, for they usually use the same backend."),(0,i.kt)("p",null,"Use the command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config set backends.current ${name}")," to set the current backend, where the ",(0,i.kt)("inlineCode",{parentName:"p"},"name")," must be the already set backend."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"# set the current workspace\nkusion config set backends.current s3_prod\n")),(0,i.kt)("p",null,"Setting the current backend to ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," is legal. Actually, if there is no backend related configuration, the current backend is the ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," backend."),(0,i.kt)("h2",{id:"getting-backend-configuration"},"Getting Backend Configuration"),(0,i.kt)("p",null,"Use the command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config get ${key}")," to get a whole backend configuration or a specified backend config item. The ",(0,i.kt)("inlineCode",{parentName:"p"},"key")," is same as setting and unsetting operation, the whole list can be found in the ",(0,i.kt)("a",{parentName:"p",href:"configuration"},"Configuration"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"# get a whole backend\nkusion config get backends.s3_prod\n\n# get a specified config item\nkusion config get backends.s3_prod.configs.bucekt\n")),(0,i.kt)("p",null,"Besides, the command ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion config list")," can also be used, which returns the whole kusion configuration, while the backend configuration is included."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"# get the whole Kusion configuration \nkusion config list\n")),(0,i.kt)("h2",{id:"using-backend"},"Using Backend"),(0,i.kt)("p",null,"The backend is used to store Workspace, Spec, and State. Thus, the following commands use the backend, shown as below."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"subcommands of ",(0,i.kt)("inlineCode",{parentName:"li"},"kusion workspace"),": use to store the Workspace;"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"kusion generate"),": use to store the Spec;"),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"kusion preview"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"kusion apply"),", ",(0,i.kt)("inlineCode",{parentName:"li"},"kusion destroy"),": use to store the State;")),(0,i.kt)("p",null,"For all the commands above, the flag ",(0,i.kt)("inlineCode",{parentName:"p"},"--backend")," is provided to specify the backend, or using the current backend. When using backend, you usually need to specify the sensitive data by environment variables. The example is shown below."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},'# set environment variables of sensitive and other necessary data\nexport AWS_REGION="${s3_region}"\nexport AWS_ACCESS_KEY_ID="${s3_access_key_id}"\nexport AWS_SECRET_ACCESS_KEY="${s3_access_key_secret}"\n\n# use current backend\nkusion apply\n\n# use a specified backend\nkusion apply --backend s3_prod\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/486b02f9.e4a58489.js b/assets/js/486b02f9.bb440204.js similarity index 53% rename from assets/js/486b02f9.e4a58489.js rename to assets/js/486b02f9.bb440204.js index 668fe347328..66e238e857e 100644 --- a/assets/js/486b02f9.e4a58489.js +++ b/assets/js/486b02f9.bb440204.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9003],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=c(r),m=a,f=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return r?n.createElement(f,l(l({ref:t},p),{},{components:r})):n.createElement(f,l({ref:t},p))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var c=2;c{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const o={},l="job",i={unversionedId:"reference/modules/workspace-configs/workload/job",id:"version-v0.10/reference/modules/workspace-configs/workload/job",title:"job",description:"job can be used to define workspace-level job configuration.",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/workload/job.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/workload",slug:"/reference/modules/workspace-configs/workload/job",permalink:"/docs/v0.10/reference/modules/workspace-configs/workload/job",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/workload/job.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"opsrule",permalink:"/docs/v0.10/reference/modules/workspace-configs/trait/opsrule"},next:{title:"service",permalink:"/docs/v0.10/reference/modules/workspace-configs/workload/service"}},s={},c=[{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:c};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"job"},"job"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"job")," can be used to define workspace-level job configuration."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"replicas"),(0,a.kt)("br",null),"Number of container replicas based on this configuration that should be ran."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"2"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels"),(0,a.kt)("br",null),"Labels are key/value pairs that are attached to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations"),(0,a.kt)("br",null),"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n service:\n default:\n replicas: 3\n labels:\n label-key: label-value\n annotations:\n annotation-key: annotation-value\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9003],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=c(r),m=a,f=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return r?n.createElement(f,l(l({ref:t},p),{},{components:r})):n.createElement(f,l({ref:t},p))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var c=2;c{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const o={},l="job",i={unversionedId:"reference/modules/workspace-configs/workload/job",id:"version-v0.10/reference/modules/workspace-configs/workload/job",title:"job",description:"job can be used to define workspace-level job configuration.",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/workload/job.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/workload",slug:"/reference/modules/workspace-configs/workload/job",permalink:"/docs/v0.10/reference/modules/workspace-configs/workload/job",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/workload/job.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"opsrule",permalink:"/docs/v0.10/reference/modules/workspace-configs/trait/opsrule"},next:{title:"service",permalink:"/docs/v0.10/reference/modules/workspace-configs/workload/service"}},s={},c=[{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:c};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"job"},"job"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"job")," can be used to define workspace-level job configuration."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"replicas"),(0,a.kt)("br",null),"Number of container replicas based on this configuration that should be ran."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"2"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels"),(0,a.kt)("br",null),"Labels are key/value pairs that are attached to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations"),(0,a.kt)("br",null),"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n service:\n default:\n replicas: 3\n labels:\n label-key: label-value\n annotations:\n annotation-key: annotation-value\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/48c1907d.3c597648.js b/assets/js/48c1907d.3c597648.js deleted file mode 100644 index 70c9dd42335..00000000000 --- a/assets/js/48c1907d.3c597648.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7179],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>u});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),c=p(n),u=r,k=c["".concat(s,".").concat(u)]||c[u]||m[u]||l;return n?a.createElement(k,o(o({ref:t},d),{},{components:n})):a.createElement(k,o({ref:t},d))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,o=new Array(l);o[0]=c;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,o[1]=i;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>m,frontMatter:()=>l,metadata:()=>i,toc:()=>p});var a=n(87462),r=(n(67294),n(3905));const l={id:"naming-conventions",sidebar_label:"Naming Conventions"},o="Naming Conventions",i={unversionedId:"reference/model/naming-conventions",id:"version-v0.9/reference/model/naming-conventions",title:"Naming Conventions",description:"Kubernetes Resources",source:"@site/docs_versioned_docs/version-v0.9/reference/model/naming-conventions.md",sourceDirName:"reference/model",slug:"/reference/model/naming-conventions",permalink:"/docs/v0.9/reference/model/naming-conventions",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/naming-conventions.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{id:"naming-conventions",sidebar_label:"Naming Conventions"},sidebar:"kusion",previous:{title:"secret",permalink:"/docs/v0.9/reference/model/catalog_models/internal/secret/doc_secret"},next:{title:"Project & Stack Config Items",permalink:"/docs/v0.9/reference/model/project-stack-config-items"}},s={},p=[{value:"Kubernetes Resources",id:"kubernetes-resources",level:2},{value:"Terraform Resources",id:"terraform-resources",level:2},{value:"Apply Options",id:"apply-options",level:2},{value:"Magic Variables",id:"magic-variables",level:2},{value:"Concept Explanation",id:"concept-explanation",level:3},{value:"List of Magic Variables",id:"list-of-magic-variables",level:3},{value:"Sensitive Database Information",id:"sensitive-database-information",level:4}],d={toc:p};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"naming-conventions"},"Naming Conventions"),(0,r.kt)("h2",{id:"kubernetes-resources"},"Kubernetes Resources"),(0,r.kt)("p",null,"Kusion adheres to specific rules when generating the Kubernetes resources for users' applications. The table below lists some common Kubernetes resource naming conventions. "),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Resource"),(0,r.kt)("th",{parentName:"tr",align:null},"Concatenation Rule"),(0,r.kt)("th",{parentName:"tr",align:null},"Example ID"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Namespace"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"project name")),(0,r.kt)("td",{parentName:"tr",align:null},"v1:Namespace:wordpress")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Deployment"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"project name"),"-",(0,r.kt)("inlineCode",{parentName:"td"},"stack name"),"-",(0,r.kt)("inlineCode",{parentName:"td"},"app name")),(0,r.kt)("td",{parentName:"tr",align:null},"apps/v1:Deployment:wordpress:wordpress-dev-wordpress")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"CronJob"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"project name"),"-",(0,r.kt)("inlineCode",{parentName:"td"},"stack name"),"-",(0,r.kt)("inlineCode",{parentName:"td"},"app name")),(0,r.kt)("td",{parentName:"tr",align:null},"batch/v1:CronJob:helloworld:helloworld-dev-helloworld")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Service"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"project name"),"-",(0,r.kt)("inlineCode",{parentName:"td"},"stack name"),"-",(0,r.kt)("inlineCode",{parentName:"td"},"app name"),"-",(0,r.kt)("inlineCode",{parentName:"td"},"public"),"/",(0,r.kt)("inlineCode",{parentName:"td"},"private")),(0,r.kt)("td",{parentName:"tr",align:null},"v1:Service:helloworld:helloworld-dev-helloworld-public")))),(0,r.kt)("h2",{id:"terraform-resources"},"Terraform Resources"),(0,r.kt)("p",null,"Similarly, Kusion also adheres to specific naming conventions when generating the Terraform Resources. Some common resources are listed below. "),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Resource"),(0,r.kt)("th",{parentName:"tr",align:null},"Concatenation Rule"),(0,r.kt)("th",{parentName:"tr",align:null},"Example ID"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"random_password"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"app name"),"-",(0,r.kt)("inlineCode",{parentName:"td"},"db")),(0,r.kt)("td",{parentName:"tr",align:null},"hashicorp:random:random_password:wordpress-db")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"aws_security_group"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"app name"),"-",(0,r.kt)("inlineCode",{parentName:"td"},"db")),(0,r.kt)("td",{parentName:"tr",align:null},"hashicorp:aws:aws_security_group:wordpress-db")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"aws_db_instance"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"app name")),(0,r.kt)("td",{parentName:"tr",align:null},"hashicorp:aws:aws_db_instance:wordpress")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"alicloud_db_instance"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"app name")),(0,r.kt)("td",{parentName:"tr",align:null},"aliyun:alicloud:alicloud_db_instance:wordpress")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"alicloud_db_connection"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"app name")),(0,r.kt)("td",{parentName:"tr",align:null},"aliyun:alicloud:alicloud_db_connection:wordpress")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"alicloud_rds_account"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"app name")),(0,r.kt)("td",{parentName:"tr",align:null},"aliyun:alicloud:alicloud_rds_account:wordpress")))),(0,r.kt)("h2",{id:"apply-options"},"Apply Options"),(0,r.kt)("p",null,"Before applying the project, users may need to export some environment variables to specify the Provider information for provisioning cloud resources. The relevant environment variables are listed in the table below. "),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Environment Variable"),(0,r.kt)("th",{parentName:"tr",align:null},"Explanation"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"AWS_PROVIDER_REGION"),(0,r.kt)("td",{parentName:"tr",align:null},"The region where the aws provider provisions the resources"),(0,r.kt)("td",{parentName:"tr",align:null},"us-east-1")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"AWS_ACCESS_KEY_ID"),(0,r.kt)("td",{parentName:"tr",align:null},"The access key for the aws provider to provision the resources"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"AWS_SECRET_ACCESS_KEY"),(0,r.kt)("td",{parentName:"tr",align:null},"The secret key for the aws provider to provision the resources"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"ALICLOUD_PROVIDER_REGION"),(0,r.kt)("td",{parentName:"tr",align:null},"The region where the alicloud provider provisions the resources"),(0,r.kt)("td",{parentName:"tr",align:null},"cn-beijing")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"ALICLOUD_ACCESS_KEY"),(0,r.kt)("td",{parentName:"tr",align:null},"The access key for the alicloud provider to provision the resources"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"ALICLOUD_SECRET_KEY"),(0,r.kt)("td",{parentName:"tr",align:null},"The secret key for the alicloud provider to provision the resources"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h2",{id:"magic-variables"},"Magic Variables"),(0,r.kt)("h3",{id:"concept-explanation"},"Concept Explanation"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Magic variables")," are preconfigured variables representing fundamental metadata or environment variables automatically generated and injected into the application container by Kusion, which are typically used for accessories such as databases. "),(0,r.kt)("h3",{id:"list-of-magic-variables"},"List of Magic Variables"),(0,r.kt)("h4",{id:"sensitive-database-information"},"Sensitive Database Information"),(0,r.kt)("p",null,"For sensitive information such as the ",(0,r.kt)("strong",{parentName:"p"},"host address"),", ",(0,r.kt)("strong",{parentName:"p"},"username")," and ",(0,r.kt)("strong",{parentName:"p"},"password")," for the database instance, Kusion will automatically inject them into the application container for users through environment variables. The relevant environment variables are listed in the table below. "),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Explanation"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB_HOST"),(0,r.kt)("td",{parentName:"tr",align:null},"Host address for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB_USERNAME"),(0,r.kt)("td",{parentName:"tr",align:null},"Account username for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB_PASSWORD"),(0,r.kt)("td",{parentName:"tr",align:null},"Account password for accessing the database instance")))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/48c1907d.42daa2af.js b/assets/js/48c1907d.42daa2af.js new file mode 100644 index 00000000000..ee9ccbc3b56 --- /dev/null +++ b/assets/js/48c1907d.42daa2af.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7179],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>u});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),c=p(n),u=r,k=c["".concat(s,".").concat(u)]||c[u]||m[u]||l;return n?a.createElement(k,o(o({ref:t},d),{},{components:n})):a.createElement(k,o({ref:t},d))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,o=new Array(l);o[0]=c;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,o[1]=i;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>m,frontMatter:()=>l,metadata:()=>i,toc:()=>p});var a=n(87462),r=(n(67294),n(3905));const l={id:"naming-conventions",sidebar_label:"Naming Conventions"},o="Naming Conventions",i={unversionedId:"reference/model/naming-conventions",id:"version-v0.9/reference/model/naming-conventions",title:"Naming Conventions",description:"Kubernetes Resources",source:"@site/docs_versioned_docs/version-v0.9/reference/model/naming-conventions.md",sourceDirName:"reference/model",slug:"/reference/model/naming-conventions",permalink:"/docs/v0.9/reference/model/naming-conventions",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/naming-conventions.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{id:"naming-conventions",sidebar_label:"Naming Conventions"},sidebar:"kusion",previous:{title:"secret",permalink:"/docs/v0.9/reference/model/catalog_models/internal/secret/doc_secret"},next:{title:"Project & Stack Config Items",permalink:"/docs/v0.9/reference/model/project-stack-config-items"}},s={},p=[{value:"Kubernetes Resources",id:"kubernetes-resources",level:2},{value:"Terraform Resources",id:"terraform-resources",level:2},{value:"Apply Options",id:"apply-options",level:2},{value:"Magic Variables",id:"magic-variables",level:2},{value:"Concept Explanation",id:"concept-explanation",level:3},{value:"List of Magic Variables",id:"list-of-magic-variables",level:3},{value:"Sensitive Database Information",id:"sensitive-database-information",level:4}],d={toc:p};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"naming-conventions"},"Naming Conventions"),(0,r.kt)("h2",{id:"kubernetes-resources"},"Kubernetes Resources"),(0,r.kt)("p",null,"Kusion adheres to specific rules when generating the Kubernetes resources for users' applications. The table below lists some common Kubernetes resource naming conventions. "),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Resource"),(0,r.kt)("th",{parentName:"tr",align:null},"Concatenation Rule"),(0,r.kt)("th",{parentName:"tr",align:null},"Example ID"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Namespace"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"project name")),(0,r.kt)("td",{parentName:"tr",align:null},"v1:Namespace:wordpress")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Deployment"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"project name"),"-",(0,r.kt)("inlineCode",{parentName:"td"},"stack name"),"-",(0,r.kt)("inlineCode",{parentName:"td"},"app name")),(0,r.kt)("td",{parentName:"tr",align:null},"apps/v1:Deployment:wordpress:wordpress-dev-wordpress")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"CronJob"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"project name"),"-",(0,r.kt)("inlineCode",{parentName:"td"},"stack name"),"-",(0,r.kt)("inlineCode",{parentName:"td"},"app name")),(0,r.kt)("td",{parentName:"tr",align:null},"batch/v1:CronJob:helloworld:helloworld-dev-helloworld")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Service"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"project name"),"-",(0,r.kt)("inlineCode",{parentName:"td"},"stack name"),"-",(0,r.kt)("inlineCode",{parentName:"td"},"app name"),"-",(0,r.kt)("inlineCode",{parentName:"td"},"public"),"/",(0,r.kt)("inlineCode",{parentName:"td"},"private")),(0,r.kt)("td",{parentName:"tr",align:null},"v1:Service:helloworld:helloworld-dev-helloworld-public")))),(0,r.kt)("h2",{id:"terraform-resources"},"Terraform Resources"),(0,r.kt)("p",null,"Similarly, Kusion also adheres to specific naming conventions when generating the Terraform Resources. Some common resources are listed below. "),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Resource"),(0,r.kt)("th",{parentName:"tr",align:null},"Concatenation Rule"),(0,r.kt)("th",{parentName:"tr",align:null},"Example ID"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"random_password"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"app name"),"-",(0,r.kt)("inlineCode",{parentName:"td"},"db")),(0,r.kt)("td",{parentName:"tr",align:null},"hashicorp:random:random_password:wordpress-db")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"aws_security_group"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"app name"),"-",(0,r.kt)("inlineCode",{parentName:"td"},"db")),(0,r.kt)("td",{parentName:"tr",align:null},"hashicorp:aws:aws_security_group:wordpress-db")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"aws_db_instance"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"app name")),(0,r.kt)("td",{parentName:"tr",align:null},"hashicorp:aws:aws_db_instance:wordpress")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"alicloud_db_instance"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"app name")),(0,r.kt)("td",{parentName:"tr",align:null},"aliyun:alicloud:alicloud_db_instance:wordpress")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"alicloud_db_connection"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"app name")),(0,r.kt)("td",{parentName:"tr",align:null},"aliyun:alicloud:alicloud_db_connection:wordpress")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"alicloud_rds_account"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("inlineCode",{parentName:"td"},"app name")),(0,r.kt)("td",{parentName:"tr",align:null},"aliyun:alicloud:alicloud_rds_account:wordpress")))),(0,r.kt)("h2",{id:"apply-options"},"Apply Options"),(0,r.kt)("p",null,"Before applying the project, users may need to export some environment variables to specify the Provider information for provisioning cloud resources. The relevant environment variables are listed in the table below. "),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Environment Variable"),(0,r.kt)("th",{parentName:"tr",align:null},"Explanation"),(0,r.kt)("th",{parentName:"tr",align:null},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"AWS_PROVIDER_REGION"),(0,r.kt)("td",{parentName:"tr",align:null},"The region where the aws provider provisions the resources"),(0,r.kt)("td",{parentName:"tr",align:null},"us-east-1")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"AWS_ACCESS_KEY_ID"),(0,r.kt)("td",{parentName:"tr",align:null},"The access key for the aws provider to provision the resources"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"AWS_SECRET_ACCESS_KEY"),(0,r.kt)("td",{parentName:"tr",align:null},"The secret key for the aws provider to provision the resources"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"ALICLOUD_PROVIDER_REGION"),(0,r.kt)("td",{parentName:"tr",align:null},"The region where the alicloud provider provisions the resources"),(0,r.kt)("td",{parentName:"tr",align:null},"cn-beijing")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"ALICLOUD_ACCESS_KEY"),(0,r.kt)("td",{parentName:"tr",align:null},"The access key for the alicloud provider to provision the resources"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"ALICLOUD_SECRET_KEY"),(0,r.kt)("td",{parentName:"tr",align:null},"The secret key for the alicloud provider to provision the resources"),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h2",{id:"magic-variables"},"Magic Variables"),(0,r.kt)("h3",{id:"concept-explanation"},"Concept Explanation"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Magic variables")," are preconfigured variables representing fundamental metadata or environment variables automatically generated and injected into the application container by Kusion, which are typically used for accessories such as databases. "),(0,r.kt)("h3",{id:"list-of-magic-variables"},"List of Magic Variables"),(0,r.kt)("h4",{id:"sensitive-database-information"},"Sensitive Database Information"),(0,r.kt)("p",null,"For sensitive information such as the ",(0,r.kt)("strong",{parentName:"p"},"host address"),", ",(0,r.kt)("strong",{parentName:"p"},"username")," and ",(0,r.kt)("strong",{parentName:"p"},"password")," for the database instance, Kusion will automatically inject them into the application container for users through environment variables. The relevant environment variables are listed in the table below. "),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Explanation"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB_HOST"),(0,r.kt)("td",{parentName:"tr",align:null},"Host address for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB_USERNAME"),(0,r.kt)("td",{parentName:"tr",align:null},"Account username for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB_PASSWORD"),(0,r.kt)("td",{parentName:"tr",align:null},"Account password for accessing the database instance")))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4969cfcb.1845e166.js b/assets/js/4969cfcb.dc5c37da.js similarity index 65% rename from assets/js/4969cfcb.1845e166.js rename to assets/js/4969cfcb.dc5c37da.js index 1e9b875df17..27ca7d41060 100644 --- a/assets/js/4969cfcb.1845e166.js +++ b/assets/js/4969cfcb.dc5c37da.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3753],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},u=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=s(n),f=o,m=d["".concat(c,".").concat(f)]||d[f]||p[f]||i;return n?r.createElement(m,a(a({ref:t},u),{},{components:n})):r.createElement(m,a({ref:t},u))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=d;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:o,a[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>p,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var r=n(87462),o=(n(67294),n(3905));const i={},a="kusion compile",l={unversionedId:"reference/cli/kusion/kusion_compile",id:"version-v0.9/reference/cli/kusion/kusion_compile",title:"kusion compile",description:"Deprecated: Use 'kusion build' to generate the Intent instead",source:"@site/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_compile.md",sourceDirName:"reference/cli/kusion",slug:"/reference/cli/kusion/kusion_compile",permalink:"/docs/v0.9/reference/cli/kusion/kusion_compile",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_compile.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion build",permalink:"/docs/v0.9/reference/cli/kusion/kusion_build"},next:{title:"kusion destroy",permalink:"/docs/v0.9/reference/cli/kusion/kusion_destroy"}},c={},s=[{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 30-Nov-2023",id:"auto-generated-by-spf13cobra-on-30-nov-2023",level:6}],u={toc:s};function p(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-compile"},"kusion compile"),(0,o.kt)("p",null,"Deprecated: Use 'kusion build' to generate the Intent instead"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion compile [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," Deprecated\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for compile\n")),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.9/reference/cli/kusion/"},"kusion"),"\t - Kusion is the platform engineering engine of KusionStack")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-30-nov-2023"},"Auto generated by spf13/cobra on 30-Nov-2023"))}p.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3753],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),s=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},u=function(e){var t=s(e.components);return r.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=s(n),f=o,m=d["".concat(c,".").concat(f)]||d[f]||p[f]||i;return n?r.createElement(m,a(a({ref:t},u),{},{components:n})):r.createElement(m,a({ref:t},u))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=d;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:o,a[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>p,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var r=n(87462),o=(n(67294),n(3905));const i={},a="kusion compile",l={unversionedId:"reference/cli/kusion/kusion_compile",id:"version-v0.9/reference/cli/kusion/kusion_compile",title:"kusion compile",description:"Deprecated: Use 'kusion build' to generate the Intent instead",source:"@site/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_compile.md",sourceDirName:"reference/cli/kusion",slug:"/reference/cli/kusion/kusion_compile",permalink:"/docs/v0.9/reference/cli/kusion/kusion_compile",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_compile.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion build",permalink:"/docs/v0.9/reference/cli/kusion/kusion_build"},next:{title:"kusion destroy",permalink:"/docs/v0.9/reference/cli/kusion/kusion_destroy"}},c={},s=[{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 30-Nov-2023",id:"auto-generated-by-spf13cobra-on-30-nov-2023",level:6}],u={toc:s};function p(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-compile"},"kusion compile"),(0,o.kt)("p",null,"Deprecated: Use 'kusion build' to generate the Intent instead"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion compile [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," Deprecated\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for compile\n")),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.9/reference/cli/kusion/"},"kusion"),"\t - Kusion is the platform engineering engine of KusionStack")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-30-nov-2023"},"Auto generated by spf13/cobra on 30-Nov-2023"))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4ab041ea.5744d7e7.js b/assets/js/4ab041ea.eec883a9.js similarity index 82% rename from assets/js/4ab041ea.5744d7e7.js rename to assets/js/4ab041ea.eec883a9.js index e362243f191..5f6f89a0683 100644 --- a/assets/js/4ab041ea.5744d7e7.js +++ b/assets/js/4ab041ea.eec883a9.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4364],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),s=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},p=function(e){var t=s(e.components);return n.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,p=a(e,["components","mdxType","originalType","parentName"]),d=s(r),f=o,m=d["".concat(l,".").concat(f)]||d[f]||u[f]||i;return r?n.createElement(m,c(c({ref:t},p),{},{components:r})):n.createElement(m,c({ref:t},p))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,c=new Array(i);c[0]=d;var a={};for(var l in t)hasOwnProperty.call(t,l)&&(a[l]=t[l]);a.originalType=e,a.mdxType="string"==typeof e?e:o,c[1]=a;for(var s=2;s{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>c,default:()=>u,frontMatter:()=>i,metadata:()=>a,toc:()=>s});var n=r(87462),o=(r(67294),r(3905));const i={},c="Command Line Tools",a={unversionedId:"reference/cli/index",id:"version-v0.9/reference/cli/index",title:"Command Line Tools",description:"",source:"@site/docs_versioned_docs/version-v0.9/reference/cli/index.md",sourceDirName:"reference/cli",slug:"/reference/cli/",permalink:"/docs/v0.9/reference/cli/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/cli/index.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Deploy Application Securely and Efficiently via GitHub Actions",permalink:"/docs/v0.9/guides/github-actions/deploy-application-securely-and-efficiently-via-github-actions"},next:{title:"Kusion Commands",permalink:"/docs/v0.9/reference/cli/kusion/"}},l={},s=[],p={toc:s};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"command-line-tools"},"Command Line Tools"))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4364],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),s=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},p=function(e){var t=s(e.components);return n.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,p=a(e,["components","mdxType","originalType","parentName"]),d=s(r),f=o,m=d["".concat(l,".").concat(f)]||d[f]||u[f]||i;return r?n.createElement(m,c(c({ref:t},p),{},{components:r})):n.createElement(m,c({ref:t},p))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,c=new Array(i);c[0]=d;var a={};for(var l in t)hasOwnProperty.call(t,l)&&(a[l]=t[l]);a.originalType=e,a.mdxType="string"==typeof e?e:o,c[1]=a;for(var s=2;s{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>c,default:()=>u,frontMatter:()=>i,metadata:()=>a,toc:()=>s});var n=r(87462),o=(r(67294),r(3905));const i={},c="Command Line Tools",a={unversionedId:"reference/cli/index",id:"version-v0.9/reference/cli/index",title:"Command Line Tools",description:"",source:"@site/docs_versioned_docs/version-v0.9/reference/cli/index.md",sourceDirName:"reference/cli",slug:"/reference/cli/",permalink:"/docs/v0.9/reference/cli/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/cli/index.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Deploy Application Securely and Efficiently via GitHub Actions",permalink:"/docs/v0.9/guides/github-actions/deploy-application-securely-and-efficiently-via-github-actions"},next:{title:"Kusion Commands",permalink:"/docs/v0.9/reference/cli/kusion/"}},l={},s=[],p={toc:s};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"command-line-tools"},"Command Line Tools"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4b36b697.24dd0190.js b/assets/js/4b36b697.34256134.js similarity index 64% rename from assets/js/4b36b697.24dd0190.js rename to assets/js/4b36b697.34256134.js index 511309470d5..b8146096329 100644 --- a/assets/js/4b36b697.24dd0190.js +++ b/assets/js/4b36b697.34256134.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1130],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var o=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function a(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var p=o.createContext({}),s=function(e){var t=o.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},l=function(e){var t=s(e.components);return o.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var r=e.components,n=e.mdxType,i=e.originalType,p=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),d=s(r),f=n,m=d["".concat(p,".").concat(f)]||d[f]||u[f]||i;return r?o.createElement(m,a(a({ref:t},l),{},{components:r})):o.createElement(m,a({ref:t},l))}));function f(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var i=r.length,a=new Array(i);a[0]=d;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c.mdxType="string"==typeof e?e:n,a[1]=c;for(var s=2;s{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>c,toc:()=>s});var o=r(87462),n=(r(67294),r(3905));const i={sidebar_label:"Overview",id:"overview"},a="Overview",c={unversionedId:"concepts/project/overview",id:"concepts/project/overview",title:"Overview",description:"A project in Kusion is defined as a folder that contains a project.yaml file and is generally recommended to be linked to a Git repository. Typically, the mapping between a project and a repository is 1:1, however, it is possible to have multiple projects connected to a single repository \u2014 for example, in the case of a monorepo. A project consists of one or more applications.",source:"@site/docs/kusion/3-concepts/1-project/1-overview.md",sourceDirName:"3-concepts/1-project",slug:"/concepts/project/overview",permalink:"/docs/next/concepts/project/overview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/3-concepts/1-project/1-overview.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_label:"Overview",id:"overview"},sidebar:"kusion",previous:{title:"Run Your First App on Kubernetes with Kusion",permalink:"/docs/next/getting-started/deliver-quickstart"},next:{title:"Project file reference",permalink:"/docs/next/concepts/project/configuration"}},p={},s=[],l={toc:s};function u(e){let{components:t,...r}=e;return(0,n.kt)("wrapper",(0,o.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"overview"},"Overview"),(0,n.kt)("p",null,"A project in Kusion is defined as a folder that contains a ",(0,n.kt)("inlineCode",{parentName:"p"},"project.yaml")," file and is generally recommended to be linked to a Git repository. Typically, the mapping between a project and a repository is 1:1, however, it is possible to have multiple projects connected to a single repository \u2014 for example, in the case of a monorepo. A project consists of one or more applications."),(0,n.kt)("p",null,"The purpose of the project is to bundle application configurations there are relevant. Specifically, it organizes logical configurations for internal components to orchestrate the application and assembles these configurations to suit different roles, such as developers and SREs, thereby covering the entire lifecycle of application development."),(0,n.kt)("p",null,"From the perspective of the application development lifecycle, the configurations delineated by the project is decoupled from the application code. It takes an immutable image as input, allowing users to perform operations and maintain the application within an independent configuration codebase."))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1130],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var o=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function a(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var p=o.createContext({}),s=function(e){var t=o.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},l=function(e){var t=s(e.components);return o.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var r=e.components,n=e.mdxType,i=e.originalType,p=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),d=s(r),f=n,m=d["".concat(p,".").concat(f)]||d[f]||u[f]||i;return r?o.createElement(m,a(a({ref:t},l),{},{components:r})):o.createElement(m,a({ref:t},l))}));function f(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var i=r.length,a=new Array(i);a[0]=d;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c.mdxType="string"==typeof e?e:n,a[1]=c;for(var s=2;s{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>c,toc:()=>s});var o=r(87462),n=(r(67294),r(3905));const i={sidebar_label:"Overview",id:"overview"},a="Overview",c={unversionedId:"concepts/project/overview",id:"concepts/project/overview",title:"Overview",description:"A project in Kusion is defined as a folder that contains a project.yaml file and is generally recommended to be linked to a Git repository. Typically, the mapping between a project and a repository is 1:1, however, it is possible to have multiple projects connected to a single repository \u2014 for example, in the case of a monorepo. A project consists of one or more applications.",source:"@site/docs/kusion/3-concepts/1-project/1-overview.md",sourceDirName:"3-concepts/1-project",slug:"/concepts/project/overview",permalink:"/docs/next/concepts/project/overview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/3-concepts/1-project/1-overview.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_label:"Overview",id:"overview"},sidebar:"kusion",previous:{title:"Run Your First App on Kubernetes with Kusion",permalink:"/docs/next/getting-started/deliver-quickstart"},next:{title:"Project file reference",permalink:"/docs/next/concepts/project/configuration"}},p={},s=[],l={toc:s};function u(e){let{components:t,...r}=e;return(0,n.kt)("wrapper",(0,o.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"overview"},"Overview"),(0,n.kt)("p",null,"A project in Kusion is defined as a folder that contains a ",(0,n.kt)("inlineCode",{parentName:"p"},"project.yaml")," file and is generally recommended to be linked to a Git repository. Typically, the mapping between a project and a repository is 1:1, however, it is possible to have multiple projects connected to a single repository \u2014 for example, in the case of a monorepo. A project consists of one or more applications."),(0,n.kt)("p",null,"The purpose of the project is to bundle application configurations there are relevant. Specifically, it organizes logical configurations for internal components to orchestrate the application and assembles these configurations to suit different roles, such as developers and SREs, thereby covering the entire lifecycle of application development."),(0,n.kt)("p",null,"From the perspective of the application development lifecycle, the configurations delineated by the project is decoupled from the application code. It takes an immutable image as input, allowing users to perform operations and maintain the application within an independent configuration codebase."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4bcd6c5f.e4f525d7.js b/assets/js/4bcd6c5f.f3907997.js similarity index 58% rename from assets/js/4bcd6c5f.e4f525d7.js rename to assets/js/4bcd6c5f.f3907997.js index 67517512cb7..2f5d285aa7a 100644 --- a/assets/js/4bcd6c5f.e4f525d7.js +++ b/assets/js/4bcd6c5f.f3907997.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4634],{3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>d});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),i=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},u=function(e){var t=i(e.components);return n.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),m=i(r),d=a,f=m["".concat(p,".").concat(d)]||m[d]||c[d]||o;return r?n.createElement(f,l(l({ref:t},u),{},{components:r})):n.createElement(f,l({ref:t},u))}));function d(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=m;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:a,l[1]=s;for(var i=2;i{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>s,toc:()=>i});var n=r(87462),a=(r(67294),r(3905));const o={},l="opsrule",s={unversionedId:"reference/modules/developer-schemas/opsrule/opsrule",id:"reference/modules/developer-schemas/opsrule/opsrule",title:"opsrule",description:"Schema OpsRule",source:"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/opsrule/opsrule.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/opsrule",slug:"/reference/modules/developer-schemas/opsrule/",permalink:"/docs/next/reference/modules/developer-schemas/opsrule/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/1-developer-schemas/opsrule/opsrule.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"network",permalink:"/docs/next/reference/modules/developer-schemas/network/"},next:{title:"job",permalink:"/docs/next/reference/modules/developer-schemas/workload/job"}},p={},i=[{value:"Schema OpsRule",id:"schema-opsrule",level:2},{value:"Attributes",id:"attributes",level:3}],u={toc:i};function c(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"opsrule"},"opsrule"),(0,a.kt)("h2",{id:"schema-opsrule"},"Schema OpsRule"),(0,a.kt)("p",null,"OpsRule describes operation rules for various Day-2 Operations. Once declared, these",(0,a.kt)("br",null),"operation rules will be checked before any Day-2 operations."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"maxUnavailable")),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"The maximum percentage of the total pod instances in the component that can be",(0,a.kt)("br",null),"simultaneously unhealthy.")))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import opsrule as o\nimport kam.v1.app_configuration\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\n\nhelloworld : ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "nginx": c.Container {\n image: "nginx:v1"\n }\n }\n }\n accessories: {\n "opsrule" : o.OpsRule {\n maxUnavailable: "30%"\n }\n }\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4634],{3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>d});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),i=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},u=function(e){var t=i(e.components);return n.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),m=i(r),d=a,f=m["".concat(p,".").concat(d)]||m[d]||c[d]||o;return r?n.createElement(f,l(l({ref:t},u),{},{components:r})):n.createElement(f,l({ref:t},u))}));function d(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=m;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:a,l[1]=s;for(var i=2;i{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>s,toc:()=>i});var n=r(87462),a=(r(67294),r(3905));const o={},l="opsrule",s={unversionedId:"reference/modules/developer-schemas/opsrule/opsrule",id:"reference/modules/developer-schemas/opsrule/opsrule",title:"opsrule",description:"Schema OpsRule",source:"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/opsrule/opsrule.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/opsrule",slug:"/reference/modules/developer-schemas/opsrule/",permalink:"/docs/next/reference/modules/developer-schemas/opsrule/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/1-developer-schemas/opsrule/opsrule.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"network",permalink:"/docs/next/reference/modules/developer-schemas/network/"},next:{title:"job",permalink:"/docs/next/reference/modules/developer-schemas/workload/job"}},p={},i=[{value:"Schema OpsRule",id:"schema-opsrule",level:2},{value:"Attributes",id:"attributes",level:3}],u={toc:i};function c(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"opsrule"},"opsrule"),(0,a.kt)("h2",{id:"schema-opsrule"},"Schema OpsRule"),(0,a.kt)("p",null,"OpsRule describes operation rules for various Day-2 Operations. Once declared, these",(0,a.kt)("br",null),"operation rules will be checked before any Day-2 operations."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"maxUnavailable")),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"The maximum percentage of the total pod instances in the component that can be",(0,a.kt)("br",null),"simultaneously unhealthy.")))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import opsrule as o\nimport kam.v1.app_configuration\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\n\nhelloworld : ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "nginx": c.Container {\n image: "nginx:v1"\n }\n }\n }\n accessories: {\n "opsrule" : o.OpsRule {\n maxUnavailable: "30%"\n }\n }\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4c24e21f.27837737.js b/assets/js/4c24e21f.27837737.js new file mode 100644 index 00000000000..8fefec3ded7 --- /dev/null +++ b/assets/js/4c24e21f.27837737.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2434],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>k});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=p(r),k=o,m=d["".concat(c,".").concat(k)]||d[k]||u[k]||a;return r?n.createElement(m,s(s({ref:t},l),{},{components:r})):n.createElement(m,s({ref:t},l))}));function k(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion workspace",i={unversionedId:"reference/commands/kusion-workspace",id:"version-v0.10/reference/commands/kusion-workspace",title:"kusion workspace",description:"Workspace is a logical concept representing a target that stacks will be deployed to",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace",permalink:"/docs/v0.10/reference/commands/kusion-workspace",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace update",permalink:"/docs/v0.10/reference/commands/kusion-workspace-update"},next:{title:"Kusion Modules",permalink:"/docs/v0.10/reference/modules/"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],l={toc:p};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace"},"kusion workspace"),(0,o.kt)("p",null,"Workspace is a logical concept representing a target that stacks will be deployed to"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Workspace is a logical concept representing a target that stacks will be deployed to."),(0,o.kt)("p",null," Workspace is managed by platform engineers, which contains a set of configurations that application developers do not want or should not concern, and is reused by multiple stacks belonging to different projects."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace [flags]\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for workspace\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of KusionStack"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-workspace-create"},"kusion workspace create"),"\t - Create a new workspace"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-workspace-delete"},"kusion workspace delete"),"\t - Delete a workspace"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-workspace-list"},"kusion workspace list"),"\t - List all workspace names"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-workspace-show"},"kusion workspace show"),"\t - Show a workspace configuration"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-workspace-update"},"kusion workspace update"),"\t - Update a workspace configuration")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4c24e21f.2b7e3efb.js b/assets/js/4c24e21f.2b7e3efb.js deleted file mode 100644 index 8ce2abae296..00000000000 --- a/assets/js/4c24e21f.2b7e3efb.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2434],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>k});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=p(r),k=o,m=d["".concat(c,".").concat(k)]||d[k]||u[k]||a;return r?n.createElement(m,s(s({ref:t},l),{},{components:r})):n.createElement(m,s({ref:t},l))}));function k(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion workspace",i={unversionedId:"reference/commands/kusion-workspace",id:"version-v0.10/reference/commands/kusion-workspace",title:"kusion workspace",description:"Workspace is a logical concept representing a target that stacks will be deployed to",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace",permalink:"/docs/v0.10/reference/commands/kusion-workspace",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace update",permalink:"/docs/v0.10/reference/commands/kusion-workspace-update"},next:{title:"Kusion Modules",permalink:"/docs/v0.10/reference/modules/"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],l={toc:p};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace"},"kusion workspace"),(0,o.kt)("p",null,"Workspace is a logical concept representing a target that stacks will be deployed to"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Workspace is a logical concept representing a target that stacks will be deployed to."),(0,o.kt)("p",null," Workspace is managed by platform engineers, which contains a set of configurations that application developers do not want or should not concern, and is reused by multiple stacks belonging to different projects."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace [flags]\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for workspace\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of KusionStack"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-workspace-create"},"kusion workspace create"),"\t - Create a new workspace"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-workspace-delete"},"kusion workspace delete"),"\t - Delete a workspace"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-workspace-list"},"kusion workspace list"),"\t - List all workspace names"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-workspace-show"},"kusion workspace show"),"\t - Show a workspace configuration"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-workspace-update"},"kusion workspace update"),"\t - Update a workspace configuration")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4c493feb.654a91d4.js b/assets/js/4c493feb.654a91d4.js new file mode 100644 index 00000000000..db2c612156e --- /dev/null +++ b/assets/js/4c493feb.654a91d4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9666],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var p=a.createContext({}),s=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=s(e.components);return a.createElement(p.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,i=e.mdxType,r=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(t),m=i,k=u["".concat(p,".").concat(m)]||u[m]||d[m]||r;return t?a.createElement(k,o(o({ref:n},c),{},{components:t})):a.createElement(k,o({ref:n},c))}));function m(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var r=t.length,o=new Array(r);o[0]=u;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:i,o[1]=l;for(var s=2;s{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>o,default:()=>d,frontMatter:()=>r,metadata:()=>l,toc:()=>s});var a=t(87462),i=(t(67294),t(3905));const r={id:"container"},o="Configure Containers",l={unversionedId:"user-guides/working-with-k8s/container",id:"user-guides/working-with-k8s/container",title:"Configure Containers",description:"You can manage container-level configurations in the AppConfiguration model via the containers field (under the workload schema). By default, everything defined in the containers field will be treated as application containers. Sidecar containers will be supported in a future version of kusion.",source:"@site/docs/kusion/5-user-guides/2-working-with-k8s/2-container.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/container",permalink:"/docs/next/user-guides/working-with-k8s/container",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/5-user-guides/2-working-with-k8s/2-container.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"container"},sidebar:"kusion",previous:{title:"Deploy Application",permalink:"/docs/next/user-guides/working-with-k8s/deploy-application"},next:{title:"Expose Service",permalink:"/docs/next/user-guides/working-with-k8s/service"}},p={},s=[{value:"Pre-requisite",id:"pre-requisite",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Apply",id:"apply",level:2},{value:"Validation",id:"validation",level:2}],c={toc:s};function d(e){let{components:n,...t}=e;return(0,i.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"configure-containers"},"Configure Containers"),(0,i.kt)("p",null,"You can manage container-level configurations in the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model via the ",(0,i.kt)("inlineCode",{parentName:"p"},"containers")," field (under the ",(0,i.kt)("inlineCode",{parentName:"p"},"workload")," schema). By default, everything defined in the ",(0,i.kt)("inlineCode",{parentName:"p"},"containers")," field will be treated as application containers. Sidecar containers will be supported in a future version of kusion."),(0,i.kt)("p",null,"For the full ",(0,i.kt)("inlineCode",{parentName:"p"},"Container")," schema reference, please see ",(0,i.kt)("a",{parentName:"p",href:"../../reference/modules/developer-schemas/workload/service#schema-container"},"here")," for more details."),(0,i.kt)("h2",{id:"pre-requisite"},"Pre-requisite"),(0,i.kt)("p",null,"Please refer to the ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,i.kt)("p",null,"The example below also requires you to have ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,i.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,i.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,i.kt)("p",null,"In the last guide, we introduced a step to ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,i.kt)("p",null,"However, if you (or the platform team) would like to set default values for the workloads to standardize the behavior of applications in the ",(0,i.kt)("inlineCode",{parentName:"p"},"dev")," workspace, you can do so by updating the ",(0,i.kt)("inlineCode",{parentName:"p"},"~/dev.yaml"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n service:\n default:\n replicas: 3\n labels:\n label-key: label-value\n annotations:\n annotation-key: annotation-value\n type: CollaSet\n")),(0,i.kt)("p",null,"Please note that the ",(0,i.kt)("inlineCode",{parentName:"p"},"replicas")," in the workspace configuration only works as a default value and will be overridden by the value set in the application configuration."),(0,i.kt)("p",null,"The workspace configuration need to be updated with the command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace update dev -f ~/dev.yaml\n")),(0,i.kt)("p",null,"For a full reference of what can be configured in the workspace level, please see the ",(0,i.kt)("a",{parentName:"p",href:"../../reference/modules/workspace-configs/workload/service"},"workspace reference"),"."),(0,i.kt)("h2",{id:"example"},"Example"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\n\n"helloworld": ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "helloworld": c.Container {\n image = "gcr.io/google-samples/gb-frontend:v4"\n env: {\n "env1": "VALUE"\n "env2": "VALUE2"\n }\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n # Configure an HTTP readiness probe\n readinessProbe: p.Probe {\n probeHandler: p.Http {\n url: "http://localhost:80"\n }\n initialDelaySeconds: 10\n }\n }\n }\n replicas: 2\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n }\n}\n')),(0,i.kt)("h2",{id:"apply"},"Apply"),(0,i.kt)("p",null,"Re-run steps in ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", new container configuration can be applied."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private UnChanged\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Update\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS UnChanged v1:Service:simple-service:simple-service-dev-helloworld-private, skip \n SUCCESS Update apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \nUpdate apps/v1:Deployment:simple-service:simple-service-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,i.kt)("h2",{id:"validation"},"Validation"),(0,i.kt)("p",null,"We can verify the container (in the deployment template) now has the updated attributes as defined in the container configuration:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"$ kubectl get deployment -n simple-service -o yaml\n...\n template:\n ...\n spec:\n containers:\n - env:\n - name: env1\n value: VALUE\n - name: env2\n value: VALUE2\n image: gcr.io/google-samples/gb-frontend:v4\n imagePullPolicy: IfNotPresent\n name: helloworld\n readinessProbe:\n failureThreshold: 3\n httpGet:\n host: localhost\n path: /\n port: 80\n scheme: HTTP\n initialDelaySeconds: 10\n periodSeconds: 10\n successThreshold: 1\n timeoutSeconds: 1\n resources:\n limits:\n cpu: 500m\n memory: 512M\n...\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4c493feb.f803f261.js b/assets/js/4c493feb.f803f261.js deleted file mode 100644 index a0d65b35ff7..00000000000 --- a/assets/js/4c493feb.f803f261.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9666],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var p=a.createContext({}),s=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=s(e.components);return a.createElement(p.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,i=e.mdxType,r=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(t),m=i,k=u["".concat(p,".").concat(m)]||u[m]||d[m]||r;return t?a.createElement(k,o(o({ref:n},c),{},{components:t})):a.createElement(k,o({ref:n},c))}));function m(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var r=t.length,o=new Array(r);o[0]=u;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:i,o[1]=l;for(var s=2;s{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>o,default:()=>d,frontMatter:()=>r,metadata:()=>l,toc:()=>s});var a=t(87462),i=(t(67294),t(3905));const r={id:"container"},o="Configure Containers",l={unversionedId:"user-guides/working-with-k8s/container",id:"user-guides/working-with-k8s/container",title:"Configure Containers",description:"You can manage container-level configurations in the AppConfiguration model via the containers field (under the workload schema). By default, everything defined in the containers field will be treated as application containers. Sidecar containers will be supported in a future version of kusion.",source:"@site/docs/kusion/5-user-guides/2-working-with-k8s/2-container.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/container",permalink:"/docs/next/user-guides/working-with-k8s/container",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/5-user-guides/2-working-with-k8s/2-container.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"container"},sidebar:"kusion",previous:{title:"Deploy Application",permalink:"/docs/next/user-guides/working-with-k8s/deploy-application"},next:{title:"Expose Service",permalink:"/docs/next/user-guides/working-with-k8s/service"}},p={},s=[{value:"Pre-requisite",id:"pre-requisite",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Apply",id:"apply",level:2},{value:"Validation",id:"validation",level:2}],c={toc:s};function d(e){let{components:n,...t}=e;return(0,i.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"configure-containers"},"Configure Containers"),(0,i.kt)("p",null,"You can manage container-level configurations in the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model via the ",(0,i.kt)("inlineCode",{parentName:"p"},"containers")," field (under the ",(0,i.kt)("inlineCode",{parentName:"p"},"workload")," schema). By default, everything defined in the ",(0,i.kt)("inlineCode",{parentName:"p"},"containers")," field will be treated as application containers. Sidecar containers will be supported in a future version of kusion."),(0,i.kt)("p",null,"For the full ",(0,i.kt)("inlineCode",{parentName:"p"},"Container")," schema reference, please see ",(0,i.kt)("a",{parentName:"p",href:"../../reference/modules/developer-schemas/workload/service#schema-container"},"here")," for more details."),(0,i.kt)("h2",{id:"pre-requisite"},"Pre-requisite"),(0,i.kt)("p",null,"Please refer to the ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,i.kt)("p",null,"The example below also requires you to have ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,i.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,i.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,i.kt)("p",null,"In the last guide, we introduced a step to ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,i.kt)("p",null,"However, if you (or the platform team) would like to set default values for the workloads to standardize the behavior of applications in the ",(0,i.kt)("inlineCode",{parentName:"p"},"dev")," workspace, you can do so by updating the ",(0,i.kt)("inlineCode",{parentName:"p"},"~/dev.yaml"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n service:\n default:\n replicas: 3\n labels:\n label-key: label-value\n annotations:\n annotation-key: annotation-value\n type: CollaSet\n")),(0,i.kt)("p",null,"Please note that the ",(0,i.kt)("inlineCode",{parentName:"p"},"replicas")," in the workspace configuration only works as a default value and will be overridden by the value set in the application configuration."),(0,i.kt)("p",null,"The workspace configuration need to be updated with the command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace update dev -f ~/dev.yaml\n")),(0,i.kt)("p",null,"For a full reference of what can be configured in the workspace level, please see the ",(0,i.kt)("a",{parentName:"p",href:"../../reference/modules/workspace-configs/workload/service"},"workspace reference"),"."),(0,i.kt)("h2",{id:"example"},"Example"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\n\n"helloworld": ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "helloworld": c.Container {\n image = "gcr.io/google-samples/gb-frontend:v4"\n env: {\n "env1": "VALUE"\n "env2": "VALUE2"\n }\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n # Configure an HTTP readiness probe\n readinessProbe: p.Probe {\n probeHandler: p.Http {\n url: "http://localhost:80"\n }\n initialDelaySeconds: 10\n }\n }\n }\n replicas: 2\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n }\n}\n')),(0,i.kt)("h2",{id:"apply"},"Apply"),(0,i.kt)("p",null,"Re-run steps in ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", new container configuration can be applied."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private UnChanged\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Update\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS UnChanged v1:Service:simple-service:simple-service-dev-helloworld-private, skip \n SUCCESS Update apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \nUpdate apps/v1:Deployment:simple-service:simple-service-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,i.kt)("h2",{id:"validation"},"Validation"),(0,i.kt)("p",null,"We can verify the container (in the deployment template) now has the updated attributes as defined in the container configuration:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"$ kubectl get deployment -n simple-service -o yaml\n...\n template:\n ...\n spec:\n containers:\n - env:\n - name: env1\n value: VALUE\n - name: env2\n value: VALUE2\n image: gcr.io/google-samples/gb-frontend:v4\n imagePullPolicy: IfNotPresent\n name: helloworld\n readinessProbe:\n failureThreshold: 3\n httpGet:\n host: localhost\n path: /\n port: 80\n scheme: HTTP\n initialDelaySeconds: 10\n periodSeconds: 10\n successThreshold: 1\n timeoutSeconds: 1\n resources:\n limits:\n cpu: 500m\n memory: 512M\n...\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4e2c8581.75557d41.js b/assets/js/4e2c8581.5cff4508.js similarity index 65% rename from assets/js/4e2c8581.75557d41.js rename to assets/js/4e2c8581.5cff4508.js index 4e2b4ea6f79..f621862b612 100644 --- a/assets/js/4e2c8581.75557d41.js +++ b/assets/js/4e2c8581.5cff4508.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4070],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var o=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function a(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var p=o.createContext({}),s=function(e){var t=o.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},l=function(e){var t=s(e.components);return o.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},u=o.forwardRef((function(e,t){var r=e.components,n=e.mdxType,i=e.originalType,p=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=s(r),f=n,v=u["".concat(p,".").concat(f)]||u[f]||d[f]||i;return r?o.createElement(v,a(a({ref:t},l),{},{components:r})):o.createElement(v,a({ref:t},l))}));function f(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var i=r.length,a=new Array(i);a[0]=u;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c.mdxType="string"==typeof e?e:n,a[1]=c;for(var s=2;s{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>d,frontMatter:()=>i,metadata:()=>c,toc:()=>s});var o=r(87462),n=(r(67294),r(3905));const i={sidebar_label:"Overview",id:"overview"},a="Overview",c={unversionedId:"concepts/project/overview",id:"version-v0.11/concepts/project/overview",title:"Overview",description:"A project in Kusion is defined as a folder that contains a project.yaml file and is generally recommended to be linked to a Git repository. Typically, the mapping between a project and a repository is 1:1, however, it is possible to have multiple projects connected to a single repository \u2014 for example, in the case of a monorepo. A project consists of one or more applications.",source:"@site/docs_versioned_docs/version-v0.11/3-concepts/1-project/1-overview.md",sourceDirName:"3-concepts/1-project",slug:"/concepts/project/overview",permalink:"/docs/concepts/project/overview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/3-concepts/1-project/1-overview.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_label:"Overview",id:"overview"},sidebar:"kusion",previous:{title:"Run Your First App on Kubernetes with Kusion",permalink:"/docs/getting-started/deliver-quickstart"},next:{title:"Project file reference",permalink:"/docs/concepts/project/configuration"}},p={},s=[],l={toc:s};function d(e){let{components:t,...r}=e;return(0,n.kt)("wrapper",(0,o.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"overview"},"Overview"),(0,n.kt)("p",null,"A project in Kusion is defined as a folder that contains a ",(0,n.kt)("inlineCode",{parentName:"p"},"project.yaml")," file and is generally recommended to be linked to a Git repository. Typically, the mapping between a project and a repository is 1:1, however, it is possible to have multiple projects connected to a single repository \u2014 for example, in the case of a monorepo. A project consists of one or more applications."),(0,n.kt)("p",null,"The purpose of the project is to bundle application configurations there are relevant. Specifically, it organizes logical configurations for internal components to orchestrate the application and assembles these configurations to suit different roles, such as developers and SREs, thereby covering the entire lifecycle of application development."),(0,n.kt)("p",null,"From the perspective of the application development lifecycle, the configurations delineated by the project is decoupled from the application code. It takes an immutable image as input, allowing users to perform operations and maintain the application within an independent configuration codebase."))}d.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4070],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var o=r(67294);function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function a(e){for(var t=1;t=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var p=o.createContext({}),s=function(e){var t=o.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},l=function(e){var t=s(e.components);return o.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},u=o.forwardRef((function(e,t){var r=e.components,n=e.mdxType,i=e.originalType,p=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=s(r),f=n,v=u["".concat(p,".").concat(f)]||u[f]||d[f]||i;return r?o.createElement(v,a(a({ref:t},l),{},{components:r})):o.createElement(v,a({ref:t},l))}));function f(e,t){var r=arguments,n=t&&t.mdxType;if("string"==typeof e||n){var i=r.length,a=new Array(i);a[0]=u;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c.mdxType="string"==typeof e?e:n,a[1]=c;for(var s=2;s{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>d,frontMatter:()=>i,metadata:()=>c,toc:()=>s});var o=r(87462),n=(r(67294),r(3905));const i={sidebar_label:"Overview",id:"overview"},a="Overview",c={unversionedId:"concepts/project/overview",id:"version-v0.11/concepts/project/overview",title:"Overview",description:"A project in Kusion is defined as a folder that contains a project.yaml file and is generally recommended to be linked to a Git repository. Typically, the mapping between a project and a repository is 1:1, however, it is possible to have multiple projects connected to a single repository \u2014 for example, in the case of a monorepo. A project consists of one or more applications.",source:"@site/docs_versioned_docs/version-v0.11/3-concepts/1-project/1-overview.md",sourceDirName:"3-concepts/1-project",slug:"/concepts/project/overview",permalink:"/docs/concepts/project/overview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/3-concepts/1-project/1-overview.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_label:"Overview",id:"overview"},sidebar:"kusion",previous:{title:"Run Your First App on Kubernetes with Kusion",permalink:"/docs/getting-started/deliver-quickstart"},next:{title:"Project file reference",permalink:"/docs/concepts/project/configuration"}},p={},s=[],l={toc:s};function d(e){let{components:t,...r}=e;return(0,n.kt)("wrapper",(0,o.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"overview"},"Overview"),(0,n.kt)("p",null,"A project in Kusion is defined as a folder that contains a ",(0,n.kt)("inlineCode",{parentName:"p"},"project.yaml")," file and is generally recommended to be linked to a Git repository. Typically, the mapping between a project and a repository is 1:1, however, it is possible to have multiple projects connected to a single repository \u2014 for example, in the case of a monorepo. A project consists of one or more applications."),(0,n.kt)("p",null,"The purpose of the project is to bundle application configurations there are relevant. Specifically, it organizes logical configurations for internal components to orchestrate the application and assembles these configurations to suit different roles, such as developers and SREs, thereby covering the entire lifecycle of application development."),(0,n.kt)("p",null,"From the perspective of the application development lifecycle, the configurations delineated by the project is decoupled from the application code. It takes an immutable image as input, allowing users to perform operations and maintain the application within an independent configuration codebase."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4e363eb9.b26c531f.js b/assets/js/4e363eb9.b26c531f.js deleted file mode 100644 index d8adc7024ec..00000000000 --- a/assets/js/4e363eb9.b26c531f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4588],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>k});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),u=p(r),k=o,m=u["".concat(c,".").concat(k)]||u[k]||d[k]||a;return r?n.createElement(m,s(s({ref:t},l),{},{components:r})):n.createElement(m,s({ref:t},l))}));function k(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>d,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion workspace delete",i={unversionedId:"reference/commands/kusion-workspace-delete",id:"reference/commands/kusion-workspace-delete",title:"kusion workspace delete",description:"Delete a workspace",source:"@site/docs/kusion/6-reference/1-commands/kusion-workspace-delete.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-delete",permalink:"/docs/next/reference/commands/kusion-workspace-delete",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-workspace-delete.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace create",permalink:"/docs/next/reference/commands/kusion-workspace-create"},next:{title:"kusion workspace list",permalink:"/docs/next/reference/commands/kusion-workspace-list"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-delete"},"kusion workspace delete"),(0,o.kt)("p",null,"Delete a workspace"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command deletes the current or a specified workspace."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace delete\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Delete the current workspace\n kusion workspace delete\n \n # Delete a specified workspace\n kusion workspace delete dev\n \n # Delete a specified workspace in a specified backend\n kusion workspace delete prod --backend oss-prod\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string the backend name\n -h, --help help for delete\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4e363eb9.f325c951.js b/assets/js/4e363eb9.f325c951.js new file mode 100644 index 00000000000..32b69e95967 --- /dev/null +++ b/assets/js/4e363eb9.f325c951.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4588],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>k});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),u=p(r),k=o,m=u["".concat(i,".").concat(k)]||u[k]||d[k]||a;return r?n.createElement(m,s(s({ref:t},l),{},{components:r})):n.createElement(m,s({ref:t},l))}));function k(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=u;var c={};for(var i in t)hasOwnProperty.call(t,i)&&(c[i]=t[i]);c.originalType=e,c.mdxType="string"==typeof e?e:o,s[1]=c;for(var p=2;p{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>s,default:()=>d,frontMatter:()=>a,metadata:()=>c,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion workspace delete",c={unversionedId:"reference/commands/kusion-workspace-delete",id:"reference/commands/kusion-workspace-delete",title:"kusion workspace delete",description:"Delete a workspace",source:"@site/docs/kusion/6-reference/1-commands/kusion-workspace-delete.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-delete",permalink:"/docs/next/reference/commands/kusion-workspace-delete",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-workspace-delete.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace create",permalink:"/docs/next/reference/commands/kusion-workspace-create"},next:{title:"kusion workspace list",permalink:"/docs/next/reference/commands/kusion-workspace-list"}},i={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-delete"},"kusion workspace delete"),(0,o.kt)("p",null,"Delete a workspace"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command deletes the current or a specified workspace."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace delete\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Delete the current workspace\n kusion workspace delete\n \n # Delete a specified workspace\n kusion workspace delete dev\n \n # Delete a specified workspace in a specified backend\n kusion workspace delete prod --backend oss-prod\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string the backend name\n -h, --help help for delete\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4e8f51cf.035f5435.js b/assets/js/4e8f51cf.035f5435.js new file mode 100644 index 00000000000..1d91d8f5280 --- /dev/null +++ b/assets/js/4e8f51cf.035f5435.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[527],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},l=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=s(r),m=o,f=d["".concat(p,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(f,c(c({ref:t},l),{},{components:r})):n.createElement(f,c({ref:t},l))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,c=new Array(a);c[0]=d;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:o,c[1]=i;for(var s=2;s{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>c,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>s});var n=r(87462),o=(r(67294),r(3905));const a={},c="kusion project create",i={unversionedId:"reference/commands/kusion-project-create",id:"version-v0.11/reference/commands/kusion-project-create",title:"kusion project create",description:"Create a new project",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-project-create.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-project-create",permalink:"/docs/reference/commands/kusion-project-create",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-project-create.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion preview",permalink:"/docs/reference/commands/kusion-preview"},next:{title:"kusion project",permalink:"/docs/reference/commands/kusion-project"}},p={},s=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:s};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-project-create"},"kusion project create"),(0,o.kt)("p",null,"Create a new project"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command creates a new project.yaml file under the target directory which by default is the current working directory."),(0,o.kt)("p",null," Note that the target directory needs to be an empty directory."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion project create\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Create a new project with the name of the current working directory\n mkdir my-project && cd my-project\n kusion project create\n \n # Create a new project in a specified target directory\n kusion project create --target /dir/to/projects/my-project\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for create\n -t, --target string specify the target directory\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-project"},"kusion project"),"\t - Project is a folder that contains a project.yaml file and is linked to a Git repository")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4e8f51cf.65a4d96e.js b/assets/js/4e8f51cf.65a4d96e.js deleted file mode 100644 index fd4ea6422c8..00000000000 --- a/assets/js/4e8f51cf.65a4d96e.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[527],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),d=s(r),m=o,f=d["".concat(p,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(f,i(i({ref:t},l),{},{components:r})):n.createElement(f,i({ref:t},l))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=d;var c={};for(var p in t)hasOwnProperty.call(t,p)&&(c[p]=t[p]);c.originalType=e,c.mdxType="string"==typeof e?e:o,i[1]=c;for(var s=2;s{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>s});var n=r(87462),o=(r(67294),r(3905));const a={},i="kusion project create",c={unversionedId:"reference/commands/kusion-project-create",id:"version-v0.11/reference/commands/kusion-project-create",title:"kusion project create",description:"Create a new project",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-project-create.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-project-create",permalink:"/docs/reference/commands/kusion-project-create",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-project-create.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion preview",permalink:"/docs/reference/commands/kusion-preview"},next:{title:"kusion project",permalink:"/docs/reference/commands/kusion-project"}},p={},s=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:s};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-project-create"},"kusion project create"),(0,o.kt)("p",null,"Create a new project"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command creates a new project.yaml file under the target directory which by default is the current working directory."),(0,o.kt)("p",null," Note that the target directory needs to be an empty directory."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion project create\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Create a new project with the name of the current working directory\n mkdir my-project && cd my-project\n kusion project create\n \n # Create a new project in a specified target directory\n kusion project create --target /dir/to/projects/my-project\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for create\n -t, --target string specify the target directory\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-project"},"kusion project"),"\t - Project is a folder that contains a project.yaml file and is linked to a Git repository")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4f047c6d.ce4299f9.js b/assets/js/4f047c6d.ce4299f9.js new file mode 100644 index 00000000000..aa037e08e48 --- /dev/null +++ b/assets/js/4f047c6d.ce4299f9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2124],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=p(r),m=o,f=d["".concat(s,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(f,c(c({ref:t},l),{},{components:r})):n.createElement(f,c({ref:t},l))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,c=new Array(a);c[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,c[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},c="kusion stack create",i={unversionedId:"reference/commands/kusion-stack-create",id:"reference/commands/kusion-stack-create",title:"kusion stack create",description:"Create a new stack",source:"@site/docs/kusion/6-reference/1-commands/kusion-stack-create.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-stack-create",permalink:"/docs/next/reference/commands/kusion-stack-create",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-stack-create.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion project",permalink:"/docs/next/reference/commands/kusion-project"},next:{title:"kusion stack",permalink:"/docs/next/reference/commands/kusion-stack"}},s={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-stack-create"},"kusion stack create"),(0,o.kt)("p",null,"Create a new stack"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command creates a new stack under the target directory which by default is the current working directory."),(0,o.kt)("p",null," The stack folder to be created contains 'stack.yaml', 'kcl.mod' and 'main.k' with the specified values."),(0,o.kt)("p",null," Note that the target directory needs to be a valid project directory with project.yaml file"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion stack create\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Create a new stack at current project directory\n kusion stack create dev\n \n # Create a new stack in a specified target project directory\n kusion stack create dev --target /dir/to/projects/my-project\n \n # Create a new stack copied from the referenced stack under the target project directory\n kusion stack create prod --copy-from dev\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --copy-from string specify the referenced stack path to copy from\n -h, --help help for create\n -t, --target string specify the target project directory\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-stack"},"kusion stack"),"\t - Stack is a folder that contains a stack.yaml file within the corresponding project directory")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4f047c6d.ea484907.js b/assets/js/4f047c6d.ea484907.js deleted file mode 100644 index f8066f818d9..00000000000 --- a/assets/js/4f047c6d.ea484907.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2124],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=p(r),m=o,f=d["".concat(s,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(f,c(c({ref:t},l),{},{components:r})):n.createElement(f,c({ref:t},l))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,c=new Array(a);c[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,c[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},c="kusion stack create",i={unversionedId:"reference/commands/kusion-stack-create",id:"reference/commands/kusion-stack-create",title:"kusion stack create",description:"Create a new stack",source:"@site/docs/kusion/6-reference/1-commands/kusion-stack-create.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-stack-create",permalink:"/docs/next/reference/commands/kusion-stack-create",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-stack-create.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion project",permalink:"/docs/next/reference/commands/kusion-project"},next:{title:"kusion stack",permalink:"/docs/next/reference/commands/kusion-stack"}},s={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-stack-create"},"kusion stack create"),(0,o.kt)("p",null,"Create a new stack"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command creates a new stack under the target directory which by default is the current working directory."),(0,o.kt)("p",null," The stack folder to be created contains 'stack.yaml', 'kcl.mod' and 'main.k' with the specified values."),(0,o.kt)("p",null," Note that the target directory needs to be a valid project directory with project.yaml file"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion stack create\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Create a new stack at current project directory\n kusion stack create dev\n \n # Create a new stack in a specified target project directory\n kusion stack create dev --target /dir/to/projects/my-project\n \n # Create a new stack copied from the referenced stack under the target project directory\n kusion stack create prod --copy-from dev\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --copy-from string specify the referenced stack path to copy from\n -h, --help help for create\n -t, --target string specify the target project directory\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-stack"},"kusion stack"),"\t - Stack is a folder that contains a stack.yaml file within the corresponding project directory")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/500b21de.1c392b82.js b/assets/js/500b21de.f39b00f1.js similarity index 72% rename from assets/js/500b21de.1c392b82.js rename to assets/js/500b21de.f39b00f1.js index 60d9debc373..477ae6c37d8 100644 --- a/assets/js/500b21de.1c392b82.js +++ b/assets/js/500b21de.f39b00f1.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5034],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var u=r.createContext({}),i=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=i(e.components);return r.createElement(u.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,u=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=i(n),m=a,f=d["".concat(u,".").concat(m)]||d[m]||p[m]||s;return n?r.createElement(f,o(o({ref:t},c),{},{components:n})):r.createElement(f,o({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=d;var l={};for(var u in t)hasOwnProperty.call(t,u)&&(l[u]=t[u]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var i=2;i{n.d(t,{Z:()=>o});var r=n(67294),a=n(86010);const s="tabItem_Ymn6";function o(e){let{children:t,hidden:n,className:o}=e;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(s,o),hidden:n},t)}},74866:(e,t,n)=>{n.d(t,{Z:()=>N});var r=n(87462),a=n(67294),s=n(86010),o=n(12466),l=n(76775),u=n(91980),i=n(67392),c=n(50012);function p(e){return function(e){var t;return(null==(t=a.Children.map(e,(e=>{if(!e||(0,a.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})))?void 0:t.filter(Boolean))??[]}(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:a}}=e;return{value:t,label:n,attributes:r,default:a}}))}function d(e){const{values:t,children:n}=e;return(0,a.useMemo)((()=>{const e=t??p(n);return function(e){const t=(0,i.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.k6)(),s=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,u._X)(s),(0,a.useCallback)((e=>{if(!s)return;const t=new URLSearchParams(r.location.search);t.set(s,e),r.replace({...r.location,search:t.toString()})}),[s,r])]}function b(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,s=d(e),[o,l]=(0,a.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:s}))),[u,i]=f({queryString:n,groupId:r}),[p,b]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,s]=(0,c.Nk)(n);return[r,(0,a.useCallback)((e=>{n&&s.set(e)}),[n,s])]}({groupId:r}),h=(()=>{const e=u??p;return m({value:e,tabValues:s})?e:null})();(0,a.useLayoutEffect)((()=>{h&&l(h)}),[h]);return{selectedValue:o,selectValue:(0,a.useCallback)((e=>{if(!m({value:e,tabValues:s}))throw new Error(`Can't select invalid tab value=${e}`);l(e),i(e),b(e)}),[i,b,s]),tabValues:s}}var h=n(72389);const v="tabList__CuJ",g="tabItem_LNqP";function k(e){let{className:t,block:n,selectedValue:l,selectValue:u,tabValues:i}=e;const c=[],{blockElementScrollPositionUntilNextRender:p}=(0,o.o5)(),d=e=>{const t=e.currentTarget,n=c.indexOf(t),r=i[n].value;r!==l&&(p(t),u(r))},m=e=>{var t;let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=c.indexOf(e.currentTarget)+1;n=c[t]??c[0];break}case"ArrowLeft":{const t=c.indexOf(e.currentTarget)-1;n=c[t]??c[c.length-1];break}}null==(t=n)||t.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.Z)("tabs",{"tabs--block":n},t)},i.map((e=>{let{value:t,label:n,attributes:o}=e;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:l===t?0:-1,"aria-selected":l===t,key:t,ref:e=>c.push(e),onKeyDown:m,onClick:d},o,{className:(0,s.Z)("tabs__item",g,null==o?void 0:o.className,{"tabs__item--active":l===t})}),n??t)})))}function y(e){let{lazy:t,children:n,selectedValue:r}=e;const s=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=s.find((e=>e.props.value===r));return e?(0,a.cloneElement)(e,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},s.map(((e,t)=>(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==r}))))}function w(e){const t=b(e);return a.createElement("div",{className:(0,s.Z)("tabs-container",v)},a.createElement(k,(0,r.Z)({},e,t)),a.createElement(y,(0,r.Z)({},e,t)))}function N(e){const t=(0,h.Z)();return a.createElement(w,(0,r.Z)({key:String(t)},e))}},92028:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>l,metadata:()=>i,toc:()=>p});var r=n(87462),a=(n(67294),n(3905)),s=n(74866),o=n(85162);const l={},u="Install Kusion",i={unversionedId:"getting-started/install-kusion",id:"version-v0.10/getting-started/install-kusion",title:"Install Kusion",description:"You can install the latest Kusion CLI on MacOS and Linux. Choose the one you prefer from the methods below.",source:"@site/docs_versioned_docs/version-v0.10/2-getting-started/1-install-kusion.md",sourceDirName:"2-getting-started",slug:"/getting-started/install-kusion",permalink:"/docs/v0.10/getting-started/install-kusion",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/2-getting-started/1-install-kusion.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{},sidebar:"kusion",previous:{title:"Kusion vs Other Software",permalink:"/docs/v0.10/what-is-kusion/kusion-vs-x"},next:{title:"Deliver the WordPress Application on Kubernetes",permalink:"/docs/v0.10/getting-started/deliver-wordpress"}},c={},p=[],d={toc:p};function m(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"install-kusion"},"Install Kusion"),(0,a.kt)("p",null,"You can install the latest Kusion CLI on MacOS and Linux. Choose the one you prefer from the methods below."),(0,a.kt)(s.Z,{mdxType:"Tabs"},(0,a.kt)(o.Z,{value:"Homebrew",mdxType:"TabItem"},(0,a.kt)("p",null,"The recommended method for installing on MacOS and Linux is to use the brew package manager."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Install Kusion")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"# tap formula repository Kusionstack/tap\nbrew tap KusionStack/tap\n\n# install Kusion \nbrew install KusionStack/tap/kusion\n")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Update Kusion")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"# update formulae from remote\nbrew update\n\n# update Kusion\nbrew upgrade KusionStack/tap/kusion\n")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Uninstall Kusion")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"# uninstall Kusion\nbrew uninstall KusionStack/tap/kusion\n"))),(0,a.kt)(o.Z,{value:"curl | sh",mdxType:"TabItem"},(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Install Kusion")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"# install Kusion, default latest version\ncurl https://www.kusionstack.io/scripts/install.sh | sh\n")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Install the Specified Version of Kusion")),(0,a.kt)("p",null,"You can also install the specified version of Kusion by appointing the version as shell script parameter, where the version is the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/tags"},"available tag"),' trimming prefix "v", such as 0.10.0, 0.9.0, etc. In general, you don\'t need to specify Kusion version, just use the command above to install the latest version.'),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"# install Kusion of specified version 0.10.0\ncurl https://www.kusionstack.io/scripts/install.sh | sh -s 0.10.0\n")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Uninstall Kusion")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"# uninstall Kusion\ncurl https://www.kusionstack.io/scripts/uninstall.sh | sh\n")))))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5034],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var u=r.createContext({}),i=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=i(e.components);return r.createElement(u.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,u=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=i(n),m=a,f=d["".concat(u,".").concat(m)]||d[m]||p[m]||s;return n?r.createElement(f,o(o({ref:t},c),{},{components:n})):r.createElement(f,o({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=d;var l={};for(var u in t)hasOwnProperty.call(t,u)&&(l[u]=t[u]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var i=2;i{n.d(t,{Z:()=>o});var r=n(67294),a=n(86010);const s="tabItem_Ymn6";function o(e){let{children:t,hidden:n,className:o}=e;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(s,o),hidden:n},t)}},74866:(e,t,n)=>{n.d(t,{Z:()=>N});var r=n(87462),a=n(67294),s=n(86010),o=n(12466),l=n(76775),u=n(91980),i=n(67392),c=n(50012);function p(e){return function(e){var t;return(null==(t=a.Children.map(e,(e=>{if(!e||(0,a.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})))?void 0:t.filter(Boolean))??[]}(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:a}}=e;return{value:t,label:n,attributes:r,default:a}}))}function d(e){const{values:t,children:n}=e;return(0,a.useMemo)((()=>{const e=t??p(n);return function(e){const t=(0,i.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const r=(0,l.k6)(),s=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,u._X)(s),(0,a.useCallback)((e=>{if(!s)return;const t=new URLSearchParams(r.location.search);t.set(s,e),r.replace({...r.location,search:t.toString()})}),[s,r])]}function b(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,s=d(e),[o,l]=(0,a.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:s}))),[u,i]=f({queryString:n,groupId:r}),[p,b]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,s]=(0,c.Nk)(n);return[r,(0,a.useCallback)((e=>{n&&s.set(e)}),[n,s])]}({groupId:r}),h=(()=>{const e=u??p;return m({value:e,tabValues:s})?e:null})();(0,a.useLayoutEffect)((()=>{h&&l(h)}),[h]);return{selectedValue:o,selectValue:(0,a.useCallback)((e=>{if(!m({value:e,tabValues:s}))throw new Error(`Can't select invalid tab value=${e}`);l(e),i(e),b(e)}),[i,b,s]),tabValues:s}}var h=n(72389);const v="tabList__CuJ",g="tabItem_LNqP";function k(e){let{className:t,block:n,selectedValue:l,selectValue:u,tabValues:i}=e;const c=[],{blockElementScrollPositionUntilNextRender:p}=(0,o.o5)(),d=e=>{const t=e.currentTarget,n=c.indexOf(t),r=i[n].value;r!==l&&(p(t),u(r))},m=e=>{var t;let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=c.indexOf(e.currentTarget)+1;n=c[t]??c[0];break}case"ArrowLeft":{const t=c.indexOf(e.currentTarget)-1;n=c[t]??c[c.length-1];break}}null==(t=n)||t.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.Z)("tabs",{"tabs--block":n},t)},i.map((e=>{let{value:t,label:n,attributes:o}=e;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:l===t?0:-1,"aria-selected":l===t,key:t,ref:e=>c.push(e),onKeyDown:m,onClick:d},o,{className:(0,s.Z)("tabs__item",g,null==o?void 0:o.className,{"tabs__item--active":l===t})}),n??t)})))}function y(e){let{lazy:t,children:n,selectedValue:r}=e;const s=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=s.find((e=>e.props.value===r));return e?(0,a.cloneElement)(e,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},s.map(((e,t)=>(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==r}))))}function w(e){const t=b(e);return a.createElement("div",{className:(0,s.Z)("tabs-container",v)},a.createElement(k,(0,r.Z)({},e,t)),a.createElement(y,(0,r.Z)({},e,t)))}function N(e){const t=(0,h.Z)();return a.createElement(w,(0,r.Z)({key:String(t)},e))}},92028:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>l,metadata:()=>i,toc:()=>p});var r=n(87462),a=(n(67294),n(3905)),s=n(74866),o=n(85162);const l={},u="Install Kusion",i={unversionedId:"getting-started/install-kusion",id:"version-v0.10/getting-started/install-kusion",title:"Install Kusion",description:"You can install the latest Kusion CLI on MacOS and Linux. Choose the one you prefer from the methods below.",source:"@site/docs_versioned_docs/version-v0.10/2-getting-started/1-install-kusion.md",sourceDirName:"2-getting-started",slug:"/getting-started/install-kusion",permalink:"/docs/v0.10/getting-started/install-kusion",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/2-getting-started/1-install-kusion.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{},sidebar:"kusion",previous:{title:"Kusion vs Other Software",permalink:"/docs/v0.10/what-is-kusion/kusion-vs-x"},next:{title:"Deliver the WordPress Application on Kubernetes",permalink:"/docs/v0.10/getting-started/deliver-wordpress"}},c={},p=[],d={toc:p};function m(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"install-kusion"},"Install Kusion"),(0,a.kt)("p",null,"You can install the latest Kusion CLI on MacOS and Linux. Choose the one you prefer from the methods below."),(0,a.kt)(s.Z,{mdxType:"Tabs"},(0,a.kt)(o.Z,{value:"Homebrew",mdxType:"TabItem"},(0,a.kt)("p",null,"The recommended method for installing on MacOS and Linux is to use the brew package manager."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Install Kusion")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"# tap formula repository Kusionstack/tap\nbrew tap KusionStack/tap\n\n# install Kusion \nbrew install KusionStack/tap/kusion\n")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Update Kusion")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"# update formulae from remote\nbrew update\n\n# update Kusion\nbrew upgrade KusionStack/tap/kusion\n")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Uninstall Kusion")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"# uninstall Kusion\nbrew uninstall KusionStack/tap/kusion\n"))),(0,a.kt)(o.Z,{value:"curl | sh",mdxType:"TabItem"},(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Install Kusion")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"# install Kusion, default latest version\ncurl https://www.kusionstack.io/scripts/install.sh | sh\n")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Install the Specified Version of Kusion")),(0,a.kt)("p",null,"You can also install the specified version of Kusion by appointing the version as shell script parameter, where the version is the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/tags"},"available tag"),' trimming prefix "v", such as 0.10.0, 0.9.0, etc. In general, you don\'t need to specify Kusion version, just use the command above to install the latest version.'),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"# install Kusion of specified version 0.10.0\ncurl https://www.kusionstack.io/scripts/install.sh | sh -s 0.10.0\n")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Uninstall Kusion")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"# uninstall Kusion\ncurl https://www.kusionstack.io/scripts/uninstall.sh | sh\n")))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5080e45a.19e842cf.js b/assets/js/5080e45a.19e842cf.js new file mode 100644 index 00000000000..6fecd1967d8 --- /dev/null +++ b/assets/js/5080e45a.19e842cf.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8136],{3905:(t,e,a)=>{a.d(e,{Zo:()=>d,kt:()=>c});var n=a(67294);function r(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function l(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function i(t){for(var e=1;e=0||(r[a]=t[a]);return r}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}var p=n.createContext({}),s=function(t){var e=n.useContext(p),a=e;return t&&(a="function"==typeof t?t(e):i(i({},e),t)),a},d=function(t){var e=s(t.components);return n.createElement(p.Provider,{value:e},t.children)},m={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},u=n.forwardRef((function(t,e){var a=t.components,r=t.mdxType,l=t.originalType,p=t.parentName,d=o(t,["components","mdxType","originalType","parentName"]),u=s(a),c=r,k=u["".concat(p,".").concat(c)]||u[c]||m[c]||l;return a?n.createElement(k,i(i({ref:e},d),{},{components:a})):n.createElement(k,i({ref:e},d))}));function c(t,e){var a=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var l=a.length,i=new Array(l);i[0]=u;var o={};for(var p in e)hasOwnProperty.call(e,p)&&(o[p]=e[p]);o.originalType=t,o.mdxType="string"==typeof t?t:r,i[1]=o;for(var s=2;s{a.r(e),a.d(e,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>o,toc:()=>s});var n=a(87462),r=(a(67294),a(3905));const l={},i="service",o={unversionedId:"reference/modules/catalog-models/workload/service",id:"version-v0.10/reference/modules/catalog-models/workload/service",title:"service",description:"Schemas",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/workload/service.md",sourceDirName:"6-reference/2-modules/1-catalog-models/workload",slug:"/reference/modules/catalog-models/workload/service",permalink:"/docs/v0.10/reference/modules/catalog-models/workload/service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/workload/service.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"job",permalink:"/docs/v0.10/reference/modules/catalog-models/workload/job"},next:{title:"mysql",permalink:"/docs/v0.10/reference/modules/workspace-configs/database/mysql"}},p={},s=[{value:"Schemas",id:"schemas",level:2},{value:"Schema Service",id:"schema-service",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Base Schema",id:"base-schema",level:3},{value:"Schema Container",id:"schema-container",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3},{value:"Schema FileSpec",id:"schema-filespec",level:2},{value:"Attributes",id:"attributes-2",level:3},{value:"Examples",id:"examples-2",level:3},{value:"Schema Probe",id:"schema-probe",level:2},{value:"Attributes",id:"attributes-3",level:3},{value:"Examples",id:"examples-3",level:3},{value:"Schema Exec",id:"schema-exec",level:2},{value:"Attributes",id:"attributes-4",level:3},{value:"Examples",id:"examples-4",level:3},{value:"Schema Http",id:"schema-http",level:2},{value:"Attributes",id:"attributes-5",level:3},{value:"Examples",id:"examples-5",level:3},{value:"Schema Tcp",id:"schema-tcp",level:2},{value:"Attributes",id:"attributes-6",level:3},{value:"Examples",id:"examples-6",level:3},{value:"Schema Lifecycle",id:"schema-lifecycle",level:2},{value:"Attributes",id:"attributes-7",level:3},{value:"Examples",id:"examples-7",level:3},{value:"Schema Secret",id:"schema-secret",level:2},{value:"Attributes",id:"attributes-8",level:3},{value:"Examples",id:"examples-8",level:3},{value:"Schema Port",id:"schema-port",level:2},{value:"Attributes",id:"attributes-9",level:3},{value:"Examples",id:"examples-9",level:3}],d={toc:s};function m(t){let{components:e,...a}=t;return(0,r.kt)("wrapper",(0,n.Z)({},d,a,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"service"},"service"),(0,r.kt)("h2",{id:"schemas"},"Schemas"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-service"},"Service"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-container"},"Container"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-filespec"},"Filespec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-lifecycle"},"LifeCycle")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-probe"},"Probe"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-exec"},"Exec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-http"},"Http")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-tcp"},"Tcp")))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-secret"},"Secret")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-port"},"Port"))))),(0,r.kt)("h2",{id:"schema-service"},"Schema Service"),(0,r.kt)("p",null,"Service is a kind of workload profile that describes how to run your application code. This",(0,r.kt)("br",null),'is typically used for long-running web applications that should "never" go down, and handle',(0,r.kt)("br",null),"short-lived latency-sensitive web requests, or events."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"containers"),(0,r.kt)("br",null),"Containers defines the templates of containers to be ran.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers"},"https://kubernetes.io/docs/concepts/containers")),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-container"},"container.Container"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"replicas"),(0,r.kt)("br",null),"Number of container replicas based on this configuration that should be ran."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"2"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"ports"),(0,r.kt)("br",null),"The list of ports of the Service should get exposed."),(0,r.kt)("td",{parentName:"tr",align:null},"[",(0,r.kt)("a",{parentName:"td",href:"#schema-port"},"network.Port"),"]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"secrets")),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-secret"},"secret.Secret"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"labels"),(0,r.kt)("br",null),"Labels are key/value pairs that are attached to the workload."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"annotations"),(0,r.kt)("br",null),"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type"),(0,r.kt)("br",null),"Type represents the type of workload used by this Service. Currently, it supports several",(0,r.kt)("br",null),"types, including Deployment and CollaSet."),(0,r.kt)("td",{parentName:"tr",align:null},'"Deployment" ',"|",' "CollaSet"'),(0,r.kt)("td",{parentName:"tr",align:null},"Deployment"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'# Instantiate a long-running service and its image is "nginx:v1"\n\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\n\nsvc = wl.Service {\n containers: {\n "nginx": c.Container {\n image: "nginx:v1"\n }\n }\n ports: [\n n.Port {\n port: 80\n public: True\n }\n n.Port {\n port: 9090\n }\n ]\n}\n')),(0,r.kt)("h3",{id:"base-schema"},"Base Schema"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../internal/common#schema-workloadbase"},"WorkloadBase")),(0,r.kt)("h2",{id:"schema-container"},"Schema Container"),(0,r.kt)("p",null,"Container describes how the Application's tasks are expected to be run. Depending on",(0,r.kt)("br",null),"the replicas parameter 1 or more containers can be created from each template."),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"image"),(0,r.kt)("br",null),"Image refers to the Docker image name to run for this container.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/images"},"https://kubernetes.io/docs/concepts/containers/images")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command"),(0,r.kt)("br",null),"Entrypoint array. Not executed within a shell.",(0,r.kt)("br",null),"Command will overwrite the ENTRYPOINT value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's ENTRYPOINT is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"args"),(0,r.kt)("br",null),"Arguments to the entrypoint.",(0,r.kt)("br",null),"Args will overwrite the CMD value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's CMD is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"env"),(0,r.kt)("br",null),"List of environment variables to set in the container.",(0,r.kt)("br",null),"The value of the environment variable may be static text or a value from a secret."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"workingDir"),(0,r.kt)("br",null),"The working directory of the running process defined in entrypoint.",(0,r.kt)("br",null),"Default container runtime will be used if this is not specified."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"resources"),(0,r.kt)("br",null),"Map of resource requirements the container should run with.",(0,r.kt)("br",null),"The resources parameter is a dict with the key being the resource name and the value being",(0,r.kt)("br",null),"the resource value."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"files"),(0,r.kt)("br",null),"List of files to create in the container.",(0,r.kt)("br",null),"The files parameter is a dict with the key being the file name in the container and the value",(0,r.kt)("br",null),"being the target file specification."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-filespec"},"container.FileSpec"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"dirs"),(0,r.kt)("br",null),"Collection of volumes mount into the container's filesystem.",(0,r.kt)("br",null),"The dirs parameter is a dict with the key being the folder name in the container and the value",(0,r.kt)("br",null),"being the referenced volume."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"livenessProbe"),(0,r.kt)("br",null),"LivenessProbe indicates if a running process is healthy.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"readinessProbe"),(0,r.kt)("br",null),"ReadinessProbe indicates whether an application is available to handle requests."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"startupProbe"),(0,r.kt)("br",null),"StartupProbe indicates that the container has started for the first time.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"lifecycle"),(0,r.kt)("br",null),"Lifecycle refers to actions that the management system should take in response to container lifecycle events."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-lifecycle"},"lc.Lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container as c\n\nweb = c.Container {\n image: "nginx:latest"\n command: ["/bin/sh", "-c", "echo hi"]\n env: {\n "name": "value"\n }\n resources: {\n "cpu": "2"\n "memory": "4Gi"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-filespec"},"Schema FileSpec"),(0,r.kt)("p",null,"FileSpec defines the target file in a Container."),(0,r.kt)("h3",{id:"attributes-2"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"mode"),(0,r.kt)("br",null),"Mode bits used to set permissions on this file, must be an octal value",(0,r.kt)("br",null),"between 0000 and 0777 or a decimal value between 0 and 511"),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"content"),(0,r.kt)("br",null),"File content in plain text."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"contentFrom"),(0,r.kt)("br",null),"Source for the file content, reference to a secret of configmap value."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-2"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container as c\n\ntmpFile = c.FileSpec {\n content: "some file contents"\n mode: "0777"\n}\n')),(0,r.kt)("h2",{id:"schema-probe"},"Schema Probe"),(0,r.kt)("p",null,"Probe describes a health check to be performed against a container to determine whether it is",(0,r.kt)("br",null),"alive or ready to receive traffic. There are three probe types: readiness, liveness, and startup."),(0,r.kt)("h3",{id:"attributes-3"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"probeHandler"),(0,r.kt)("br",null),"The action taken to determine the alive or health of a container"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-tcp"},"probe.Tcp")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"initialDelaySeconds"),(0,r.kt)("br",null),"The number of seconds before health checking is activated.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle%5C#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle\\#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"timeoutSeconds"),(0,r.kt)("br",null),"The number of seconds after which the probe times out.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle%5C#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle\\#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"periodSeconds"),(0,r.kt)("br",null),"How often (in seconds) to perform the probe."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"successThreshold"),(0,r.kt)("br",null),"Minimum consecutive successes for the probe to be considered successful after having failed."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"failureThreshold"),(0,r.kt)("br",null),"Minimum consecutive failures for the probe to be considered failed after having succeeded."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"terminationGracePeriod")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-3"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nprobe = p.Probe {\n probeHandler: p.Http {\n path: "/healthz"\n }\n initialDelaySeconds: 10\n}\n')),(0,r.kt)("h2",{id:"schema-exec"},"Schema Exec"),(0,r.kt)("p",null,'Exec describes a "run in container" action.'),(0,r.kt)("h3",{id:"attributes-4"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command"),(0,r.kt)("br",null),"The command line to execute inside the container."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-4"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nexecProbe = p.Exec {\n command: ["probe.sh"]\n}\n')),(0,r.kt)("h2",{id:"schema-http"},"Schema Http"),(0,r.kt)("p",null,"Http describes an action based on HTTP Get requests."),(0,r.kt)("h3",{id:"attributes-5"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url"),(0,r.kt)("br",null),"The full qualified url to send HTTP requests."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"headers"),(0,r.kt)("br",null),"Collection of custom headers to set in the request"),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-5"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nhttpProbe = p.Http {\n url: "http://localhost:80"\n headers: {\n "X-HEADER": "VALUE"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-tcp"},"Schema Tcp"),(0,r.kt)("p",null,"Tcp describes an action based on opening a socket."),(0,r.kt)("h3",{id:"attributes-6"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url"),(0,r.kt)("br",null),"The full qualified url to open a socket."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-6"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\ntcpProbe = p.Tcp {\n url: "tcp://localhost:1234"\n}\n')),(0,r.kt)("h2",{id:"schema-lifecycle"},"Schema Lifecycle"),(0,r.kt)("p",null,"Lifecycle describes actions that the management system should take in response",(0,r.kt)("br",null),"to container lifecycle events."),(0,r.kt)("h3",{id:"attributes-7"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"preStop"),(0,r.kt)("br",null),"The action to be taken before a container is terminated due to an API request or",(0,r.kt)("br",null),"management event such as liveness/startup probe failure, preemption, resource contention, etc.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/%5C#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/\\#container-hooks")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"postStart"),(0,r.kt)("br",null),"The action to be taken after a container is created.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/%5C#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/\\#container-hooks")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-7"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.container.lifecycle as lc\n\nlifecycleHook = lc.Lifecycle {\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n postStart: p.Http {\n url: "http://localhost:80"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-secret"},"Schema Secret"),(0,r.kt)("p",null,"Secret can be used to store sensitive data."),(0,r.kt)("h3",{id:"attributes-8"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type"),(0,r.kt)("br",null),"Type of secret, used to facilitate programmatic handling of secret data.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/configuration/secret/%5C#secret-types"},"https://kubernetes.io/docs/concepts/configuration/secret/\\#secret-types")),(0,r.kt)("td",{parentName:"tr",align:null},'"basic" ',"|",' "opaque"'),(0,r.kt)("td",{parentName:"tr",align:null},"opaque"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"data"),(0,r.kt)("br",null),"Data contains the non-binary secret data in string form."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"immutable"),(0,r.kt)("br",null),"Immutable, if set to true, ensures that data stored in the Secret cannot be updated."),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-8"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.secret as sec\n\nbasicAuth = sec.Secret {\n type: "basic"\n data: {\n "username": ""\n "password": ""\n }\n}\n')),(0,r.kt)("h2",{id:"schema-port"},"Schema Port"),(0,r.kt)("p",null,"Port defines the exposed port of Service, which can be used to describe how the Service",(0,r.kt)("br",null),"get accessed."),(0,r.kt)("h3",{id:"attributes-9"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"port"),(0,r.kt)("br",null),"The exposed port of the Service."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"80"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"protocol"),(0,r.kt)("br",null),"The protocol to access the port."),(0,r.kt)("td",{parentName:"tr",align:null},'"TCP" ',"|",' "UDP"'),(0,r.kt)("td",{parentName:"tr",align:null},'"TCP"'),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"public"),(0,r.kt)("br",null),"Public defines whether the port can be accessed through Internet."),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"False"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"targetPort"),(0,r.kt)("br",null),"The backend container port. If empty, set it the same as the port."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-9"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.network as n\n\nport = n.Port {\n port: 80\n targetPort: 8080\n protocol: "TCP"\n public: True\n}\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5080e45a.86958deb.js b/assets/js/5080e45a.86958deb.js deleted file mode 100644 index b2470d67709..00000000000 --- a/assets/js/5080e45a.86958deb.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8136],{3905:(t,e,a)=>{a.d(e,{Zo:()=>d,kt:()=>c});var n=a(67294);function r(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function l(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function i(t){for(var e=1;e=0||(r[a]=t[a]);return r}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}var p=n.createContext({}),s=function(t){var e=n.useContext(p),a=e;return t&&(a="function"==typeof t?t(e):i(i({},e),t)),a},d=function(t){var e=s(t.components);return n.createElement(p.Provider,{value:e},t.children)},m={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},u=n.forwardRef((function(t,e){var a=t.components,r=t.mdxType,l=t.originalType,p=t.parentName,d=o(t,["components","mdxType","originalType","parentName"]),u=s(a),c=r,k=u["".concat(p,".").concat(c)]||u[c]||m[c]||l;return a?n.createElement(k,i(i({ref:e},d),{},{components:a})):n.createElement(k,i({ref:e},d))}));function c(t,e){var a=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var l=a.length,i=new Array(l);i[0]=u;var o={};for(var p in e)hasOwnProperty.call(e,p)&&(o[p]=e[p]);o.originalType=t,o.mdxType="string"==typeof t?t:r,i[1]=o;for(var s=2;s{a.r(e),a.d(e,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>o,toc:()=>s});var n=a(87462),r=(a(67294),a(3905));const l={},i="service",o={unversionedId:"reference/modules/catalog-models/workload/service",id:"version-v0.10/reference/modules/catalog-models/workload/service",title:"service",description:"Schemas",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/workload/service.md",sourceDirName:"6-reference/2-modules/1-catalog-models/workload",slug:"/reference/modules/catalog-models/workload/service",permalink:"/docs/v0.10/reference/modules/catalog-models/workload/service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/workload/service.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"job",permalink:"/docs/v0.10/reference/modules/catalog-models/workload/job"},next:{title:"mysql",permalink:"/docs/v0.10/reference/modules/workspace-configs/database/mysql"}},p={},s=[{value:"Schemas",id:"schemas",level:2},{value:"Schema Service",id:"schema-service",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Base Schema",id:"base-schema",level:3},{value:"Schema Container",id:"schema-container",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3},{value:"Schema FileSpec",id:"schema-filespec",level:2},{value:"Attributes",id:"attributes-2",level:3},{value:"Examples",id:"examples-2",level:3},{value:"Schema Probe",id:"schema-probe",level:2},{value:"Attributes",id:"attributes-3",level:3},{value:"Examples",id:"examples-3",level:3},{value:"Schema Exec",id:"schema-exec",level:2},{value:"Attributes",id:"attributes-4",level:3},{value:"Examples",id:"examples-4",level:3},{value:"Schema Http",id:"schema-http",level:2},{value:"Attributes",id:"attributes-5",level:3},{value:"Examples",id:"examples-5",level:3},{value:"Schema Tcp",id:"schema-tcp",level:2},{value:"Attributes",id:"attributes-6",level:3},{value:"Examples",id:"examples-6",level:3},{value:"Schema Lifecycle",id:"schema-lifecycle",level:2},{value:"Attributes",id:"attributes-7",level:3},{value:"Examples",id:"examples-7",level:3},{value:"Schema Secret",id:"schema-secret",level:2},{value:"Attributes",id:"attributes-8",level:3},{value:"Examples",id:"examples-8",level:3},{value:"Schema Port",id:"schema-port",level:2},{value:"Attributes",id:"attributes-9",level:3},{value:"Examples",id:"examples-9",level:3}],d={toc:s};function m(t){let{components:e,...a}=t;return(0,r.kt)("wrapper",(0,n.Z)({},d,a,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"service"},"service"),(0,r.kt)("h2",{id:"schemas"},"Schemas"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-service"},"Service"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-container"},"Container"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-filespec"},"Filespec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-lifecycle"},"LifeCycle")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-probe"},"Probe"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-exec"},"Exec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-http"},"Http")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-tcp"},"Tcp")))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-secret"},"Secret")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-port"},"Port"))))),(0,r.kt)("h2",{id:"schema-service"},"Schema Service"),(0,r.kt)("p",null,"Service is a kind of workload profile that describes how to run your application code. This",(0,r.kt)("br",null),'is typically used for long-running web applications that should "never" go down, and handle',(0,r.kt)("br",null),"short-lived latency-sensitive web requests, or events."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"containers"),(0,r.kt)("br",null),"Containers defines the templates of containers to be ran.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers"},"https://kubernetes.io/docs/concepts/containers")),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-container"},"container.Container"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"replicas"),(0,r.kt)("br",null),"Number of container replicas based on this configuration that should be ran."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"2"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"ports"),(0,r.kt)("br",null),"The list of ports of the Service should get exposed."),(0,r.kt)("td",{parentName:"tr",align:null},"[",(0,r.kt)("a",{parentName:"td",href:"#schema-port"},"network.Port"),"]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"secrets")),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-secret"},"secret.Secret"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"labels"),(0,r.kt)("br",null),"Labels are key/value pairs that are attached to the workload."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"annotations"),(0,r.kt)("br",null),"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type"),(0,r.kt)("br",null),"Type represents the type of workload used by this Service. Currently, it supports several",(0,r.kt)("br",null),"types, including Deployment and CollaSet."),(0,r.kt)("td",{parentName:"tr",align:null},'"Deployment" ',"|",' "CollaSet"'),(0,r.kt)("td",{parentName:"tr",align:null},"Deployment"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'# Instantiate a long-running service and its image is "nginx:v1"\n\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\n\nsvc = wl.Service {\n containers: {\n "nginx": c.Container {\n image: "nginx:v1"\n }\n }\n ports: [\n n.Port {\n port: 80\n public: True\n }\n n.Port {\n port: 9090\n }\n ]\n}\n')),(0,r.kt)("h3",{id:"base-schema"},"Base Schema"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../internal/common#schema-workloadbase"},"WorkloadBase")),(0,r.kt)("h2",{id:"schema-container"},"Schema Container"),(0,r.kt)("p",null,"Container describes how the Application's tasks are expected to be run. Depending on",(0,r.kt)("br",null),"the replicas parameter 1 or more containers can be created from each template."),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"image"),(0,r.kt)("br",null),"Image refers to the Docker image name to run for this container.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/images"},"https://kubernetes.io/docs/concepts/containers/images")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command"),(0,r.kt)("br",null),"Entrypoint array. Not executed within a shell.",(0,r.kt)("br",null),"Command will overwrite the ENTRYPOINT value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's ENTRYPOINT is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"args"),(0,r.kt)("br",null),"Arguments to the entrypoint.",(0,r.kt)("br",null),"Args will overwrite the CMD value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's CMD is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"env"),(0,r.kt)("br",null),"List of environment variables to set in the container.",(0,r.kt)("br",null),"The value of the environment variable may be static text or a value from a secret."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"workingDir"),(0,r.kt)("br",null),"The working directory of the running process defined in entrypoint.",(0,r.kt)("br",null),"Default container runtime will be used if this is not specified."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"resources"),(0,r.kt)("br",null),"Map of resource requirements the container should run with.",(0,r.kt)("br",null),"The resources parameter is a dict with the key being the resource name and the value being",(0,r.kt)("br",null),"the resource value."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"files"),(0,r.kt)("br",null),"List of files to create in the container.",(0,r.kt)("br",null),"The files parameter is a dict with the key being the file name in the container and the value",(0,r.kt)("br",null),"being the target file specification."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-filespec"},"container.FileSpec"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"dirs"),(0,r.kt)("br",null),"Collection of volumes mount into the container's filesystem.",(0,r.kt)("br",null),"The dirs parameter is a dict with the key being the folder name in the container and the value",(0,r.kt)("br",null),"being the referenced volume."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"livenessProbe"),(0,r.kt)("br",null),"LivenessProbe indicates if a running process is healthy.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"readinessProbe"),(0,r.kt)("br",null),"ReadinessProbe indicates whether an application is available to handle requests."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"startupProbe"),(0,r.kt)("br",null),"StartupProbe indicates that the container has started for the first time.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"lifecycle"),(0,r.kt)("br",null),"Lifecycle refers to actions that the management system should take in response to container lifecycle events."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-lifecycle"},"lc.Lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container as c\n\nweb = c.Container {\n image: "nginx:latest"\n command: ["/bin/sh", "-c", "echo hi"]\n env: {\n "name": "value"\n }\n resources: {\n "cpu": "2"\n "memory": "4Gi"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-filespec"},"Schema FileSpec"),(0,r.kt)("p",null,"FileSpec defines the target file in a Container."),(0,r.kt)("h3",{id:"attributes-2"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"mode"),(0,r.kt)("br",null),"Mode bits used to set permissions on this file, must be an octal value",(0,r.kt)("br",null),"between 0000 and 0777 or a decimal value between 0 and 511"),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"content"),(0,r.kt)("br",null),"File content in plain text."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"contentFrom"),(0,r.kt)("br",null),"Source for the file content, reference to a secret of configmap value."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-2"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container as c\n\ntmpFile = c.FileSpec {\n content: "some file contents"\n mode: "0777"\n}\n')),(0,r.kt)("h2",{id:"schema-probe"},"Schema Probe"),(0,r.kt)("p",null,"Probe describes a health check to be performed against a container to determine whether it is",(0,r.kt)("br",null),"alive or ready to receive traffic. There are three probe types: readiness, liveness, and startup."),(0,r.kt)("h3",{id:"attributes-3"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"probeHandler"),(0,r.kt)("br",null),"The action taken to determine the alive or health of a container"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-tcp"},"probe.Tcp")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"initialDelaySeconds"),(0,r.kt)("br",null),"The number of seconds before health checking is activated.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle%5C#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle\\#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"timeoutSeconds"),(0,r.kt)("br",null),"The number of seconds after which the probe times out.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle%5C#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle\\#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"periodSeconds"),(0,r.kt)("br",null),"How often (in seconds) to perform the probe."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"successThreshold"),(0,r.kt)("br",null),"Minimum consecutive successes for the probe to be considered successful after having failed."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"failureThreshold"),(0,r.kt)("br",null),"Minimum consecutive failures for the probe to be considered failed after having succeeded."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"terminationGracePeriod")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-3"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nprobe = p.Probe {\n probeHandler: p.Http {\n path: "/healthz"\n }\n initialDelaySeconds: 10\n}\n')),(0,r.kt)("h2",{id:"schema-exec"},"Schema Exec"),(0,r.kt)("p",null,'Exec describes a "run in container" action.'),(0,r.kt)("h3",{id:"attributes-4"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command"),(0,r.kt)("br",null),"The command line to execute inside the container."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-4"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nexecProbe = p.Exec {\n command: ["probe.sh"]\n}\n')),(0,r.kt)("h2",{id:"schema-http"},"Schema Http"),(0,r.kt)("p",null,"Http describes an action based on HTTP Get requests."),(0,r.kt)("h3",{id:"attributes-5"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url"),(0,r.kt)("br",null),"The full qualified url to send HTTP requests."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"headers"),(0,r.kt)("br",null),"Collection of custom headers to set in the request"),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-5"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nhttpProbe = p.Http {\n url: "http://localhost:80"\n headers: {\n "X-HEADER": "VALUE"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-tcp"},"Schema Tcp"),(0,r.kt)("p",null,"Tcp describes an action based on opening a socket."),(0,r.kt)("h3",{id:"attributes-6"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url"),(0,r.kt)("br",null),"The full qualified url to open a socket."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-6"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\ntcpProbe = p.Tcp {\n url: "tcp://localhost:1234"\n}\n')),(0,r.kt)("h2",{id:"schema-lifecycle"},"Schema Lifecycle"),(0,r.kt)("p",null,"Lifecycle describes actions that the management system should take in response",(0,r.kt)("br",null),"to container lifecycle events."),(0,r.kt)("h3",{id:"attributes-7"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"preStop"),(0,r.kt)("br",null),"The action to be taken before a container is terminated due to an API request or",(0,r.kt)("br",null),"management event such as liveness/startup probe failure, preemption, resource contention, etc.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/%5C#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/\\#container-hooks")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"postStart"),(0,r.kt)("br",null),"The action to be taken after a container is created.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/%5C#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/\\#container-hooks")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-7"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.container.lifecycle as lc\n\nlifecycleHook = lc.Lifecycle {\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n postStart: p.Http {\n url: "http://localhost:80"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-secret"},"Schema Secret"),(0,r.kt)("p",null,"Secret can be used to store sensitive data."),(0,r.kt)("h3",{id:"attributes-8"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type"),(0,r.kt)("br",null),"Type of secret, used to facilitate programmatic handling of secret data.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/configuration/secret/%5C#secret-types"},"https://kubernetes.io/docs/concepts/configuration/secret/\\#secret-types")),(0,r.kt)("td",{parentName:"tr",align:null},'"basic" ',"|",' "opaque"'),(0,r.kt)("td",{parentName:"tr",align:null},"opaque"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"data"),(0,r.kt)("br",null),"Data contains the non-binary secret data in string form."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"immutable"),(0,r.kt)("br",null),"Immutable, if set to true, ensures that data stored in the Secret cannot be updated."),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-8"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.secret as sec\n\nbasicAuth = sec.Secret {\n type: "basic"\n data: {\n "username": ""\n "password": ""\n }\n}\n')),(0,r.kt)("h2",{id:"schema-port"},"Schema Port"),(0,r.kt)("p",null,"Port defines the exposed port of Service, which can be used to describe how the Service",(0,r.kt)("br",null),"get accessed."),(0,r.kt)("h3",{id:"attributes-9"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"port"),(0,r.kt)("br",null),"The exposed port of the Service."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"80"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"protocol"),(0,r.kt)("br",null),"The protocol to access the port."),(0,r.kt)("td",{parentName:"tr",align:null},'"TCP" ',"|",' "UDP"'),(0,r.kt)("td",{parentName:"tr",align:null},'"TCP"'),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"public"),(0,r.kt)("br",null),"Public defines whether the port can be accessed through Internet."),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"False"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"targetPort"),(0,r.kt)("br",null),"The backend container port. If empty, set it the same as the port."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-9"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.network as n\n\nport = n.Port {\n port: 80\n targetPort: 8080\n protocol: "TCP"\n public: True\n}\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/50dd0c7d.05190e23.js b/assets/js/50dd0c7d.05190e23.js deleted file mode 100644 index 9c27ddae68a..00000000000 --- a/assets/js/50dd0c7d.05190e23.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8111],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>u});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),s=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(i.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),m=s(n),u=a,f=m["".concat(i,".").concat(u)]||m[u]||d[u]||o;return n?r.createElement(f,l(l({ref:t},p),{},{components:n})):r.createElement(f,l({ref:t},p))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=m;var c={};for(var i in t)hasOwnProperty.call(t,i)&&(c[i]=t[i]);c.originalType=e,c.mdxType="string"==typeof e?e:a,l[1]=c;for(var s=2;s{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>d,frontMatter:()=>o,metadata:()=>c,toc:()=>s});var r=n(87462),a=(n(67294),n(3905));const o={},l="lifecycle",c={unversionedId:"reference/model/catalog_models/internal/container/lifecycle/doc_lifecycle",id:"version-v0.9/reference/model/catalog_models/internal/container/lifecycle/doc_lifecycle",title:"lifecycle",description:"Schema Lifecycle",source:"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/container/lifecycle/doc_lifecycle.md",sourceDirName:"reference/model/catalog_models/internal/container/lifecycle",slug:"/reference/model/catalog_models/internal/container/lifecycle/doc_lifecycle",permalink:"/docs/v0.9/reference/model/catalog_models/internal/container/lifecycle/doc_lifecycle",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/container/lifecycle/doc_lifecycle.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"container",permalink:"/docs/v0.9/reference/model/catalog_models/internal/container/doc_container"},next:{title:"probe",permalink:"/docs/v0.9/reference/model/catalog_models/internal/container/probe/doc_probe"}},i={},s=[{value:"Schema Lifecycle",id:"schema-lifecycle",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:s};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"lifecycle"},"lifecycle"),(0,a.kt)("h2",{id:"schema-lifecycle"},"Schema Lifecycle"),(0,a.kt)("p",null,"Lifecycle describes actions that the management system should take in response",(0,a.kt)("br",null),"to container lifecycle events."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"preStop"),(0,a.kt)("br",null),"The action to be taken before a container is terminated due to an API request or",(0,a.kt)("br",null),"management event such as liveness/startup probe failure, preemption, resource contention, etc.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/%5C#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/\\#container-hooks")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"../probe/doc_probe#schema-exec"},"probe.Exec")," ","|"," ",(0,a.kt)("a",{parentName:"td",href:"../probe/doc_probe#schema-http"},"probe.Http")),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"postStart"),(0,a.kt)("br",null),"The action to be taken after a container is created.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/%5C#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/\\#container-hooks")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"../probe/doc_probe#schema-exec"},"probe.Exec")," ","|"," ",(0,a.kt)("a",{parentName:"td",href:"../probe/doc_probe#schema-http"},"probe.Http")),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.container.lifecycle as lc\n\nlifecycleHook = lc.Lifecycle {\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n postStart: p.Http {\n url: "http://localhost:80"\n }\n}\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/50dd0c7d.fde4efc6.js b/assets/js/50dd0c7d.fde4efc6.js new file mode 100644 index 00000000000..ecbbbcf844c --- /dev/null +++ b/assets/js/50dd0c7d.fde4efc6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8111],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>u});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),s=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(i.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),m=s(n),u=a,f=m["".concat(i,".").concat(u)]||m[u]||d[u]||o;return n?r.createElement(f,c(c({ref:t},p),{},{components:n})):r.createElement(f,c({ref:t},p))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,c=new Array(o);c[0]=m;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:a,c[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>c,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var r=n(87462),a=(n(67294),n(3905));const o={},c="lifecycle",l={unversionedId:"reference/model/catalog_models/internal/container/lifecycle/doc_lifecycle",id:"version-v0.9/reference/model/catalog_models/internal/container/lifecycle/doc_lifecycle",title:"lifecycle",description:"Schema Lifecycle",source:"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/container/lifecycle/doc_lifecycle.md",sourceDirName:"reference/model/catalog_models/internal/container/lifecycle",slug:"/reference/model/catalog_models/internal/container/lifecycle/doc_lifecycle",permalink:"/docs/v0.9/reference/model/catalog_models/internal/container/lifecycle/doc_lifecycle",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/container/lifecycle/doc_lifecycle.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"container",permalink:"/docs/v0.9/reference/model/catalog_models/internal/container/doc_container"},next:{title:"probe",permalink:"/docs/v0.9/reference/model/catalog_models/internal/container/probe/doc_probe"}},i={},s=[{value:"Schema Lifecycle",id:"schema-lifecycle",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:s};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"lifecycle"},"lifecycle"),(0,a.kt)("h2",{id:"schema-lifecycle"},"Schema Lifecycle"),(0,a.kt)("p",null,"Lifecycle describes actions that the management system should take in response",(0,a.kt)("br",null),"to container lifecycle events."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"preStop"),(0,a.kt)("br",null),"The action to be taken before a container is terminated due to an API request or",(0,a.kt)("br",null),"management event such as liveness/startup probe failure, preemption, resource contention, etc.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/%5C#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/\\#container-hooks")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"../probe/doc_probe#schema-exec"},"probe.Exec")," ","|"," ",(0,a.kt)("a",{parentName:"td",href:"../probe/doc_probe#schema-http"},"probe.Http")),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"postStart"),(0,a.kt)("br",null),"The action to be taken after a container is created.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/%5C#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/\\#container-hooks")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"../probe/doc_probe#schema-exec"},"probe.Exec")," ","|"," ",(0,a.kt)("a",{parentName:"td",href:"../probe/doc_probe#schema-http"},"probe.Http")),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.container.lifecycle as lc\n\nlifecycleHook = lc.Lifecycle {\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n postStart: p.Http {\n url: "http://localhost:80"\n }\n}\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/50dd26bc.12228cc7.js b/assets/js/50dd26bc.12228cc7.js deleted file mode 100644 index 6b9e9160b94..00000000000 --- a/assets/js/50dd26bc.12228cc7.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8625],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var i=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var l=i.createContext({}),s=function(e){var n=i.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=s(e.components);return i.createElement(l.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return i.createElement(i.Fragment,{},n)}},u=i.forwardRef((function(e,n){var t=e.components,r=e.mdxType,a=e.originalType,l=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),u=s(t),m=r,g=u["".concat(l,".").concat(m)]||u[m]||d[m]||a;return t?i.createElement(g,o(o({ref:n},c),{},{components:t})):i.createElement(g,o({ref:n},c))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var a=t.length,o=new Array(a);o[0]=u;var p={};for(var l in n)hasOwnProperty.call(n,l)&&(p[l]=n[l]);p.originalType=e,p.mdxType="string"==typeof e?e:r,o[1]=p;for(var s=2;s{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>p,toc:()=>s});var i=t(87462),r=(t(67294),t(3905));const a={id:"image-upgrade"},o="Upgrade Image",p={unversionedId:"user-guides/working-with-k8s/image-upgrade",id:"user-guides/working-with-k8s/image-upgrade",title:"Upgrade Image",description:"You can declare the application's container image via image field of the Container schema.",source:"@site/docs/kusion/5-user-guides/2-working-with-k8s/4-image-upgrade.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/image-upgrade",permalink:"/docs/next/user-guides/working-with-k8s/image-upgrade",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/5-user-guides/2-working-with-k8s/4-image-upgrade.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:4,frontMatter:{id:"image-upgrade"},sidebar:"kusion",previous:{title:"Expose Service",permalink:"/docs/next/user-guides/working-with-k8s/service"},next:{title:"Configure Resource Specification",permalink:"/docs/next/user-guides/working-with-k8s/resource-spec"}},l={},s=[{value:"Pre-requisite",id:"pre-requisite",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],c={toc:s};function d(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,i.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"upgrade-image"},"Upgrade Image"),(0,r.kt)("p",null,"You can declare the application's container image via ",(0,r.kt)("inlineCode",{parentName:"p"},"image")," field of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Container")," schema."),(0,r.kt)("p",null,"For the full ",(0,r.kt)("inlineCode",{parentName:"p"},"Container")," schema reference, please see ",(0,r.kt)("a",{parentName:"p",href:"../../reference/modules/developer-schemas/workload/service#schema-container"},"here")," for more details."),(0,r.kt)("h2",{id:"pre-requisite"},"Pre-requisite"),(0,r.kt)("p",null,"Please refer to the ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,r.kt)("p",null,"The example below also requires you to have ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,r.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,r.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,r.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,r.kt)("h2",{id:"example"},"Example"),(0,r.kt)("p",null,"Update the image value in ",(0,r.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\n\nhelloworld: ac.AppConfiguration {\n workload.containers.nginx: {\n ...\n # before: \n # image = "gcr.io/google-samples/gb-frontend:v4"\n # after: \n image = "gcr.io/google-samples/gb-frontend:v5"\n ...\n }\n}\n')),(0,r.kt)("p",null,"Everything else in ",(0,r.kt)("inlineCode",{parentName:"p"},"main.k")," stay the same."),(0,r.kt)("h2",{id:"applying"},"Applying"),(0,r.kt)("p",null,"Re-run steps in ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", update image is completed."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private UnChanged\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Update\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS UnChanged v1:Service:simple-service:simple-service-dev-helloworld-private, skip \n SUCCESS Update apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \nUpdate apps/v1:Deployment:simple-service:simple-service-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,r.kt)("h2",{id:"validation"},"Validation"),(0,r.kt)("p",null,"We can verify the application container (in the deployment template) now has the updated image (v5) as defined in the container configuration:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kubectl get deployment -n simple-service -o yaml\n...\n template:\n ...\n spec:\n containers:\n - env:\n ...\n image: gcr.io/google-samples/gb-frontend:v5\n ...\n...\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/50dd26bc.3e76f5ad.js b/assets/js/50dd26bc.3e76f5ad.js new file mode 100644 index 00000000000..9f6fe2f44e7 --- /dev/null +++ b/assets/js/50dd26bc.3e76f5ad.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8625],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var i=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function o(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var l=i.createContext({}),s=function(e){var n=i.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=s(e.components);return i.createElement(l.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return i.createElement(i.Fragment,{},n)}},u=i.forwardRef((function(e,n){var t=e.components,a=e.mdxType,r=e.originalType,l=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),u=s(t),m=a,g=u["".concat(l,".").concat(m)]||u[m]||d[m]||r;return t?i.createElement(g,o(o({ref:n},c),{},{components:t})):i.createElement(g,o({ref:n},c))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var r=t.length,o=new Array(r);o[0]=u;var p={};for(var l in n)hasOwnProperty.call(n,l)&&(p[l]=n[l]);p.originalType=e,p.mdxType="string"==typeof e?e:a,o[1]=p;for(var s=2;s{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>r,metadata:()=>p,toc:()=>s});var i=t(87462),a=(t(67294),t(3905));const r={id:"image-upgrade"},o="Upgrade Image",p={unversionedId:"user-guides/working-with-k8s/image-upgrade",id:"user-guides/working-with-k8s/image-upgrade",title:"Upgrade Image",description:"You can declare the application's container image via image field of the Container schema.",source:"@site/docs/kusion/5-user-guides/2-working-with-k8s/4-image-upgrade.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/image-upgrade",permalink:"/docs/next/user-guides/working-with-k8s/image-upgrade",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/5-user-guides/2-working-with-k8s/4-image-upgrade.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:4,frontMatter:{id:"image-upgrade"},sidebar:"kusion",previous:{title:"Expose Service",permalink:"/docs/next/user-guides/working-with-k8s/service"},next:{title:"Configure Resource Specification",permalink:"/docs/next/user-guides/working-with-k8s/resource-spec"}},l={},s=[{value:"Pre-requisite",id:"pre-requisite",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],c={toc:s};function d(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,i.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"upgrade-image"},"Upgrade Image"),(0,a.kt)("p",null,"You can declare the application's container image via ",(0,a.kt)("inlineCode",{parentName:"p"},"image")," field of the ",(0,a.kt)("inlineCode",{parentName:"p"},"Container")," schema."),(0,a.kt)("p",null,"For the full ",(0,a.kt)("inlineCode",{parentName:"p"},"Container")," schema reference, please see ",(0,a.kt)("a",{parentName:"p",href:"../../reference/modules/developer-schemas/workload/service#schema-container"},"here")," for more details."),(0,a.kt)("h2",{id:"pre-requisite"},"Pre-requisite"),(0,a.kt)("p",null,"Please refer to the ",(0,a.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,a.kt)("p",null,"The example below also requires you to have ",(0,a.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,a.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,a.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,a.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,a.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,a.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,a.kt)("h2",{id:"example"},"Example"),(0,a.kt)("p",null,"Update the image value in ",(0,a.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\n\nhelloworld: ac.AppConfiguration {\n workload.containers.nginx: {\n ...\n # before: \n # image = "gcr.io/google-samples/gb-frontend:v4"\n # after: \n image = "gcr.io/google-samples/gb-frontend:v5"\n ...\n }\n}\n')),(0,a.kt)("p",null,"Everything else in ",(0,a.kt)("inlineCode",{parentName:"p"},"main.k")," stay the same."),(0,a.kt)("h2",{id:"applying"},"Applying"),(0,a.kt)("p",null,"Re-run steps in ",(0,a.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", update image is completed."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private UnChanged\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Update\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS UnChanged v1:Service:simple-service:simple-service-dev-helloworld-private, skip \n SUCCESS Update apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \nUpdate apps/v1:Deployment:simple-service:simple-service-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,a.kt)("h2",{id:"validation"},"Validation"),(0,a.kt)("p",null,"We can verify the application container (in the deployment template) now has the updated image (v5) as defined in the container configuration:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"kubectl get deployment -n simple-service -o yaml\n...\n template:\n ...\n spec:\n containers:\n - env:\n ...\n image: gcr.io/google-samples/gb-frontend:v5\n ...\n...\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5112681f.30df3157.js b/assets/js/5112681f.30df3157.js new file mode 100644 index 00000000000..33a06a2872e --- /dev/null +++ b/assets/js/5112681f.30df3157.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8651],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>h});var i=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=i.createContext({}),p=function(e){var t=i.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},c=function(e){var t=p(e.components);return i.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},d=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(n),h=a,m=d["".concat(l,".").concat(h)]||d[h]||u[h]||o;return n?i.createElement(m,r(r({ref:t},c),{},{components:n})):i.createElement(m,r({ref:t},c))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,r=new Array(o);r[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,r[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var i=n(87462),a=(n(67294),n(3905));const o={},r="Expose Application Service Deployed on CSP Kubernetes",s={unversionedId:"user-guides/cloud-resources/expose-service",id:"version-v0.10/user-guides/cloud-resources/expose-service",title:"Expose Application Service Deployed on CSP Kubernetes",description:"Deploying application on the Kubernetes provided by CSP (Cloud Service Provider) is convenient and reliable, which is adopted by many enterprises. Kusion has a good integration with CSP Kubernetes service. You can deploy your application to the Kubernetes cluster, and expose the service in a quite easy way.",source:"@site/docs_versioned_docs/version-v0.10/5-user-guides/1-cloud-resources/2-expose-service.md",sourceDirName:"5-user-guides/1-cloud-resources",slug:"/user-guides/cloud-resources/expose-service",permalink:"/docs/v0.10/user-guides/cloud-resources/expose-service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/5-user-guides/1-cloud-resources/2-expose-service.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{},sidebar:"kusion",previous:{title:"Deliver the WordPress Application with Cloud RDS",permalink:"/docs/v0.10/user-guides/cloud-resources/database"},next:{title:"Deploy Application",permalink:"/docs/v0.10/user-guides/working-with-k8s/deploy-application"}},l={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Expose Service Publicly",id:"expose-service-publicly",level:2},{value:"Set up Workspace",id:"set-up-workspace",level:3},{value:"Write Configuration Code",id:"write-configuration-code",level:3},{value:"Preview and Apply",id:"preview-and-apply",level:3},{value:"Verify Accessibility",id:"verify-accessibility",level:3},{value:"Expose Service Inside Cluster",id:"expose-service-inside-cluster",level:2},{value:"Summary",id:"summary",level:2}],c={toc:p};function u(e){let{components:t,...o}=e;return(0,a.kt)("wrapper",(0,i.Z)({},c,o,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"expose-application-service-deployed-on-csp-kubernetes"},"Expose Application Service Deployed on CSP Kubernetes"),(0,a.kt)("p",null,"Deploying application on the Kubernetes provided by CSP (Cloud Service Provider) is convenient and reliable, which is adopted by many enterprises. Kusion has a good integration with CSP Kubernetes service. You can deploy your application to the Kubernetes cluster, and expose the service in a quite easy way. "),(0,a.kt)("p",null,"This tutorial demonstrates how to expose service of the application deployed on CSP Kubernetes. And the responsibilities of platform engineers and application developers are also clearly defined. In this article, ",(0,a.kt)("em",{parentName:"p"},(0,a.kt)("a",{parentName:"em",href:"https://github.com/KusionStack/konfig/blob/main/example/nginx/dev/main.k"},"exposing the service of nginx"),' (referred to "the example" in the below)')," is given as an example."),(0,a.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,a.kt)("p",null,"Create a Kubernetes cluster, the following CSP Kubernetes services are supported."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/product/kubernetes"},"Alibaba Cloud Container Service for Kubernetes (ACK)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://aws.amazon.com/eks"},"Amazon Elastic Kubernetes Service (EKS)"),".")),(0,a.kt)("p",null,"Get the example from the official example repository."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"git clone https://github.com/KusionStack/konfig.git && cd konfig/example/nginx\n")),(0,a.kt)("h2",{id:"expose-service-publicly"},"Expose Service Publicly"),(0,a.kt)("p",null,"If you want the application can be accessed from outside the cluster, you should expose the service publicly. Follow the steps below, you will simply hit the goal."),(0,a.kt)("h3",{id:"set-up-workspace"},"Set up Workspace"),(0,a.kt)("p",null,"Create the workspace as the target where the application will be deployed to. The workspace is usually set up by platform engineers, which contains platform-standard and application-agnostic configurations. The workspace configurations are organized through a YAML file."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n port:\n default:\n type: alicloud\n annotations:\n service.beta.kubernetes.io/alibaba-cloud-loadbalancer-spec: slb.s1.small\n\nruntimes:\n kubernetes:\n kubeconfig: ""\n')),(0,a.kt)("p",null,"The YAML shown above gives an example of the workspace configuration to expose service on ACK. The file contains two top-level blocks ",(0,a.kt)("inlineCode",{parentName:"p"},"modules")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"runtimes"),", and the block ",(0,a.kt)("inlineCode",{parentName:"p"},"port")," under ",(0,a.kt)("inlineCode",{parentName:"p"},"modules"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"kubernetes")," under ",(0,a.kt)("inlineCode",{parentName:"p"},"runtimes"),". "),(0,a.kt)("p",null,"The block ",(0,a.kt)("inlineCode",{parentName:"p"},"port")," contains the workspace configuration of module port, which has the following fields:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"type: the CSP providing Kubernetes service, support ",(0,a.kt)("inlineCode",{parentName:"li"},"alicloud")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"aws")),(0,a.kt)("li",{parentName:"ul"},"annotations: annotations attached to the service, should be a map"),(0,a.kt)("li",{parentName:"ul"},"labels: labels attached to the service, should be a map")),(0,a.kt)("p",null,"The block ",(0,a.kt)("inlineCode",{parentName:"p"},"kubernetes")," contains the kubernetes related configuration, which has the following fields:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"kubeconfig: the kube-config file path, which is got after creating the cluster.")),(0,a.kt)("p",null,"You can also configure kube-config by environment variables, which has higher priority."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},'export KUBE_CONFIG=""\n')),(0,a.kt)("p",null,"Then, create the workspace with the configuration file. Be attention, the workspace name must be the same as the stack name. The following command creates a workspace named ",(0,a.kt)("inlineCode",{parentName:"p"},"dev")," with configuration file ",(0,a.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace create prod workspace.yaml\n")),(0,a.kt)("h3",{id:"write-configuration-code"},"Write Configuration Code"),(0,a.kt)("p",null,"After creating workspace, you should write application configuration code, which only contains simple and application-centric configurations. This step is usually accomplished by application developers."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.network as n\n\nnginx: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n nginx: c.Container {\n image = "nginx:1.25.2"\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n ports: [\n n.Port {\n type: "aliyun"\n port: 80\n protocol: "TCP"\n public: True\n }\n ]\n }\n}\n')),(0,a.kt)("p",null,"The code shown above describes how to expose service publicly on ACK. Kusion use schema ",(0,a.kt)("inlineCode",{parentName:"p"},"Port")," to describe the network configuration, the primary fields of Port are as follows:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"port: port number to expose service"),(0,a.kt)("li",{parentName:"ul"},"protocol: protocol to expose service, support ",(0,a.kt)("inlineCode",{parentName:"li"},"TCP")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"UDP")),(0,a.kt)("li",{parentName:"ul"},"public: whether to public the service")),(0,a.kt)("p",null,"To public the service, you should set ",(0,a.kt)("inlineCode",{parentName:"p"},"public")," as True. Besides, schema ",(0,a.kt)("inlineCode",{parentName:"p"},"Service")," should be used to describe the workload configuration."),(0,a.kt)("p",null,"That's all what an application developer need to configure! Next, preview and apply the configuration, the application will get deployed and exposed publicly."),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"Kusion uses Load Balancer (LB) provided by the CSP to expose service publicly. For more detailed network configuration, please refer to ",(0,a.kt)("a",{parentName:"p",href:"https://www.kusionstack.io/docs/kusion/configuration-walkthrough/networking"},"Application Networking"))),(0,a.kt)("h3",{id:"preview-and-apply"},"Preview and Apply"),(0,a.kt)("p",null,"Execute ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion preview")," under the stack path, you will get what will be created in the real infrastructure. The picture below gives the preview result of the example. A Namespace, Service and Deployment will be created, which meets the expectation. The service name has a suffix ",(0,a.kt)("inlineCode",{parentName:"p"},"public"),", which shows it can be accessed publicly."),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"preview-public",src:n(85091).Z,width:"1540",height:"262"})),(0,a.kt)("p",null,"Then, execute ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion apply --yes")," to do the real deploying job. Just a command and a few minutes, you have accomplished deploying application and expose it publicly."),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"apply-public",src:n(97932).Z,width:"1558",height:"480"})),(0,a.kt)("h3",{id:"verify-accessibility"},"Verify Accessibility"),(0,a.kt)("p",null,"In the example, the kubernetes Namespace whose name is nginx, and a Service and Deployment under the Namespace should be created. Use ",(0,a.kt)("inlineCode",{parentName:"p"},"kubectl get")," to check, the Service whose type is ",(0,a.kt)("inlineCode",{parentName:"p"},"LoadBalancer")," and Deployment are created indeed. And the Service has ",(0,a.kt)("inlineCode",{parentName:"p"},"EXTERNAL-IP")," 106.5.190.109, which means it can be accessed from outside the cluster."),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"k8s-resource-public",src:n(68162).Z,width:"1662",height:"216"})),(0,a.kt)("p",null,"Visit the ",(0,a.kt)("inlineCode",{parentName:"p"},"EXTERNAL-IP")," via browser, the correct result is returned, which illustrates the servie get publicly exposed successfully."),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"result-public",src:n(65377).Z,width:"1494",height:"682"})),(0,a.kt)("h2",{id:"expose-service-inside-cluster"},"Expose Service Inside Cluster"),(0,a.kt)("p",null,"If you only need the application can be accessed inside the cluster, just configure ",(0,a.kt)("inlineCode",{parentName:"p"},"Public")," as False in schema ",(0,a.kt)("inlineCode",{parentName:"p"},"Port"),". There is no need to change the workspace, which means an application developer can easily change a service exposure range, without the involvement of platform engineers."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.network as n\n\nnginx: ac.AppConfiguration {\n workload: wl.Service {\n ...\n ports: [\n n.Port {\n ...\n public: False\n }\n ]\n }\n}\n")),(0,a.kt)("p",null,"Execute ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion apply --yes"),", the generated Service has suffix ",(0,a.kt)("inlineCode",{parentName:"p"},"private"),"."),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"apply-private",src:n(96057).Z,width:"1612",height:"494"})),(0,a.kt)("p",null,"And the Service type is ",(0,a.kt)("inlineCode",{parentName:"p"},"ClusterIP"),", only has ",(0,a.kt)("inlineCode",{parentName:"p"},"CLUSTER_IP")," and no ",(0,a.kt)("inlineCode",{parentName:"p"},"EXTERNAL_IP"),", which means it cannot get accessed from outside the cluster. "),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"k8s-resource-private",src:n(64600).Z,width:"1542",height:"210"})),(0,a.kt)("h2",{id:"summary"},"Summary"),(0,a.kt)("p",null,"This tutorial demonstrates how to expose service of the application deployed on the CSP Kubernetes. By platform engineers' setup of workspace, and application developers' configuration of schema Port, Kusion enables you expose service simply and efficiently."))}u.isMDXComponent=!0},96057:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/apply-private-a1d1f3a1b5afac81cea19f189d08222d.png"},97932:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/apply-public-d89cdb3ba9d96904e1820bfbcf4671d8.png"},64600:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/k8s-resource-private-62ab14b1de35205866b64a0d63180450.png"},68162:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/k8s-resource-public-66ffcb206b33c5fc6f1a779bc10b3e93.png"},85091:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/preview-public-eea90eec123cd2fc13536be2b645e900.png"},65377:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/result-public-4bf3f757b0a43c78464ec9bcd75a4b2f.png"}}]); \ No newline at end of file diff --git a/assets/js/5112681f.981f3443.js b/assets/js/5112681f.981f3443.js deleted file mode 100644 index b23e019e368..00000000000 --- a/assets/js/5112681f.981f3443.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8651],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>h});var i=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=i.createContext({}),p=function(e){var t=i.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},c=function(e){var t=p(e.components);return i.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},d=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(n),h=a,m=d["".concat(l,".").concat(h)]||d[h]||u[h]||o;return n?i.createElement(m,r(r({ref:t},c),{},{components:n})):i.createElement(m,r({ref:t},c))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,r=new Array(o);r[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,r[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var i=n(87462),a=(n(67294),n(3905));const o={},r="Expose Application Service Deployed on CSP Kubernetes",s={unversionedId:"user-guides/cloud-resources/expose-service",id:"version-v0.10/user-guides/cloud-resources/expose-service",title:"Expose Application Service Deployed on CSP Kubernetes",description:"Deploying application on the Kubernetes provided by CSP (Cloud Service Provider) is convenient and reliable, which is adopted by many enterprises. Kusion has a good integration with CSP Kubernetes service. You can deploy your application to the Kubernetes cluster, and expose the service in a quite easy way.",source:"@site/docs_versioned_docs/version-v0.10/5-user-guides/1-cloud-resources/2-expose-service.md",sourceDirName:"5-user-guides/1-cloud-resources",slug:"/user-guides/cloud-resources/expose-service",permalink:"/docs/v0.10/user-guides/cloud-resources/expose-service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/5-user-guides/1-cloud-resources/2-expose-service.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{},sidebar:"kusion",previous:{title:"Deliver the WordPress Application with Cloud RDS",permalink:"/docs/v0.10/user-guides/cloud-resources/database"},next:{title:"Deploy Application",permalink:"/docs/v0.10/user-guides/working-with-k8s/deploy-application"}},l={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Expose Service Publicly",id:"expose-service-publicly",level:2},{value:"Set up Workspace",id:"set-up-workspace",level:3},{value:"Write Configuration Code",id:"write-configuration-code",level:3},{value:"Preview and Apply",id:"preview-and-apply",level:3},{value:"Verify Accessibility",id:"verify-accessibility",level:3},{value:"Expose Service Inside Cluster",id:"expose-service-inside-cluster",level:2},{value:"Summary",id:"summary",level:2}],c={toc:p};function u(e){let{components:t,...o}=e;return(0,a.kt)("wrapper",(0,i.Z)({},c,o,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"expose-application-service-deployed-on-csp-kubernetes"},"Expose Application Service Deployed on CSP Kubernetes"),(0,a.kt)("p",null,"Deploying application on the Kubernetes provided by CSP (Cloud Service Provider) is convenient and reliable, which is adopted by many enterprises. Kusion has a good integration with CSP Kubernetes service. You can deploy your application to the Kubernetes cluster, and expose the service in a quite easy way. "),(0,a.kt)("p",null,"This tutorial demonstrates how to expose service of the application deployed on CSP Kubernetes. And the responsibilities of platform engineers and application developers are also clearly defined. In this article, ",(0,a.kt)("em",{parentName:"p"},(0,a.kt)("a",{parentName:"em",href:"https://github.com/KusionStack/konfig/blob/main/example/nginx/dev/main.k"},"exposing the service of nginx"),' (referred to "the example" in the below)')," is given as an example."),(0,a.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,a.kt)("p",null,"Create a Kubernetes cluster, the following CSP Kubernetes services are supported."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/product/kubernetes"},"Alibaba Cloud Container Service for Kubernetes (ACK)")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://aws.amazon.com/eks"},"Amazon Elastic Kubernetes Service (EKS)"),".")),(0,a.kt)("p",null,"Get the example from the official example repository."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"git clone https://github.com/KusionStack/konfig.git && cd konfig/example/nginx\n")),(0,a.kt)("h2",{id:"expose-service-publicly"},"Expose Service Publicly"),(0,a.kt)("p",null,"If you want the application can be accessed from outside the cluster, you should expose the service publicly. Follow the steps below, you will simply hit the goal."),(0,a.kt)("h3",{id:"set-up-workspace"},"Set up Workspace"),(0,a.kt)("p",null,"Create the workspace as the target where the application will be deployed to. The workspace is usually set up by platform engineers, which contains platform-standard and application-agnostic configurations. The workspace configurations are organized through a YAML file."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n port:\n default:\n type: alicloud\n annotations:\n service.beta.kubernetes.io/alibaba-cloud-loadbalancer-spec: slb.s1.small\n\nruntimes:\n kubernetes:\n kubeconfig: ""\n')),(0,a.kt)("p",null,"The YAML shown above gives an example of the workspace configuration to expose service on ACK. The file contains two top-level blocks ",(0,a.kt)("inlineCode",{parentName:"p"},"modules")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"runtimes"),", and the block ",(0,a.kt)("inlineCode",{parentName:"p"},"port")," under ",(0,a.kt)("inlineCode",{parentName:"p"},"modules"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"kubernetes")," under ",(0,a.kt)("inlineCode",{parentName:"p"},"runtimes"),". "),(0,a.kt)("p",null,"The block ",(0,a.kt)("inlineCode",{parentName:"p"},"port")," contains the workspace configuration of module port, which has the following fields:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"type: the CSP providing Kubernetes service, support ",(0,a.kt)("inlineCode",{parentName:"li"},"alicloud")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"aws")),(0,a.kt)("li",{parentName:"ul"},"annotations: annotations attached to the service, should be a map"),(0,a.kt)("li",{parentName:"ul"},"labels: labels attached to the service, should be a map")),(0,a.kt)("p",null,"The block ",(0,a.kt)("inlineCode",{parentName:"p"},"kubernetes")," contains the kubernetes related configuration, which has the following fields:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"kubeconfig: the kube-config file path, which is got after creating the cluster.")),(0,a.kt)("p",null,"You can also configure kube-config by environment variables, which has higher priority."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},'export KUBE_CONFIG=""\n')),(0,a.kt)("p",null,"Then, create the workspace with the configuration file. Be attention, the workspace name must be the same as the stack name. The following command creates a workspace named ",(0,a.kt)("inlineCode",{parentName:"p"},"dev")," with configuration file ",(0,a.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace create prod workspace.yaml\n")),(0,a.kt)("h3",{id:"write-configuration-code"},"Write Configuration Code"),(0,a.kt)("p",null,"After creating workspace, you should write application configuration code, which only contains simple and application-centric configurations. This step is usually accomplished by application developers."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.network as n\n\nnginx: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n nginx: c.Container {\n image = "nginx:1.25.2"\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n ports: [\n n.Port {\n type: "aliyun"\n port: 80\n protocol: "TCP"\n public: True\n }\n ]\n }\n}\n')),(0,a.kt)("p",null,"The code shown above describes how to expose service publicly on ACK. Kusion use schema ",(0,a.kt)("inlineCode",{parentName:"p"},"Port")," to describe the network configuration, the primary fields of Port are as follows:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"port: port number to expose service"),(0,a.kt)("li",{parentName:"ul"},"protocol: protocol to expose service, support ",(0,a.kt)("inlineCode",{parentName:"li"},"TCP")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"UDP")),(0,a.kt)("li",{parentName:"ul"},"public: whether to public the service")),(0,a.kt)("p",null,"To public the service, you should set ",(0,a.kt)("inlineCode",{parentName:"p"},"public")," as True. Besides, schema ",(0,a.kt)("inlineCode",{parentName:"p"},"Service")," should be used to describe the workload configuration."),(0,a.kt)("p",null,"That's all what an application developer need to configure! Next, preview and apply the configuration, the application will get deployed and exposed publicly."),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"Kusion uses Load Balancer (LB) provided by the CSP to expose service publicly. For more detailed network configuration, please refer to ",(0,a.kt)("a",{parentName:"p",href:"https://www.kusionstack.io/docs/kusion/configuration-walkthrough/networking"},"Application Networking"))),(0,a.kt)("h3",{id:"preview-and-apply"},"Preview and Apply"),(0,a.kt)("p",null,"Execute ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion preview")," under the stack path, you will get what will be created in the real infrastructure. The picture below gives the preview result of the example. A Namespace, Service and Deployment will be created, which meets the expectation. The service name has a suffix ",(0,a.kt)("inlineCode",{parentName:"p"},"public"),", which shows it can be accessed publicly."),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"preview-public",src:n(85091).Z,width:"1540",height:"262"})),(0,a.kt)("p",null,"Then, execute ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion apply --yes")," to do the real deploying job. Just a command and a few minutes, you have accomplished deploying application and expose it publicly."),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"apply-public",src:n(97932).Z,width:"1558",height:"480"})),(0,a.kt)("h3",{id:"verify-accessibility"},"Verify Accessibility"),(0,a.kt)("p",null,"In the example, the kubernetes Namespace whose name is nginx, and a Service and Deployment under the Namespace should be created. Use ",(0,a.kt)("inlineCode",{parentName:"p"},"kubectl get")," to check, the Service whose type is ",(0,a.kt)("inlineCode",{parentName:"p"},"LoadBalancer")," and Deployment are created indeed. And the Service has ",(0,a.kt)("inlineCode",{parentName:"p"},"EXTERNAL-IP")," 106.5.190.109, which means it can be accessed from outside the cluster."),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"k8s-resource-public",src:n(68162).Z,width:"1662",height:"216"})),(0,a.kt)("p",null,"Visit the ",(0,a.kt)("inlineCode",{parentName:"p"},"EXTERNAL-IP")," via browser, the correct result is returned, which illustrates the servie get publicly exposed successfully."),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"result-public",src:n(65377).Z,width:"1494",height:"682"})),(0,a.kt)("h2",{id:"expose-service-inside-cluster"},"Expose Service Inside Cluster"),(0,a.kt)("p",null,"If you only need the application can be accessed inside the cluster, just configure ",(0,a.kt)("inlineCode",{parentName:"p"},"Public")," as False in schema ",(0,a.kt)("inlineCode",{parentName:"p"},"Port"),". There is no need to change the workspace, which means an application developer can easily change a service exposure range, without the involvement of platform engineers."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.network as n\n\nnginx: ac.AppConfiguration {\n workload: wl.Service {\n ...\n ports: [\n n.Port {\n ...\n public: False\n }\n ]\n }\n}\n")),(0,a.kt)("p",null,"Execute ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion apply --yes"),", the generated Service has suffix ",(0,a.kt)("inlineCode",{parentName:"p"},"private"),"."),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"apply-private",src:n(96057).Z,width:"1612",height:"494"})),(0,a.kt)("p",null,"And the Service type is ",(0,a.kt)("inlineCode",{parentName:"p"},"ClusterIP"),", only has ",(0,a.kt)("inlineCode",{parentName:"p"},"CLUSTER_IP")," and no ",(0,a.kt)("inlineCode",{parentName:"p"},"EXTERNAL_IP"),", which means it cannot get accessed from outside the cluster. "),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"k8s-resource-private",src:n(64600).Z,width:"1542",height:"210"})),(0,a.kt)("h2",{id:"summary"},"Summary"),(0,a.kt)("p",null,"This tutorial demonstrates how to expose service of the application deployed on the CSP Kubernetes. By platform engineers' setup of workspace, and application developers' configuration of schema Port, Kusion enables you expose service simply and efficiently."))}u.isMDXComponent=!0},96057:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/apply-private-a1d1f3a1b5afac81cea19f189d08222d.png"},97932:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/apply-public-d89cdb3ba9d96904e1820bfbcf4671d8.png"},64600:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/k8s-resource-private-62ab14b1de35205866b64a0d63180450.png"},68162:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/k8s-resource-public-66ffcb206b33c5fc6f1a779bc10b3e93.png"},85091:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/preview-public-eea90eec123cd2fc13536be2b645e900.png"},65377:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/result-public-4bf3f757b0a43c78464ec9bcd75a4b2f.png"}}]); \ No newline at end of file diff --git a/assets/js/5207b198.258d7282.js b/assets/js/5207b198.258d7282.js new file mode 100644 index 00000000000..739ab2196a3 --- /dev/null +++ b/assets/js/5207b198.258d7282.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2860],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>u});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),s=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(i.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),m=s(n),u=a,f=m["".concat(i,".").concat(u)]||m[u]||d[u]||o;return n?r.createElement(f,l(l({ref:t},p),{},{components:n})):r.createElement(f,l({ref:t},p))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=m;var c={};for(var i in t)hasOwnProperty.call(t,i)&&(c[i]=t[i]);c.originalType=e,c.mdxType="string"==typeof e?e:a,l[1]=c;for(var s=2;s{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>d,frontMatter:()=>o,metadata:()=>c,toc:()=>s});var r=n(87462),a=(n(67294),n(3905));const o={},l="lifecycle",c={unversionedId:"reference/modules/catalog-models/internal/container/lifecycle/lifecycle",id:"version-v0.10/reference/modules/catalog-models/internal/container/lifecycle/lifecycle",title:"lifecycle",description:"Schema Lifecycle",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/container/lifecycle/lifecycle.md",sourceDirName:"6-reference/2-modules/1-catalog-models/internal/container/lifecycle",slug:"/reference/modules/catalog-models/internal/container/lifecycle/",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/container/lifecycle/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/container/lifecycle/lifecycle.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"container",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/container/"},next:{title:"probe",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/container/probe/"}},i={},s=[{value:"Schema Lifecycle",id:"schema-lifecycle",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:s};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"lifecycle"},"lifecycle"),(0,a.kt)("h2",{id:"schema-lifecycle"},"Schema Lifecycle"),(0,a.kt)("p",null,"Lifecycle describes actions that the management system should take in response",(0,a.kt)("br",null),"to container lifecycle events."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"preStop"),(0,a.kt)("br",null),"The action to be taken before a container is terminated due to an API request or",(0,a.kt)("br",null),"management event such as liveness/startup probe failure, preemption, resource contention, etc.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/%5C#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/\\#container-hooks")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"/docs/v0.10/reference/modules/catalog-models/internal/container/probe/#schema-exec"},"probe.Exec")," ","|"," ",(0,a.kt)("a",{parentName:"td",href:"/docs/v0.10/reference/modules/catalog-models/internal/container/probe/#schema-http"},"probe.Http")),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"postStart"),(0,a.kt)("br",null),"The action to be taken after a container is created.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/%5C#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/\\#container-hooks")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"/docs/v0.10/reference/modules/catalog-models/internal/container/probe/#schema-exec"},"probe.Exec")," ","|"," ",(0,a.kt)("a",{parentName:"td",href:"/docs/v0.10/reference/modules/catalog-models/internal/container/probe/#schema-http"},"probe.Http")),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.container.lifecycle as lc\n\nlifecycleHook = lc.Lifecycle {\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n postStart: p.Http {\n url: "http://localhost:80"\n }\n}\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5207b198.e4f0175c.js b/assets/js/5207b198.e4f0175c.js deleted file mode 100644 index 70dfcbd4b8a..00000000000 --- a/assets/js/5207b198.e4f0175c.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2860],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>u});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),s=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(i.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),m=s(n),u=a,f=m["".concat(i,".").concat(u)]||m[u]||d[u]||o;return n?r.createElement(f,l(l({ref:t},p),{},{components:n})):r.createElement(f,l({ref:t},p))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=m;var c={};for(var i in t)hasOwnProperty.call(t,i)&&(c[i]=t[i]);c.originalType=e,c.mdxType="string"==typeof e?e:a,l[1]=c;for(var s=2;s{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>d,frontMatter:()=>o,metadata:()=>c,toc:()=>s});var r=n(87462),a=(n(67294),n(3905));const o={},l="lifecycle",c={unversionedId:"reference/modules/catalog-models/internal/container/lifecycle/lifecycle",id:"version-v0.10/reference/modules/catalog-models/internal/container/lifecycle/lifecycle",title:"lifecycle",description:"Schema Lifecycle",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/container/lifecycle/lifecycle.md",sourceDirName:"6-reference/2-modules/1-catalog-models/internal/container/lifecycle",slug:"/reference/modules/catalog-models/internal/container/lifecycle/",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/container/lifecycle/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/container/lifecycle/lifecycle.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"container",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/container/"},next:{title:"probe",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/container/probe/"}},i={},s=[{value:"Schema Lifecycle",id:"schema-lifecycle",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:s};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"lifecycle"},"lifecycle"),(0,a.kt)("h2",{id:"schema-lifecycle"},"Schema Lifecycle"),(0,a.kt)("p",null,"Lifecycle describes actions that the management system should take in response",(0,a.kt)("br",null),"to container lifecycle events."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"preStop"),(0,a.kt)("br",null),"The action to be taken before a container is terminated due to an API request or",(0,a.kt)("br",null),"management event such as liveness/startup probe failure, preemption, resource contention, etc.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/%5C#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/\\#container-hooks")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"/docs/v0.10/reference/modules/catalog-models/internal/container/probe/#schema-exec"},"probe.Exec")," ","|"," ",(0,a.kt)("a",{parentName:"td",href:"/docs/v0.10/reference/modules/catalog-models/internal/container/probe/#schema-http"},"probe.Http")),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"postStart"),(0,a.kt)("br",null),"The action to be taken after a container is created.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/%5C#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/\\#container-hooks")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"/docs/v0.10/reference/modules/catalog-models/internal/container/probe/#schema-exec"},"probe.Exec")," ","|"," ",(0,a.kt)("a",{parentName:"td",href:"/docs/v0.10/reference/modules/catalog-models/internal/container/probe/#schema-http"},"probe.Http")),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.container.lifecycle as lc\n\nlifecycleHook = lc.Lifecycle {\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n postStart: p.Http {\n url: "http://localhost:80"\n }\n}\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/530384b4.14cc70cb.js b/assets/js/530384b4.14cc70cb.js deleted file mode 100644 index ac7d2d4041e..00000000000 --- a/assets/js/530384b4.14cc70cb.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7035],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>u});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),s=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},d=function(e){var t=s(e.components);return n.createElement(i.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),m=s(r),u=a,k=m["".concat(i,".").concat(u)]||m[u]||c[u]||o;return r?n.createElement(k,l(l({ref:t},d),{},{components:r})):n.createElement(k,l({ref:t},d))}));function u(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=m;var p={};for(var i in t)hasOwnProperty.call(t,i)&&(p[i]=t[i]);p.originalType=e,p.mdxType="string"==typeof e?e:a,l[1]=p;for(var s=2;s{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>p,toc:()=>s});var n=r(87462),a=(r(67294),r(3905));const o={},l="network",p={unversionedId:"reference/modules/developer-schemas/network/network",id:"version-v0.11/reference/modules/developer-schemas/network/network",title:"network",description:"Schema Network",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/network/network.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/network",slug:"/reference/modules/developer-schemas/network/",permalink:"/docs/reference/modules/developer-schemas/network/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/network/network.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"prometheus",permalink:"/docs/reference/modules/developer-schemas/monitoring/prometheus"},next:{title:"opsrule",permalink:"/docs/reference/modules/developer-schemas/opsrule/"}},i={},s=[{value:"Schema Network",id:"schema-network",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Schema Port",id:"schema-port",level:2},{value:"Examples",id:"examples-1",level:3}],d={toc:s};function c(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"network"},"network"),(0,a.kt)("h2",{id:"schema-network"},"Schema Network"),(0,a.kt)("p",null,"Network defines the exposed port of Service, which can be used to describe how the Service",(0,a.kt)("br",null),"get accessed."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"ports")),(0,a.kt)("td",{parentName:"tr",align:null},"[",(0,a.kt)("a",{parentName:"td",href:"#schema-port"},"Port"),"]"),(0,a.kt)("td",{parentName:"tr",align:null},"The list of ports which the Workload should get exposed."),(0,a.kt)("td",{parentName:"tr",align:null})))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import network as n\n\n"network": n.Network {\n ports: [\n n.Port {\n port: 80\n public: True\n }\n ]\n}\n')),(0,a.kt)("h2",{id:"schema-port"},"Schema Port"),(0,a.kt)("p",null,"Port defines the exposed port of Workload, which can be used to describe how the Workload get accessed."),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"port")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"The exposed port of the Workload."),(0,a.kt)("td",{parentName:"tr",align:null},"80")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"protocol")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},'"TCP"'),(0,a.kt)("td",{parentName:"tr",align:null},'"UDP"'),(0,a.kt)("td",{parentName:"tr",align:null},"The protocol to access the port.")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"public")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},"bool"),(0,a.kt)("td",{parentName:"tr",align:null},"Public defines whether the port can be accessed through Internet."),(0,a.kt)("td",{parentName:"tr",align:null},"False")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"targetPort")),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"The backend container port. If empty, set it the same as the port."),(0,a.kt)("td",{parentName:"tr",align:null})))),(0,a.kt)("h3",{id:"examples-1"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import network as n\n\nport = n.Port {\n port: 80\n targetPort: 8080\n protocol: "TCP"\n public: True\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/530384b4.509f1f7b.js b/assets/js/530384b4.509f1f7b.js new file mode 100644 index 00000000000..5ca4bed620e --- /dev/null +++ b/assets/js/530384b4.509f1f7b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7035],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>u});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),s=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},d=function(e){var t=s(e.components);return n.createElement(i.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),m=s(r),u=a,k=m["".concat(i,".").concat(u)]||m[u]||c[u]||o;return r?n.createElement(k,l(l({ref:t},d),{},{components:r})):n.createElement(k,l({ref:t},d))}));function u(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=m;var p={};for(var i in t)hasOwnProperty.call(t,i)&&(p[i]=t[i]);p.originalType=e,p.mdxType="string"==typeof e?e:a,l[1]=p;for(var s=2;s{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>p,toc:()=>s});var n=r(87462),a=(r(67294),r(3905));const o={},l="network",p={unversionedId:"reference/modules/developer-schemas/network/network",id:"version-v0.11/reference/modules/developer-schemas/network/network",title:"network",description:"Schema Network",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/network/network.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/network",slug:"/reference/modules/developer-schemas/network/",permalink:"/docs/reference/modules/developer-schemas/network/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/network/network.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"prometheus",permalink:"/docs/reference/modules/developer-schemas/monitoring/prometheus"},next:{title:"opsrule",permalink:"/docs/reference/modules/developer-schemas/opsrule/"}},i={},s=[{value:"Schema Network",id:"schema-network",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Schema Port",id:"schema-port",level:2},{value:"Examples",id:"examples-1",level:3}],d={toc:s};function c(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"network"},"network"),(0,a.kt)("h2",{id:"schema-network"},"Schema Network"),(0,a.kt)("p",null,"Network defines the exposed port of Service, which can be used to describe how the Service",(0,a.kt)("br",null),"get accessed."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"ports")),(0,a.kt)("td",{parentName:"tr",align:null},"[",(0,a.kt)("a",{parentName:"td",href:"#schema-port"},"Port"),"]"),(0,a.kt)("td",{parentName:"tr",align:null},"The list of ports which the Workload should get exposed."),(0,a.kt)("td",{parentName:"tr",align:null})))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import network as n\n\n"network": n.Network {\n ports: [\n n.Port {\n port: 80\n public: True\n }\n ]\n}\n')),(0,a.kt)("h2",{id:"schema-port"},"Schema Port"),(0,a.kt)("p",null,"Port defines the exposed port of Workload, which can be used to describe how the Workload get accessed."),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"port")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"The exposed port of the Workload."),(0,a.kt)("td",{parentName:"tr",align:null},"80")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"protocol")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},'"TCP"'),(0,a.kt)("td",{parentName:"tr",align:null},'"UDP"'),(0,a.kt)("td",{parentName:"tr",align:null},"The protocol to access the port.")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"public")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},"bool"),(0,a.kt)("td",{parentName:"tr",align:null},"Public defines whether the port can be accessed through Internet."),(0,a.kt)("td",{parentName:"tr",align:null},"False")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"targetPort")),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"The backend container port. If empty, set it the same as the port."),(0,a.kt)("td",{parentName:"tr",align:null})))),(0,a.kt)("h3",{id:"examples-1"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import network as n\n\nport = n.Port {\n port: 80\n targetPort: 8080\n protocol: "TCP"\n public: True\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5353a7a1.807a83d8.js b/assets/js/5353a7a1.acf7247a.js similarity index 56% rename from assets/js/5353a7a1.807a83d8.js rename to assets/js/5353a7a1.acf7247a.js index 71a498e871f..119c411592e 100644 --- a/assets/js/5353a7a1.807a83d8.js +++ b/assets/js/5353a7a1.acf7247a.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4354],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),u=p(r),m=o,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||a;return r?n.createElement(f,s(s({ref:t},l),{},{components:r})):n.createElement(f,s({ref:t},l))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>d,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion workspace delete",i={unversionedId:"reference/commands/kusion-workspace-delete",id:"version-v0.10/reference/commands/kusion-workspace-delete",title:"kusion workspace delete",description:"Delete a workspace",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace-delete.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-delete",permalink:"/docs/v0.10/reference/commands/kusion-workspace-delete",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace-delete.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace create",permalink:"/docs/v0.10/reference/commands/kusion-workspace-create"},next:{title:"kusion workspace list",permalink:"/docs/v0.10/reference/commands/kusion-workspace-list"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],l={toc:p};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-delete"},"kusion workspace delete"),(0,o.kt)("p",null,"Delete a workspace"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command deletes a specified workspace."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace delete\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Delete a workspace\n kusion workspace delete dev\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for delete\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}d.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4354],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),u=p(r),m=o,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||a;return r?n.createElement(f,s(s({ref:t},l),{},{components:r})):n.createElement(f,s({ref:t},l))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>d,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion workspace delete",i={unversionedId:"reference/commands/kusion-workspace-delete",id:"version-v0.10/reference/commands/kusion-workspace-delete",title:"kusion workspace delete",description:"Delete a workspace",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace-delete.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-delete",permalink:"/docs/v0.10/reference/commands/kusion-workspace-delete",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace-delete.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace create",permalink:"/docs/v0.10/reference/commands/kusion-workspace-create"},next:{title:"kusion workspace list",permalink:"/docs/v0.10/reference/commands/kusion-workspace-list"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],l={toc:p};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-delete"},"kusion workspace delete"),(0,o.kt)("p",null,"Delete a workspace"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command deletes a specified workspace."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace delete\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Delete a workspace\n kusion workspace delete dev\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for delete\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/563e94c0.b0a2f6fc.js b/assets/js/563e94c0.b3f13273.js similarity index 53% rename from assets/js/563e94c0.b0a2f6fc.js rename to assets/js/563e94c0.b3f13273.js index fa661fa0ea2..de6f2a4e412 100644 --- a/assets/js/563e94c0.b0a2f6fc.js +++ b/assets/js/563e94c0.b3f13273.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8440],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>k});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=c(n),k=a,m=d["".concat(s,".").concat(k)]||d[k]||u[k]||o;return n?r.createElement(m,l(l({ref:t},p),{},{components:n})):r.createElement(m,l({ref:t},p))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const o={},l="network",i={unversionedId:"reference/modules/workspace-configs/networking/network",id:"reference/modules/workspace-configs/networking/network",title:"network",description:"network can be used to define workspace-level networking configurations.",source:"@site/docs/kusion/6-reference/2-modules/2-workspace-configs/networking/network.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/networking",slug:"/reference/modules/workspace-configs/networking/network",permalink:"/docs/next/reference/modules/workspace-configs/networking/network",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/2-workspace-configs/networking/network.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"monitoring",permalink:"/docs/next/reference/modules/workspace-configs/monitoring/prometheus"},next:{title:"opsrule",permalink:"/docs/next/reference/modules/workspace-configs/opsrule/"}},s={},c=[{value:"Attributes",id:"attributes",level:2},{value:"Examples",id:"examples",level:3}],p={toc:c};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"network"},"network"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"network")," can be used to define workspace-level networking configurations."),(0,a.kt)("h2",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"type"),(0,a.kt)("br",null),"The specific cloud vendor that provides load balancer."),(0,a.kt)("td",{parentName:"tr",align:null},'"alicloud" ',"|",' "aws"'),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels"),(0,a.kt)("br",null),"The attached labels of the port."),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations"),(0,a.kt)("br",null),"The attached annotations of the port."),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n kusionstack/network@0.1.0:\n default:\n type: alicloud\n labels:\n kusionstack.io/control: "true"\n annotations:\n service.beta.kubernetes.io/alibaba-cloud-loadbalancer-spec: slb.s1.small\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8440],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>k});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=c(n),k=a,m=d["".concat(s,".").concat(k)]||d[k]||u[k]||o;return n?r.createElement(m,l(l({ref:t},p),{},{components:n})):r.createElement(m,l({ref:t},p))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const o={},l="network",i={unversionedId:"reference/modules/workspace-configs/networking/network",id:"reference/modules/workspace-configs/networking/network",title:"network",description:"network can be used to define workspace-level networking configurations.",source:"@site/docs/kusion/6-reference/2-modules/2-workspace-configs/networking/network.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/networking",slug:"/reference/modules/workspace-configs/networking/network",permalink:"/docs/next/reference/modules/workspace-configs/networking/network",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/2-workspace-configs/networking/network.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"monitoring",permalink:"/docs/next/reference/modules/workspace-configs/monitoring/prometheus"},next:{title:"opsrule",permalink:"/docs/next/reference/modules/workspace-configs/opsrule/"}},s={},c=[{value:"Attributes",id:"attributes",level:2},{value:"Examples",id:"examples",level:3}],p={toc:c};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"network"},"network"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"network")," can be used to define workspace-level networking configurations."),(0,a.kt)("h2",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"type"),(0,a.kt)("br",null),"The specific cloud vendor that provides load balancer."),(0,a.kt)("td",{parentName:"tr",align:null},'"alicloud" ',"|",' "aws"'),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels"),(0,a.kt)("br",null),"The attached labels of the port."),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations"),(0,a.kt)("br",null),"The attached annotations of the port."),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n kusionstack/network@0.1.0:\n default:\n type: alicloud\n labels:\n kusionstack.io/control: "true"\n annotations:\n service.beta.kubernetes.io/alibaba-cloud-loadbalancer-spec: slb.s1.small\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5849eb93.348d5665.js b/assets/js/5849eb93.348d5665.js deleted file mode 100644 index fd105d93687..00000000000 --- a/assets/js/5849eb93.348d5665.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4040],{3905:(e,t,r)=>{r.d(t,{Zo:()=>m,kt:()=>d});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},m=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,m=i(e,["components","mdxType","originalType","parentName"]),u=p(r),d=a,h=u["".concat(s,".").concat(d)]||u[d]||c[d]||o;return r?n.createElement(h,l(l({ref:t},m),{},{components:r})):n.createElement(h,l({ref:t},m))}));function d(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=u;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var n=r(87462),a=(r(67294),r(3905));const o={},l="prometheus",i={unversionedId:"reference/model/catalog_models/monitoring/doc_prometheus",id:"version-v0.9/reference/model/catalog_models/monitoring/doc_prometheus",title:"prometheus",description:"Schema Prometheus",source:"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/monitoring/doc_prometheus.md",sourceDirName:"reference/model/catalog_models/monitoring",slug:"/reference/model/catalog_models/monitoring/doc_prometheus",permalink:"/docs/v0.9/reference/model/catalog_models/monitoring/doc_prometheus",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/catalog_models/monitoring/doc_prometheus.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"database",permalink:"/docs/v0.9/reference/model/catalog_models/database/doc_database"},next:{title:"opsrule",permalink:"/docs/v0.9/reference/model/catalog_models/trait/doc_opsrule"}},s={},p=[{value:"Schema Prometheus",id:"schema-prometheus",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],m={toc:p};function c(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"prometheus"},"prometheus"),(0,a.kt)("h2",{id:"schema-prometheus"},"Schema Prometheus"),(0,a.kt)("p",null,"Prometheus can be used to define monitoring requirements"),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"interval"),(0,a.kt)("br",null),"The time interval which Prometheus scrapes metrics data. Only applicable when operator mode is set to true.",(0,a.kt)("br",null),"When operator mode is set to false, the scraping interval can only be set in the scraping job configuration, which kusion does not have permission to manage directly."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Prometheus global scraping interval, which should be 1m if not explicitly set"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"timeout"),(0,a.kt)("br",null),"The timeout when Prometheus scrapes metrics data. Only applicable when operator mode is set to true.",(0,a.kt)("br",null),"When operator mode is set to false, the scraping timeout can only be set in the scraping job configuration, which kusion does not have permission to manage directly."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Prometheus global scraping timeout, which should be 10s if not explicitly set"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"path"),(0,a.kt)("br",null),"The path to scrape metrics from."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Prometheus global scraping path, which should be /metrics if not explicitly set"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"port"),(0,a.kt)("br",null),"The port to scrape metrics from. When using Prometheus operator, this needs to be the port NAME. Otherwise, this can be a port name or a number."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Container ports when scraping pod (monitorType is pod); Service port when scraping service (monitorType is service)"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"scheme"),(0,a.kt)("br",null),"The scheme to scrape metrics from. Possible values are http and https."),(0,a.kt)("td",{parentName:"tr",align:null},'"http" ',"|",' "https"'),(0,a.kt)("td",{parentName:"tr",align:null},"http"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.monitoring as m\n\nmonitoring: m.Prometheus{\n interval: "30s"\n timeout: "15s"\n path: "/metrics"\n port: "web"\n scheme: "http"\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5849eb93.4cbf0ec0.js b/assets/js/5849eb93.4cbf0ec0.js new file mode 100644 index 00000000000..f439c2804fa --- /dev/null +++ b/assets/js/5849eb93.4cbf0ec0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4040],{3905:(e,t,r)=>{r.d(t,{Zo:()=>m,kt:()=>d});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},m=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,m=i(e,["components","mdxType","originalType","parentName"]),u=p(r),d=a,h=u["".concat(s,".").concat(d)]||u[d]||c[d]||o;return r?n.createElement(h,l(l({ref:t},m),{},{components:r})):n.createElement(h,l({ref:t},m))}));function d(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=u;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var n=r(87462),a=(r(67294),r(3905));const o={},l="prometheus",i={unversionedId:"reference/model/catalog_models/monitoring/doc_prometheus",id:"version-v0.9/reference/model/catalog_models/monitoring/doc_prometheus",title:"prometheus",description:"Schema Prometheus",source:"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/monitoring/doc_prometheus.md",sourceDirName:"reference/model/catalog_models/monitoring",slug:"/reference/model/catalog_models/monitoring/doc_prometheus",permalink:"/docs/v0.9/reference/model/catalog_models/monitoring/doc_prometheus",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/catalog_models/monitoring/doc_prometheus.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"database",permalink:"/docs/v0.9/reference/model/catalog_models/database/doc_database"},next:{title:"opsrule",permalink:"/docs/v0.9/reference/model/catalog_models/trait/doc_opsrule"}},s={},p=[{value:"Schema Prometheus",id:"schema-prometheus",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],m={toc:p};function c(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"prometheus"},"prometheus"),(0,a.kt)("h2",{id:"schema-prometheus"},"Schema Prometheus"),(0,a.kt)("p",null,"Prometheus can be used to define monitoring requirements"),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"interval"),(0,a.kt)("br",null),"The time interval which Prometheus scrapes metrics data. Only applicable when operator mode is set to true.",(0,a.kt)("br",null),"When operator mode is set to false, the scraping interval can only be set in the scraping job configuration, which kusion does not have permission to manage directly."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Prometheus global scraping interval, which should be 1m if not explicitly set"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"timeout"),(0,a.kt)("br",null),"The timeout when Prometheus scrapes metrics data. Only applicable when operator mode is set to true.",(0,a.kt)("br",null),"When operator mode is set to false, the scraping timeout can only be set in the scraping job configuration, which kusion does not have permission to manage directly."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Prometheus global scraping timeout, which should be 10s if not explicitly set"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"path"),(0,a.kt)("br",null),"The path to scrape metrics from."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Prometheus global scraping path, which should be /metrics if not explicitly set"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"port"),(0,a.kt)("br",null),"The port to scrape metrics from. When using Prometheus operator, this needs to be the port NAME. Otherwise, this can be a port name or a number."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Container ports when scraping pod (monitorType is pod); Service port when scraping service (monitorType is service)"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"scheme"),(0,a.kt)("br",null),"The scheme to scrape metrics from. Possible values are http and https."),(0,a.kt)("td",{parentName:"tr",align:null},'"http" ',"|",' "https"'),(0,a.kt)("td",{parentName:"tr",align:null},"http"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.monitoring as m\n\nmonitoring: m.Prometheus{\n interval: "30s"\n timeout: "15s"\n path: "/metrics"\n port: "web"\n scheme: "http"\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/588e0fb2.5121320c.js b/assets/js/588e0fb2.5121320c.js new file mode 100644 index 00000000000..475da3e2a11 --- /dev/null +++ b/assets/js/588e0fb2.5121320c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5276],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>u});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),c=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},d=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},p=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),p=c(r),u=a,k=p["".concat(i,".").concat(u)]||p[u]||m[u]||o;return r?n.createElement(k,l(l({ref:t},d),{},{components:r})):n.createElement(k,l({ref:t},d))}));function u(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=p;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,l[1]=s;for(var c=2;c{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>m,frontMatter:()=>o,metadata:()=>s,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const o={},l="common",s={unversionedId:"reference/modules/developer-schemas/internal/common",id:"version-v0.11/reference/modules/developer-schemas/internal/common",title:"common",description:"Schema WorkloadBase",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/internal/common.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/internal",slug:"/reference/modules/developer-schemas/internal/common",permalink:"/docs/reference/modules/developer-schemas/internal/common",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/internal/common.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"postgres",permalink:"/docs/reference/modules/developer-schemas/database/postgres"},next:{title:"container",permalink:"/docs/reference/modules/developer-schemas/internal/container/"}},i={},c=[{value:"Schema WorkloadBase",id:"schema-workloadbase",level:2},{value:"Attributes",id:"attributes",level:3}],d={toc:c};function m(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"common"},"common"),(0,a.kt)("h2",{id:"schema-workloadbase"},"Schema WorkloadBase"),(0,a.kt)("p",null,"WorkloadBase defines set of attributes shared by different workload profile, e.g Service",(0,a.kt)("br",null),"and Job. You can inherit this Schema to reuse these common attributes."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"containers")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:}"),(0,a.kt)("td",{parentName:"tr",align:null},"Containers defines the templates of containers to be ran.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers"},"https://kubernetes.io/docs/concepts/containers")),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Labels are key/value pairs that are attached to the workload."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"replicas")),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"Number of container replicas based on this configuration that should be ran."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"secrets")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:",(0,a.kt)("a",{parentName:"td",href:"#schema-secret"},"s.Secret"),"}"),(0,a.kt)("td",{parentName:"tr",align:null},"Secrets can be used to store small amount of sensitive data e.g. password, token."),(0,a.kt)("td",{parentName:"tr",align:null})))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/588e0fb2.e73f62cf.js b/assets/js/588e0fb2.e73f62cf.js deleted file mode 100644 index 58f3b63a52c..00000000000 --- a/assets/js/588e0fb2.e73f62cf.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5276],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>u});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),c=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},d=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},p=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),p=c(r),u=a,k=p["".concat(i,".").concat(u)]||p[u]||m[u]||o;return r?n.createElement(k,l(l({ref:t},d),{},{components:r})):n.createElement(k,l({ref:t},d))}));function u(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=p;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,l[1]=s;for(var c=2;c{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>m,frontMatter:()=>o,metadata:()=>s,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const o={},l="common",s={unversionedId:"reference/modules/developer-schemas/internal/common",id:"version-v0.11/reference/modules/developer-schemas/internal/common",title:"common",description:"Schema WorkloadBase",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/internal/common.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/internal",slug:"/reference/modules/developer-schemas/internal/common",permalink:"/docs/reference/modules/developer-schemas/internal/common",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/internal/common.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"postgres",permalink:"/docs/reference/modules/developer-schemas/database/postgres"},next:{title:"container",permalink:"/docs/reference/modules/developer-schemas/internal/container/"}},i={},c=[{value:"Schema WorkloadBase",id:"schema-workloadbase",level:2},{value:"Attributes",id:"attributes",level:3}],d={toc:c};function m(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"common"},"common"),(0,a.kt)("h2",{id:"schema-workloadbase"},"Schema WorkloadBase"),(0,a.kt)("p",null,"WorkloadBase defines set of attributes shared by different workload profile, e.g Service",(0,a.kt)("br",null),"and Job. You can inherit this Schema to reuse these common attributes."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"containers")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:}"),(0,a.kt)("td",{parentName:"tr",align:null},"Containers defines the templates of containers to be ran.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers"},"https://kubernetes.io/docs/concepts/containers")),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Labels are key/value pairs that are attached to the workload."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"replicas")),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"Number of container replicas based on this configuration that should be ran."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"secrets")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:",(0,a.kt)("a",{parentName:"td",href:"#schema-secret"},"s.Secret"),"}"),(0,a.kt)("td",{parentName:"tr",align:null},"Secrets can be used to store small amount of sensitive data e.g. password, token."),(0,a.kt)("td",{parentName:"tr",align:null})))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/59cd1056.a387685a.js b/assets/js/59cd1056.a387685a.js deleted file mode 100644 index 867efdc2ce8..00000000000 --- a/assets/js/59cd1056.a387685a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7960],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),c=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},p=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=c(n),m=i,k=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return n?a.createElement(k,r(r({ref:t},p),{},{components:n})):a.createElement(k,r({ref:t},p))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,r=new Array(o);r[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>r,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var a=n(87462),i=(n(67294),n(3905));const o={id:"overview"},r="Configuration File Overview",l={unversionedId:"configuration-walkthrough/overview",id:"version-v0.10/configuration-walkthrough/overview",title:"Configuration File Overview",description:"Kusion consumes one or more declarative configuration files (written in KCL) that describe the application, and delivers intent to the target runtime including Kubernetes, clouds, or on-prem infrastructure.",source:"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/1-overview.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/overview",permalink:"/docs/v0.10/configuration-walkthrough/overview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/1-overview.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"overview"},sidebar:"kusion",previous:{title:"How Kusion Works?",permalink:"/docs/v0.10/concepts/how-kusion-works"},next:{title:"KCL Basics",permalink:"/docs/v0.10/configuration-walkthrough/kcl-basics"}},s={},c=[{value:"Table of Content",id:"table-of-content",level:2},{value:"Directory Structure",id:"directory-structure",level:2},{value:"AppConfiguration Model",id:"appconfiguration-model",level:2},{value:"Authoring Configuration Files",id:"authoring-configuration-files",level:2},{value:"Identifying KCL file",id:"identifying-kcl-file",level:3},{value:"KCL Packages and Import",id:"kcl-packages-and-import",level:3},{value:"Understanding kcl.mod",id:"understanding-kclmod",level:3},{value:"Building Blocks",id:"building-blocks",level:3},{value:"Instantiating an application",id:"instantiating-an-application",level:3},{value:"Using kusion init",id:"using-kusion-init",level:3},{value:"Using references",id:"using-references",level:3}],p={toc:c};function u(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"configuration-file-overview"},"Configuration File Overview"),(0,i.kt)("p",null,"Kusion consumes one or more declarative configuration files (written in KCL) that describe the application, and delivers intent to the target runtime including Kubernetes, clouds, or on-prem infrastructure."),(0,i.kt)("p",null,"This documentation series walks you through the odds and ends of managing such configuration files."),(0,i.kt)("h2",{id:"table-of-content"},"Table of Content"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#configuration-file-overview"},"Configuration File Overview"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#table-of-content"},"Table of Content")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#directory-structure"},"Directory Structure")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#appconfiguration-model"},"AppConfiguration Model")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#authoring-configuration-files"},"Authoring Configuration Files"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#identifying-kcl-file"},"Identifying KCL file")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#kcl-packages-and-import"},"KCL Packages and Import")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#understanding-kclmod"},"Understanding kcl.mod")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#building-blocks"},"Building Blocks")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#instantiating-an-application"},"Instantiating an application")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#using-kusion-init"},"Using ",(0,i.kt)("inlineCode",{parentName:"a"},"kusion init"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#using-references"},"Using references"))))))),(0,i.kt)("h2",{id:"directory-structure"},"Directory Structure"),(0,i.kt)("p",null,"Kusion expects the configuration file to be placed in a certain directory structure because it might need some metadata (that is not stored in the application configuration itself) in order to proceed."),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"See ",(0,i.kt)("a",{parentName:"p",href:"../concepts/project/overview"},"Project")," and ",(0,i.kt)("a",{parentName:"p",href:"../concepts/stack/overview"},"Stack")," for more details about Project and Stack.")),(0,i.kt)("p",null,"A sample multi-stack directory structure looks like the following:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"~/playground$ tree multi-stack-project/\nmulti-stack-project/\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 base\n\u2502\xa0\xa0 \u2514\u2500\u2500 base.k\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u251c\u2500\u2500 prod\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n")),(0,i.kt)("p",null,"In general, the directory structure follows a hierarchy where the top-level is the project configurations, and the sub-directories represent stack-level configurations."),(0,i.kt)("p",null,"You may notice there is a ",(0,i.kt)("inlineCode",{parentName:"p"},"base")," directory besides all the stacks. The ",(0,i.kt)("inlineCode",{parentName:"p"},"base")," directory is not mandatory, but rather a place to store common configurations between different stacks. A common pattern we observed is to use stacks to represent different stages (dev, stage, prod, etc.) in the software development lifecycle, and/or different deployment targets (azure-eastus, aws-us-east-1, etc). A project can have as many stacks as needed."),(0,i.kt)("p",null,"In practice, the applications deployed into dev and prod might very likely end up with a similar set of configurations except a few fields such as the application image (dev might be on newer versions), resource requirements (prod might require more resources), etc."),(0,i.kt)("p",null,"As a general best practice, we recommend managing the common configurations in ",(0,i.kt)("inlineCode",{parentName:"p"},"base.k")," as much as possible to minimize duplicate code. We will cover how override works in ",(0,i.kt)("a",{parentName:"p",href:"base-override"},"Base and Override"),"."),(0,i.kt)("h2",{id:"appconfiguration-model"},"AppConfiguration Model"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," is the out-of-the-box model we build that describes an application. It serves as the declarative intent for a given application."),(0,i.kt)("p",null,"The schema for ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," is defined in the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"KusionStack/catalog")," repository. It is designed as a unified, application-centric model that encapsulates the comprehensive configuration details and in the meantime, hides the complexity of the infrastructure as much as possible."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," consists of multiple sub-components that each represent either the application workload itself, its dependencies, relevant workflows or operational expectations. We will deep dive into the details on how to author each of these elements in this upcoming documentation series."),(0,i.kt)("p",null,"For more details on the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),", please refer to the ",(0,i.kt)("a",{parentName:"p",href:"../concepts/app-configuration"},"design documentation"),"."),(0,i.kt)("h2",{id:"authoring-configuration-files"},"Authoring Configuration Files"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/"},"KCL")," is the choice of configuration language consumed by Kusion. KCL is an open-source constraint-based record and functional language. KCL works well with a large number of complex configurations via modern programming language technology and practice, and is committed to provide better modularity, scalability, stability and extensibility."),(0,i.kt)("h3",{id:"identifying-kcl-file"},"Identifying KCL file"),(0,i.kt)("p",null,"KCL files are identified with ",(0,i.kt)("inlineCode",{parentName:"p"},".k")," suffix in the filename."),(0,i.kt)("h3",{id:"kcl-packages-and-import"},"KCL Packages and Import"),(0,i.kt)("p",null,"Similar to most modern General Programming Languages (GPLs), KCL packages are used to organize collections of related KCL source files into modular and re-usable units."),(0,i.kt)("p",null,"In the context of Kusion, we use KCL packages to define models that could best abstract the behavior of an application. Specifically, we provide an official out-of-the-box KCL package(will keep iterating) with the name ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"catalog"),". When authoring an application configuration file, you can simply import the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"catalog")," package in the source code and use all the schemas (including AppConfiguration) defined in the ",(0,i.kt)("inlineCode",{parentName:"p"},"catalog")," package."),(0,i.kt)("p",null,"Similarly, if the schemas in the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"catalog")," package does not meet your needs, you can always fork it and make modifications, then import the modified package; or create a brand new package altogether and import it."),(0,i.kt)("p",null,"The Kusion ecosystem can be easily expanded in this manner."),(0,i.kt)("p",null,"An example of the import looks like the following:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"### import from the official catalog package\nimport catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\n\n### import my own modified package\nimport my_own_catalog.models.schema.v1 as moc\nimport my_other_package.schema.v1.redis as myredis\n")),(0,i.kt)("p",null,"Take ",(0,i.kt)("inlineCode",{parentName:"p"},"import catalog.models.schema.v1.workload as wl")," as an example, the ",(0,i.kt)("inlineCode",{parentName:"p"},".models.schema.v1.workload")," part after ",(0,i.kt)("inlineCode",{parentName:"p"},"import catalog")," represents the relative path of a specific schema to import. In this case, the ",(0,i.kt)("inlineCode",{parentName:"p"},"workload")," schemas is defined under ",(0,i.kt)("inlineCode",{parentName:"p"},"models/schema/v1/workload")," directory in the ",(0,i.kt)("inlineCode",{parentName:"p"},"catalog")," package."),(0,i.kt)("h3",{id:"understanding-kclmod"},"Understanding kcl.mod"),(0,i.kt)("p",null,"Much similar to the concept of ",(0,i.kt)("inlineCode",{parentName:"p"},"go.mod"),", Kusion uses ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod")," as the source of truth to manage metadata (such as package name, dependencies, etc.) for the current package. Kusion will also auto-generate a ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod.lock")," as the dependency lock file."),(0,i.kt)("p",null,"The most common usage for ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod")," is to manage the dependency of your application configurations. "),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"Please note this ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod")," will be automatically generated if you are using ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," to initialize a project with a template. You will only need to modify this file if you are modifying the project metadata outside the initialization process, such as upgrading the dependency version or adding a new dependency altogether, etc.")),(0,i.kt)("p",null,"There are 3 sections in a ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"package"),", representing the metadata for the current package."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"dependencies"),", describing the packages the current package depends on. Supports referencing either a git repository or an OCI artifact."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"profile"),", defining the behavior for Kusion. In the example below, it describes the list of files Kusion should look for when parsing the application configuration.")),(0,i.kt)("p",null,"An example of ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'[package]\nname = "multi-stack-project"\nedition = "0.5.0"\nversion = "0.1.0"\n\n[dependencies]\ncatalog = { git = "https://github.com/KusionStack/catalog.git", tag = "0.1.0" }\n# Uncomment the line below to use your own modified package\n# my-package = ghcr.io/kcl-lang/my-package\n\n[profile]\nentries = ["../base/base.k", "main.k"]\n')),(0,i.kt)("h3",{id:"building-blocks"},"Building Blocks"),(0,i.kt)("p",null,"Configuration files consist of building blocks that are made of instances of schemas. An ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance consists of several child schemas, most of which are optional. The only mandatory one is the ",(0,i.kt)("inlineCode",{parentName:"p"},"workload")," instance. We will take a closer look in the ",(0,i.kt)("a",{parentName:"p",href:"workload"},"workload walkthrough"),". The order of the building blocks does NOT matter."),(0,i.kt)("p",null,"The major building blocks as of version ",(0,i.kt)("inlineCode",{parentName:"p"},"0.9.0"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {}\n ...\n }\n ports: []\n secrets: {}\n }\n database: d.Database{}\n monitoring: m.Prometheus{}\n opsRule: t.OpsRule {}\n ...\n}\n')),(0,i.kt)("p",null,"We will deep dive into each one of the building blocks in this documentation series."),(0,i.kt)("h3",{id:"instantiating-an-application"},"Instantiating an application"),(0,i.kt)("p",null,"In Kusion's out-of-the-box experience, an application is identified with an instance of ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),". You may have more than one application in the same project or stack."),(0,i.kt)("p",null,"Here's an example of a configuration that can be consumed by Kusion (assuming it is placed inside the proper directory structure that includes project and stack configurations, with a ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod")," present):"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.network as n\nimport catalog.models.schema.v1.workload.container as c\n\ngocity: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "gocity": c.Container {\n image = "howieyuen/gocity:latest"\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n ports: [\n n.Port {\n port: 4000\n }\n ]\n }\n}\n')),(0,i.kt)("p",null,"Don't worry about what ",(0,i.kt)("inlineCode",{parentName:"p"},"workload")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"ports")," stand for at the moment. We will deep dive into each one of them in this upcoming documentation series."),(0,i.kt)("h3",{id:"using-kusion-init"},"Using ",(0,i.kt)("inlineCode",{parentName:"h3"},"kusion init")),(0,i.kt)("p",null,"Kusion offers a ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," sub-command which initializes a new project using some pre-built templates, which saves you from the hassle of manually building the aforementioned directory structure that Kusion expects."),(0,i.kt)("p",null,"There is a built-in template ",(0,i.kt)("inlineCode",{parentName:"p"},"single-stack-sample")," in the Kusion binary that can be used offline. "),(0,i.kt)("p",null,"We also maintain a ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion-templates"},"kusion-templates repository")," that hosts a list of more comprehensive project scaffolds. You can access them via ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init --online")," command which requires connectivity to ",(0,i.kt)("inlineCode",{parentName:"p"},"github.com"),"."),(0,i.kt)("p",null,"The pre-built templates are meant to help you get off the ground quickly with some simple out-of-the-box examples. You can refer to the ",(0,i.kt)("a",{parentName:"p",href:"../getting-started/deliver-wordpress"},"QuickStart documentation")," for some step-by-step tutorials."),(0,i.kt)("h3",{id:"using-references"},"Using references"),(0,i.kt)("p",null,"The reference documentation for the ",(0,i.kt)("inlineCode",{parentName:"p"},"catalog")," package is located in ",(0,i.kt)("a",{parentName:"p",href:"../reference/modules/catalog-models/app-configuration"},"Reference"),"."),(0,i.kt)("p",null,"If you are using the ",(0,i.kt)("inlineCode",{parentName:"p"},"catalog")," package out of the box, the reference documentation provides a comprehensive view for each schema involved, including all the attribute names and description, their types, default value if any, and whether a particular attribute is required or not. There will also be an example attached to each schema reference."),(0,i.kt)("p",null,"We will also deep dive into some common examples in the upcoming sections."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/59cd1056.b873aae5.js b/assets/js/59cd1056.b873aae5.js new file mode 100644 index 00000000000..da538b03e0b --- /dev/null +++ b/assets/js/59cd1056.b873aae5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7960],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),c=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},p=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=c(n),m=i,k=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return n?a.createElement(k,r(r({ref:t},p),{},{components:n})):a.createElement(k,r({ref:t},p))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,r=new Array(o);r[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>r,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var a=n(87462),i=(n(67294),n(3905));const o={id:"overview"},r="Configuration File Overview",l={unversionedId:"configuration-walkthrough/overview",id:"version-v0.10/configuration-walkthrough/overview",title:"Configuration File Overview",description:"Kusion consumes one or more declarative configuration files (written in KCL) that describe the application, and delivers intent to the target runtime including Kubernetes, clouds, or on-prem infrastructure.",source:"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/1-overview.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/overview",permalink:"/docs/v0.10/configuration-walkthrough/overview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/1-overview.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"overview"},sidebar:"kusion",previous:{title:"How Kusion Works?",permalink:"/docs/v0.10/concepts/how-kusion-works"},next:{title:"KCL Basics",permalink:"/docs/v0.10/configuration-walkthrough/kcl-basics"}},s={},c=[{value:"Table of Content",id:"table-of-content",level:2},{value:"Directory Structure",id:"directory-structure",level:2},{value:"AppConfiguration Model",id:"appconfiguration-model",level:2},{value:"Authoring Configuration Files",id:"authoring-configuration-files",level:2},{value:"Identifying KCL file",id:"identifying-kcl-file",level:3},{value:"KCL Packages and Import",id:"kcl-packages-and-import",level:3},{value:"Understanding kcl.mod",id:"understanding-kclmod",level:3},{value:"Building Blocks",id:"building-blocks",level:3},{value:"Instantiating an application",id:"instantiating-an-application",level:3},{value:"Using kusion init",id:"using-kusion-init",level:3},{value:"Using references",id:"using-references",level:3}],p={toc:c};function u(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"configuration-file-overview"},"Configuration File Overview"),(0,i.kt)("p",null,"Kusion consumes one or more declarative configuration files (written in KCL) that describe the application, and delivers intent to the target runtime including Kubernetes, clouds, or on-prem infrastructure."),(0,i.kt)("p",null,"This documentation series walks you through the odds and ends of managing such configuration files."),(0,i.kt)("h2",{id:"table-of-content"},"Table of Content"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#configuration-file-overview"},"Configuration File Overview"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#table-of-content"},"Table of Content")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#directory-structure"},"Directory Structure")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#appconfiguration-model"},"AppConfiguration Model")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#authoring-configuration-files"},"Authoring Configuration Files"),(0,i.kt)("ul",{parentName:"li"},(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#identifying-kcl-file"},"Identifying KCL file")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#kcl-packages-and-import"},"KCL Packages and Import")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#understanding-kclmod"},"Understanding kcl.mod")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#building-blocks"},"Building Blocks")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#instantiating-an-application"},"Instantiating an application")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#using-kusion-init"},"Using ",(0,i.kt)("inlineCode",{parentName:"a"},"kusion init"))),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#using-references"},"Using references"))))))),(0,i.kt)("h2",{id:"directory-structure"},"Directory Structure"),(0,i.kt)("p",null,"Kusion expects the configuration file to be placed in a certain directory structure because it might need some metadata (that is not stored in the application configuration itself) in order to proceed."),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"See ",(0,i.kt)("a",{parentName:"p",href:"../concepts/project/overview"},"Project")," and ",(0,i.kt)("a",{parentName:"p",href:"../concepts/stack/overview"},"Stack")," for more details about Project and Stack.")),(0,i.kt)("p",null,"A sample multi-stack directory structure looks like the following:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"~/playground$ tree multi-stack-project/\nmulti-stack-project/\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 base\n\u2502\xa0\xa0 \u2514\u2500\u2500 base.k\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u251c\u2500\u2500 prod\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n")),(0,i.kt)("p",null,"In general, the directory structure follows a hierarchy where the top-level is the project configurations, and the sub-directories represent stack-level configurations."),(0,i.kt)("p",null,"You may notice there is a ",(0,i.kt)("inlineCode",{parentName:"p"},"base")," directory besides all the stacks. The ",(0,i.kt)("inlineCode",{parentName:"p"},"base")," directory is not mandatory, but rather a place to store common configurations between different stacks. A common pattern we observed is to use stacks to represent different stages (dev, stage, prod, etc.) in the software development lifecycle, and/or different deployment targets (azure-eastus, aws-us-east-1, etc). A project can have as many stacks as needed."),(0,i.kt)("p",null,"In practice, the applications deployed into dev and prod might very likely end up with a similar set of configurations except a few fields such as the application image (dev might be on newer versions), resource requirements (prod might require more resources), etc."),(0,i.kt)("p",null,"As a general best practice, we recommend managing the common configurations in ",(0,i.kt)("inlineCode",{parentName:"p"},"base.k")," as much as possible to minimize duplicate code. We will cover how override works in ",(0,i.kt)("a",{parentName:"p",href:"base-override"},"Base and Override"),"."),(0,i.kt)("h2",{id:"appconfiguration-model"},"AppConfiguration Model"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," is the out-of-the-box model we build that describes an application. It serves as the declarative intent for a given application."),(0,i.kt)("p",null,"The schema for ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," is defined in the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"KusionStack/catalog")," repository. It is designed as a unified, application-centric model that encapsulates the comprehensive configuration details and in the meantime, hides the complexity of the infrastructure as much as possible."),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," consists of multiple sub-components that each represent either the application workload itself, its dependencies, relevant workflows or operational expectations. We will deep dive into the details on how to author each of these elements in this upcoming documentation series."),(0,i.kt)("p",null,"For more details on the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),", please refer to the ",(0,i.kt)("a",{parentName:"p",href:"../concepts/app-configuration"},"design documentation"),"."),(0,i.kt)("h2",{id:"authoring-configuration-files"},"Authoring Configuration Files"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/"},"KCL")," is the choice of configuration language consumed by Kusion. KCL is an open-source constraint-based record and functional language. KCL works well with a large number of complex configurations via modern programming language technology and practice, and is committed to provide better modularity, scalability, stability and extensibility."),(0,i.kt)("h3",{id:"identifying-kcl-file"},"Identifying KCL file"),(0,i.kt)("p",null,"KCL files are identified with ",(0,i.kt)("inlineCode",{parentName:"p"},".k")," suffix in the filename."),(0,i.kt)("h3",{id:"kcl-packages-and-import"},"KCL Packages and Import"),(0,i.kt)("p",null,"Similar to most modern General Programming Languages (GPLs), KCL packages are used to organize collections of related KCL source files into modular and re-usable units."),(0,i.kt)("p",null,"In the context of Kusion, we use KCL packages to define models that could best abstract the behavior of an application. Specifically, we provide an official out-of-the-box KCL package(will keep iterating) with the name ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"catalog"),". When authoring an application configuration file, you can simply import the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"catalog")," package in the source code and use all the schemas (including AppConfiguration) defined in the ",(0,i.kt)("inlineCode",{parentName:"p"},"catalog")," package."),(0,i.kt)("p",null,"Similarly, if the schemas in the ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"catalog")," package does not meet your needs, you can always fork it and make modifications, then import the modified package; or create a brand new package altogether and import it."),(0,i.kt)("p",null,"The Kusion ecosystem can be easily expanded in this manner."),(0,i.kt)("p",null,"An example of the import looks like the following:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"### import from the official catalog package\nimport catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\n\n### import my own modified package\nimport my_own_catalog.models.schema.v1 as moc\nimport my_other_package.schema.v1.redis as myredis\n")),(0,i.kt)("p",null,"Take ",(0,i.kt)("inlineCode",{parentName:"p"},"import catalog.models.schema.v1.workload as wl")," as an example, the ",(0,i.kt)("inlineCode",{parentName:"p"},".models.schema.v1.workload")," part after ",(0,i.kt)("inlineCode",{parentName:"p"},"import catalog")," represents the relative path of a specific schema to import. In this case, the ",(0,i.kt)("inlineCode",{parentName:"p"},"workload")," schemas is defined under ",(0,i.kt)("inlineCode",{parentName:"p"},"models/schema/v1/workload")," directory in the ",(0,i.kt)("inlineCode",{parentName:"p"},"catalog")," package."),(0,i.kt)("h3",{id:"understanding-kclmod"},"Understanding kcl.mod"),(0,i.kt)("p",null,"Much similar to the concept of ",(0,i.kt)("inlineCode",{parentName:"p"},"go.mod"),", Kusion uses ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod")," as the source of truth to manage metadata (such as package name, dependencies, etc.) for the current package. Kusion will also auto-generate a ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod.lock")," as the dependency lock file."),(0,i.kt)("p",null,"The most common usage for ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod")," is to manage the dependency of your application configurations. "),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"Please note this ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod")," will be automatically generated if you are using ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," to initialize a project with a template. You will only need to modify this file if you are modifying the project metadata outside the initialization process, such as upgrading the dependency version or adding a new dependency altogether, etc.")),(0,i.kt)("p",null,"There are 3 sections in a ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"package"),", representing the metadata for the current package."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"dependencies"),", describing the packages the current package depends on. Supports referencing either a git repository or an OCI artifact."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"profile"),", defining the behavior for Kusion. In the example below, it describes the list of files Kusion should look for when parsing the application configuration.")),(0,i.kt)("p",null,"An example of ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'[package]\nname = "multi-stack-project"\nedition = "0.5.0"\nversion = "0.1.0"\n\n[dependencies]\ncatalog = { git = "https://github.com/KusionStack/catalog.git", tag = "0.1.0" }\n# Uncomment the line below to use your own modified package\n# my-package = ghcr.io/kcl-lang/my-package\n\n[profile]\nentries = ["../base/base.k", "main.k"]\n')),(0,i.kt)("h3",{id:"building-blocks"},"Building Blocks"),(0,i.kt)("p",null,"Configuration files consist of building blocks that are made of instances of schemas. An ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance consists of several child schemas, most of which are optional. The only mandatory one is the ",(0,i.kt)("inlineCode",{parentName:"p"},"workload")," instance. We will take a closer look in the ",(0,i.kt)("a",{parentName:"p",href:"workload"},"workload walkthrough"),". The order of the building blocks does NOT matter."),(0,i.kt)("p",null,"The major building blocks as of version ",(0,i.kt)("inlineCode",{parentName:"p"},"0.9.0"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {}\n ...\n }\n ports: []\n secrets: {}\n }\n database: d.Database{}\n monitoring: m.Prometheus{}\n opsRule: t.OpsRule {}\n ...\n}\n')),(0,i.kt)("p",null,"We will deep dive into each one of the building blocks in this documentation series."),(0,i.kt)("h3",{id:"instantiating-an-application"},"Instantiating an application"),(0,i.kt)("p",null,"In Kusion's out-of-the-box experience, an application is identified with an instance of ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),". You may have more than one application in the same project or stack."),(0,i.kt)("p",null,"Here's an example of a configuration that can be consumed by Kusion (assuming it is placed inside the proper directory structure that includes project and stack configurations, with a ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod")," present):"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.network as n\nimport catalog.models.schema.v1.workload.container as c\n\ngocity: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "gocity": c.Container {\n image = "howieyuen/gocity:latest"\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n ports: [\n n.Port {\n port: 4000\n }\n ]\n }\n}\n')),(0,i.kt)("p",null,"Don't worry about what ",(0,i.kt)("inlineCode",{parentName:"p"},"workload")," or ",(0,i.kt)("inlineCode",{parentName:"p"},"ports")," stand for at the moment. We will deep dive into each one of them in this upcoming documentation series."),(0,i.kt)("h3",{id:"using-kusion-init"},"Using ",(0,i.kt)("inlineCode",{parentName:"h3"},"kusion init")),(0,i.kt)("p",null,"Kusion offers a ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," sub-command which initializes a new project using some pre-built templates, which saves you from the hassle of manually building the aforementioned directory structure that Kusion expects."),(0,i.kt)("p",null,"There is a built-in template ",(0,i.kt)("inlineCode",{parentName:"p"},"single-stack-sample")," in the Kusion binary that can be used offline. "),(0,i.kt)("p",null,"We also maintain a ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion-templates"},"kusion-templates repository")," that hosts a list of more comprehensive project scaffolds. You can access them via ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init --online")," command which requires connectivity to ",(0,i.kt)("inlineCode",{parentName:"p"},"github.com"),"."),(0,i.kt)("p",null,"The pre-built templates are meant to help you get off the ground quickly with some simple out-of-the-box examples. You can refer to the ",(0,i.kt)("a",{parentName:"p",href:"../getting-started/deliver-wordpress"},"QuickStart documentation")," for some step-by-step tutorials."),(0,i.kt)("h3",{id:"using-references"},"Using references"),(0,i.kt)("p",null,"The reference documentation for the ",(0,i.kt)("inlineCode",{parentName:"p"},"catalog")," package is located in ",(0,i.kt)("a",{parentName:"p",href:"../reference/modules/catalog-models/app-configuration"},"Reference"),"."),(0,i.kt)("p",null,"If you are using the ",(0,i.kt)("inlineCode",{parentName:"p"},"catalog")," package out of the box, the reference documentation provides a comprehensive view for each schema involved, including all the attribute names and description, their types, default value if any, and whether a particular attribute is required or not. There will also be an example attached to each schema reference."),(0,i.kt)("p",null,"We will also deep dive into some common examples in the upcoming sections."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/59edad29.7daf6025.js b/assets/js/59edad29.7daf6025.js new file mode 100644 index 00000000000..fea3a958baf --- /dev/null +++ b/assets/js/59edad29.7daf6025.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4699],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>h});var n=a(67294);function i(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function r(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function s(e){for(var t=1;t=0||(i[a]=e[a]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(i[a]=e[a])}return i}var c=n.createContext({}),l=function(e){var t=n.useContext(c),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},p=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,i=e.mdxType,r=e.originalType,c=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),d=l(a),h=i,m=d["".concat(c,".").concat(h)]||d[h]||u[h]||r;return a?n.createElement(m,s(s({ref:t},p),{},{components:a})):n.createElement(m,s({ref:t},p))}));function h(e,t){var a=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=a.length,s=new Array(r);s[0]=d;var o={};for(var c in t)hasOwnProperty.call(t,c)&&(o[c]=t[c]);o.originalType=e,o.mdxType="string"==typeof e?e:i,s[1]=o;for(var l=2;l{a.r(t),a.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>r,metadata:()=>o,toc:()=>l});var n=a(87462),i=(a(67294),a(3905));const r={},s="Deploy Application Securely and Efficiently via GitHub Actions",o={unversionedId:"user-guides/github-actions/deploy-application-via-github-actions",id:"version-v0.10/user-guides/github-actions/deploy-application-via-github-actions",title:"Deploy Application Securely and Efficiently via GitHub Actions",description:"This document provides the instruction to deploy your application securely and efficiently via GitHub Actions.",source:"@site/docs_versioned_docs/version-v0.10/5-user-guides/4-github-actions/1-deploy-application-via-github-actions.md",sourceDirName:"5-user-guides/4-github-actions",slug:"/user-guides/github-actions/deploy-application-via-github-actions",permalink:"/docs/v0.10/user-guides/github-actions/deploy-application-via-github-actions",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/5-user-guides/4-github-actions/1-deploy-application-via-github-actions.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{},sidebar:"kusion",previous:{title:"Configure Monitoring Behavior With Prometheus",permalink:"/docs/v0.10/user-guides/observability/prometheus"},next:{title:"Using Cloud Secrets Manager",permalink:"/docs/v0.10/user-guides/secrets-management/using-cloud-secrets"}},c={},l=[{value:"GitHub Actions Workflow",id:"github-actions-workflow",level:2},{value:"Get Changed Project and Stack",id:"get-changed-project-and-stack",level:2},{value:"Check Project and Stack Structure",id:"check-project-and-stack-structure",level:2},{value:"Test Code Correctness",id:"test-code-correctness",level:2},{value:"Preview Changed Stack",id:"preview-changed-stack",level:2},{value:"Apply Changed Stack",id:"apply-changed-stack",level:2},{value:"Summary",id:"summary",level:2}],p={toc:l};function u(e){let{components:t,...r}=e;return(0,i.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"deploy-application-securely-and-efficiently-via-github-actions"},"Deploy Application Securely and Efficiently via GitHub Actions"),(0,i.kt)("p",null,"This document provides the instruction to deploy your application securely and efficiently via GitHub Actions."),(0,i.kt)("p",null,"Using git repository is a very reliable and common way to manage code, and the same goes for Kusion-managed configuration code. ",(0,i.kt)("a",{parentName:"p",href:"https://docs.github.com/en/actions"},"GitHub Actions")," is a CI/CD platform. By customizing ",(0,i.kt)("a",{parentName:"p",href:"https://docs.github.com/en/actions/using-workflows/about-workflows"},"GitHub Actions workflow"),", the pipeline such as building, testing, and deploying will be executed automatically."),(0,i.kt)("p",null,"Kusion has a commendable integration with GitHub Actions. You can use GitHub Actions to test configuration correctness, preview change, and deploy application. This tutorial demonstrates how to deploy and operate an application through GitHub Actions."),(0,i.kt)("h2",{id:"github-actions-workflow"},"GitHub Actions Workflow"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig"},"KusionStack/konfig")," is the official example repository, and provides the GitHub Actions workflow ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/blob/main/.github/workflows/deploy/deploy.yml"},(0,i.kt)("em",{parentName:"a"},"deploy")),". The workflow is triggered by a push on the main branch, and includes multiple jobs, which ensures the reliability of configuration code, and deploys the changed application."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"workflow",src:a(74559).Z,width:"2594",height:"1364"})),(0,i.kt)("p",null,"The workflow to deploy an application is shown above, which includes the following jobs:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Get changed project and stack"),(0,i.kt)("li",{parentName:"ul"},"Check project and stack structure"),(0,i.kt)("li",{parentName:"ul"},"Test code correctness"),(0,i.kt)("li",{parentName:"ul"},"Preview changed stack"),(0,i.kt)("li",{parentName:"ul"},"Apply changed stack")),(0,i.kt)("p",null,"These jobs ensure the security and efficiency of the application deployment. Next, this tutorial will introduce the usage and function of these jobs. To show how they work more visually, updating port configuration in file ",(0,i.kt)("inlineCode",{parentName:"p"},"example/service-multi-stack/base/base.k")," of ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/tree/main/example/service-multi-stack"},(0,i.kt)("em",{parentName:"a"},"service-multi-stack")),' (referred to "the example" in the below) is given as an example.'),(0,i.kt)("h2",{id:"get-changed-project-and-stack"},"Get Changed Project and Stack"),(0,i.kt)("p",null,"As Kusion organizes code by project and stack, to deploy the affected applications, analyze the changed project and stack is the first step."),(0,i.kt)("p",null,"The job, ",(0,i.kt)("strong",{parentName:"p"},"get-changed-project-stack")," perfectly accomplish the analysis. The main steps are as follows:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Obtain the list of changed files through ",(0,i.kt)("inlineCode",{parentName:"li"},"git diff"),";"),(0,i.kt)("li",{parentName:"ul"},"Based on the changed file list, obtain the changed projects and stacks which are indicated by ",(0,i.kt)("inlineCode",{parentName:"li"},"project.yaml")," and ",(0,i.kt)("inlineCode",{parentName:"li"},"stack.yaml")," respectively.")),(0,i.kt)("p",null,"The example changes the file ",(0,i.kt)("inlineCode",{parentName:"p"},"example/service-multi-stack/base/base.k"),", where the affected project is ",(0,i.kt)("inlineCode",{parentName:"p"},"example/service-multi-stack"),", and the stack is ",(0,i.kt)("inlineCode",{parentName:"p"},"example/service-multi-stack/dev")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"example/service-multi-stack/prod"),". Delightfully, the result, which is shown below, meets our expectation."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"changed-project-stack",src:a(15203).Z,width:"2248",height:"1104"})),(0,i.kt)("h2",{id:"check-project-and-stack-structure"},"Check Project and Stack Structure"),(0,i.kt)("p",null,"The job ",(0,i.kt)("strong",{parentName:"p"},"check-structure")," guarantees the structure legality of the changed project and stack, so that Kusion CLI tools can be used correctly. The check items are as follows:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"The field ",(0,i.kt)("inlineCode",{parentName:"li"},"name")," is required in project.yaml;"),(0,i.kt)("li",{parentName:"ul"},"The field ",(0,i.kt)("inlineCode",{parentName:"li"},"name")," is required in stack.yaml.")),(0,i.kt)("p",null,"The success of structure-check means the correctness of structure. A ",(0,i.kt)("a",{parentName:"p",href:"https://docs.pytest.org/en/7.3.x/"},"pytest")," report ",(0,i.kt)("inlineCode",{parentName:"p"},"check-structure-report")," is also generated, and you can get it from ",(0,i.kt)("a",{parentName:"p",href:"https://docs.github.com/en/actions/managing-workflow-runs/downloading-workflow-artifacts"},"GithHub Actions Artifacts")," ."),(0,i.kt)("p",null,"The example passes the directory structure verification. It is clear from the report that the changed project and stack have get checked, and the result is passed."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-xml"},'\n \n \n \n \n \n\n')),(0,i.kt)("h2",{id:"test-code-correctness"},"Test Code Correctness"),(0,i.kt)("p",null,"Besides a rightful structure, the code must have correct syntax and semantics, and the job ",(0,i.kt)("strong",{parentName:"p"},"test-correctness")," ensures the correctness. ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion build")," get executed on the changed stacks. If succeeded, there are no syntax errors; or the configuration code is illegal, and the following application deployment will fail."),(0,i.kt)("p",null,"In this job, not only the correctness of AppConfiguration is checked, but also the workspace configuration. Hence, you should prepare workspace configuration in advance. Now, the job ",(0,i.kt)("strong",{parentName:"p"},"test-correctness")," supports you put workspace configuration files under directory ",(0,i.kt)("inlineCode",{parentName:"p"},"workspaces")," with file name's prefix the same as the workspace name and suffix ",(0,i.kt)("inlineCode",{parentName:"p"},".yaml"),". For example, if you have two workspaces named ",(0,i.kt)("inlineCode",{parentName:"p"},"dev")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"prod"),", you should provide files ",(0,i.kt)("inlineCode",{parentName:"p"},"workspaces/dev.yaml")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"workspaces/prod.yaml")," with corresponding workspace configuration."),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"The jobs preview and apply also ask for the workspace configuration files."),(0,i.kt)("p",{parentName:"admonition"},"Putting AppConfiguration and workspace configuration in one repository seems not a good idea. Doing this is to give a simple illustration. You can change it in your real production practice, and you can get more information of ",(0,i.kt)("a",{parentName:"p",href:"../../concepts/app-configuration"},"AppConfiguration")," and ",(0,i.kt)("a",{parentName:"p",href:"../../concepts/workspace"},"workspace")," here.")),(0,i.kt)("p",null,"The report whose name is ",(0,i.kt)("inlineCode",{parentName:"p"},"test-correctness-report")," get generated."),(0,i.kt)("p",null,"The example passes the code correctness test. The report shows that the tested stack is ",(0,i.kt)("inlineCode",{parentName:"p"},"example/service-multi-stack/dev")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"example/service-multi-stack/prod"),", and the result is passed."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-xml"},'\n \n \n \n \n\n')),(0,i.kt)("h2",{id:"preview-changed-stack"},"Preview Changed Stack"),(0,i.kt)("p",null,"After passing the above jobs, security of the configuration change is guaranteed, and it's time to deploy your application. Before applying the change to the real infrastructure, it's necessary to get the expected result of the application deployment. The job ",(0,i.kt)("strong",{parentName:"p"},"preview")," calls ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion preview")," to get the expected change result, the result is uploaded to the artifact ",(0,i.kt)("inlineCode",{parentName:"p"},"preview-report"),". If the result meets your requirement, you can go to the next job and deploy the application."),(0,i.kt)("p",null,"The example changes stack ",(0,i.kt)("inlineCode",{parentName:"p"},"example/service-multi-stack/dev")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"example/service-multi-stack/prod"),". The following picture shows the preview result of ",(0,i.kt)("inlineCode",{parentName:"p"},"example/service-multi-stack/prod"),", where the result is to create a Kubernetes Namespace, Service and Deployment if call ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion apply"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"Generating Intent in the Stack prod...\ncloning 'https://github.com/KusionStack/catalog.git' with tag '0.1.2'\n\nStack: prod ID Action\n* \u251c\u2500 v1:Namespace:service-multi-stack Create\n* \u251c\u2500 v1:Service:service-multi-stack:service-multi-stack-prod-echoserver-public Create\n* \u2514\u2500 apps/v1:Deployment:service-multi-stack:service-multi-stack-prod-echoserver Create\n")),(0,i.kt)("h2",{id:"apply-changed-stack"},"Apply Changed Stack"),(0,i.kt)("p",null,"Finally, the last step is arrived, i.e. deploy application. The job ",(0,i.kt)("strong",{parentName:"p"},"apply")," calls ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion apply")," to apply the configuration change to the real infrastructure. If the job succeeded, the result will be uploaded to the artifact ",(0,i.kt)("inlineCode",{parentName:"p"},"apply-report"),"."),(0,i.kt)("p",null,"For the stack ",(0,i.kt)("inlineCode",{parentName:"p"},"example/service-multi-stack/prod")," in the example, a Kubernetes Namespace, Service and Deployment get created, which is consistent with the preview result."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"Generating Intent in the Stack prod...\ncloning 'https://github.com/KusionStack/catalog.git' with tag '0.1.2'\n\nStack: prod ID Action\n* \u251c\u2500 v1:Namespace:service-multi-stack UnChanged\n* \u251c\u2500 v1:Service:service-multi-stack:service-multi-stack-prod-echoserver-public Create\n* \u2514\u2500 apps/v1:Deployment:service-multi-stack:service-multi-stack-prod-echoserver Create\n\nStart applying diffs ...\n \nSUCCESS: UnChanged v1:Namespace:service-multi-stack, skip \nSUCCESS: Create v1:Service:service-multi-stack:service-multi-stack-prod-echoserver-public success \nSUCCESS: Create apps/v1:Deployment:service-multi-stack:service-multi-stack-prod-echoserver success\n\nApply complete! Resources: 2 created, 0 updated, 0 deleted.\n")),(0,i.kt)("h2",{id:"summary"},"Summary"),(0,i.kt)("p",null,"This tutorial demonstrates how Kusion integrates with GitHub Actions to deploy an application. By structure check, correctness test, preview and apply, Kusion with GitHub Actions enables you deploy application efficiently and securely."))}u.isMDXComponent=!0},15203:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/kusion-changed-project-stack-de4c7df77236ad9eeb758f1f9e2af703.png"},74559:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/workflow-052aa326816199187357363891109493.png"}}]); \ No newline at end of file diff --git a/assets/js/59edad29.b738aae0.js b/assets/js/59edad29.b738aae0.js deleted file mode 100644 index 843f1f39906..00000000000 --- a/assets/js/59edad29.b738aae0.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4699],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>h});var n=a(67294);function i(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function r(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function s(e){for(var t=1;t=0||(i[a]=e[a]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(i[a]=e[a])}return i}var c=n.createContext({}),l=function(e){var t=n.useContext(c),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},p=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,i=e.mdxType,r=e.originalType,c=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),d=l(a),h=i,m=d["".concat(c,".").concat(h)]||d[h]||u[h]||r;return a?n.createElement(m,s(s({ref:t},p),{},{components:a})):n.createElement(m,s({ref:t},p))}));function h(e,t){var a=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=a.length,s=new Array(r);s[0]=d;var o={};for(var c in t)hasOwnProperty.call(t,c)&&(o[c]=t[c]);o.originalType=e,o.mdxType="string"==typeof e?e:i,s[1]=o;for(var l=2;l{a.r(t),a.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>r,metadata:()=>o,toc:()=>l});var n=a(87462),i=(a(67294),a(3905));const r={},s="Deploy Application Securely and Efficiently via GitHub Actions",o={unversionedId:"user-guides/github-actions/deploy-application-via-github-actions",id:"version-v0.10/user-guides/github-actions/deploy-application-via-github-actions",title:"Deploy Application Securely and Efficiently via GitHub Actions",description:"This document provides the instruction to deploy your application securely and efficiently via GitHub Actions.",source:"@site/docs_versioned_docs/version-v0.10/5-user-guides/4-github-actions/1-deploy-application-via-github-actions.md",sourceDirName:"5-user-guides/4-github-actions",slug:"/user-guides/github-actions/deploy-application-via-github-actions",permalink:"/docs/v0.10/user-guides/github-actions/deploy-application-via-github-actions",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/5-user-guides/4-github-actions/1-deploy-application-via-github-actions.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{},sidebar:"kusion",previous:{title:"Configure Monitoring Behavior With Prometheus",permalink:"/docs/v0.10/user-guides/observability/prometheus"},next:{title:"Using Cloud Secrets Manager",permalink:"/docs/v0.10/user-guides/secrets-management/using-cloud-secrets"}},c={},l=[{value:"GitHub Actions Workflow",id:"github-actions-workflow",level:2},{value:"Get Changed Project and Stack",id:"get-changed-project-and-stack",level:2},{value:"Check Project and Stack Structure",id:"check-project-and-stack-structure",level:2},{value:"Test Code Correctness",id:"test-code-correctness",level:2},{value:"Preview Changed Stack",id:"preview-changed-stack",level:2},{value:"Apply Changed Stack",id:"apply-changed-stack",level:2},{value:"Summary",id:"summary",level:2}],p={toc:l};function u(e){let{components:t,...r}=e;return(0,i.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"deploy-application-securely-and-efficiently-via-github-actions"},"Deploy Application Securely and Efficiently via GitHub Actions"),(0,i.kt)("p",null,"This document provides the instruction to deploy your application securely and efficiently via GitHub Actions."),(0,i.kt)("p",null,"Using git repository is a very reliable and common way to manage code, and the same goes for Kusion-managed configuration code. ",(0,i.kt)("a",{parentName:"p",href:"https://docs.github.com/en/actions"},"GitHub Actions")," is a CI/CD platform. By customizing ",(0,i.kt)("a",{parentName:"p",href:"https://docs.github.com/en/actions/using-workflows/about-workflows"},"GitHub Actions workflow"),", the pipeline such as building, testing, and deploying will be executed automatically."),(0,i.kt)("p",null,"Kusion has a commendable integration with GitHub Actions. You can use GitHub Actions to test configuration correctness, preview change, and deploy application. This tutorial demonstrates how to deploy and operate an application through GitHub Actions."),(0,i.kt)("h2",{id:"github-actions-workflow"},"GitHub Actions Workflow"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig"},"KusionStack/konfig")," is the official example repository, and provides the GitHub Actions workflow ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/blob/main/.github/workflows/deploy/deploy.yml"},(0,i.kt)("em",{parentName:"a"},"deploy")),". The workflow is triggered by a push on the main branch, and includes multiple jobs, which ensures the reliability of configuration code, and deploys the changed application."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"workflow",src:a(74559).Z,width:"2594",height:"1364"})),(0,i.kt)("p",null,"The workflow to deploy an application is shown above, which includes the following jobs:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Get changed project and stack"),(0,i.kt)("li",{parentName:"ul"},"Check project and stack structure"),(0,i.kt)("li",{parentName:"ul"},"Test code correctness"),(0,i.kt)("li",{parentName:"ul"},"Preview changed stack"),(0,i.kt)("li",{parentName:"ul"},"Apply changed stack")),(0,i.kt)("p",null,"These jobs ensure the security and efficiency of the application deployment. Next, this tutorial will introduce the usage and function of these jobs. To show how they work more visually, updating port configuration in file ",(0,i.kt)("inlineCode",{parentName:"p"},"example/service-multi-stack/base/base.k")," of ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/tree/main/example/service-multi-stack"},(0,i.kt)("em",{parentName:"a"},"service-multi-stack")),' (referred to "the example" in the below) is given as an example.'),(0,i.kt)("h2",{id:"get-changed-project-and-stack"},"Get Changed Project and Stack"),(0,i.kt)("p",null,"As Kusion organizes code by project and stack, to deploy the affected applications, analyze the changed project and stack is the first step."),(0,i.kt)("p",null,"The job, ",(0,i.kt)("strong",{parentName:"p"},"get-changed-project-stack")," perfectly accomplish the analysis. The main steps are as follows:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Obtain the list of changed files through ",(0,i.kt)("inlineCode",{parentName:"li"},"git diff"),";"),(0,i.kt)("li",{parentName:"ul"},"Based on the changed file list, obtain the changed projects and stacks which are indicated by ",(0,i.kt)("inlineCode",{parentName:"li"},"project.yaml")," and ",(0,i.kt)("inlineCode",{parentName:"li"},"stack.yaml")," respectively.")),(0,i.kt)("p",null,"The example changes the file ",(0,i.kt)("inlineCode",{parentName:"p"},"example/service-multi-stack/base/base.k"),", where the affected project is ",(0,i.kt)("inlineCode",{parentName:"p"},"example/service-multi-stack"),", and the stack is ",(0,i.kt)("inlineCode",{parentName:"p"},"example/service-multi-stack/dev")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"example/service-multi-stack/prod"),". Delightfully, the result, which is shown below, meets our expectation."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"changed-project-stack",src:a(15203).Z,width:"2248",height:"1104"})),(0,i.kt)("h2",{id:"check-project-and-stack-structure"},"Check Project and Stack Structure"),(0,i.kt)("p",null,"The job ",(0,i.kt)("strong",{parentName:"p"},"check-structure")," guarantees the structure legality of the changed project and stack, so that Kusion CLI tools can be used correctly. The check items are as follows:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"The field ",(0,i.kt)("inlineCode",{parentName:"li"},"name")," is required in project.yaml;"),(0,i.kt)("li",{parentName:"ul"},"The field ",(0,i.kt)("inlineCode",{parentName:"li"},"name")," is required in stack.yaml.")),(0,i.kt)("p",null,"The success of structure-check means the correctness of structure. A ",(0,i.kt)("a",{parentName:"p",href:"https://docs.pytest.org/en/7.3.x/"},"pytest")," report ",(0,i.kt)("inlineCode",{parentName:"p"},"check-structure-report")," is also generated, and you can get it from ",(0,i.kt)("a",{parentName:"p",href:"https://docs.github.com/en/actions/managing-workflow-runs/downloading-workflow-artifacts"},"GithHub Actions Artifacts")," ."),(0,i.kt)("p",null,"The example passes the directory structure verification. It is clear from the report that the changed project and stack have get checked, and the result is passed."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-xml"},'\n \n \n \n \n \n\n')),(0,i.kt)("h2",{id:"test-code-correctness"},"Test Code Correctness"),(0,i.kt)("p",null,"Besides a rightful structure, the code must have correct syntax and semantics, and the job ",(0,i.kt)("strong",{parentName:"p"},"test-correctness")," ensures the correctness. ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion build")," get executed on the changed stacks. If succeeded, there are no syntax errors; or the configuration code is illegal, and the following application deployment will fail."),(0,i.kt)("p",null,"In this job, not only the correctness of AppConfiguration is checked, but also the workspace configuration. Hence, you should prepare workspace configuration in advance. Now, the job ",(0,i.kt)("strong",{parentName:"p"},"test-correctness")," supports you put workspace configuration files under directory ",(0,i.kt)("inlineCode",{parentName:"p"},"workspaces")," with file name's prefix the same as the workspace name and suffix ",(0,i.kt)("inlineCode",{parentName:"p"},".yaml"),". For example, if you have two workspaces named ",(0,i.kt)("inlineCode",{parentName:"p"},"dev")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"prod"),", you should provide files ",(0,i.kt)("inlineCode",{parentName:"p"},"workspaces/dev.yaml")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"workspaces/prod.yaml")," with corresponding workspace configuration."),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"The jobs preview and apply also ask for the workspace configuration files."),(0,i.kt)("p",{parentName:"admonition"},"Putting AppConfiguration and workspace configuration in one repository seems not a good idea. Doing this is to give a simple illustration. You can change it in your real production practice, and you can get more information of ",(0,i.kt)("a",{parentName:"p",href:"../../concepts/app-configuration"},"AppConfiguration")," and ",(0,i.kt)("a",{parentName:"p",href:"../../concepts/workspace"},"workspace")," here.")),(0,i.kt)("p",null,"The report whose name is ",(0,i.kt)("inlineCode",{parentName:"p"},"test-correctness-report")," get generated."),(0,i.kt)("p",null,"The example passes the code correctness test. The report shows that the tested stack is ",(0,i.kt)("inlineCode",{parentName:"p"},"example/service-multi-stack/dev")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"example/service-multi-stack/prod"),", and the result is passed."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-xml"},'\n \n \n \n \n\n')),(0,i.kt)("h2",{id:"preview-changed-stack"},"Preview Changed Stack"),(0,i.kt)("p",null,"After passing the above jobs, security of the configuration change is guaranteed, and it's time to deploy your application. Before applying the change to the real infrastructure, it's necessary to get the expected result of the application deployment. The job ",(0,i.kt)("strong",{parentName:"p"},"preview")," calls ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion preview")," to get the expected change result, the result is uploaded to the artifact ",(0,i.kt)("inlineCode",{parentName:"p"},"preview-report"),". If the result meets your requirement, you can go to the next job and deploy the application."),(0,i.kt)("p",null,"The example changes stack ",(0,i.kt)("inlineCode",{parentName:"p"},"example/service-multi-stack/dev")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"example/service-multi-stack/prod"),". The following picture shows the preview result of ",(0,i.kt)("inlineCode",{parentName:"p"},"example/service-multi-stack/prod"),", where the result is to create a Kubernetes Namespace, Service and Deployment if call ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion apply"),"."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"Generating Intent in the Stack prod...\ncloning 'https://github.com/KusionStack/catalog.git' with tag '0.1.2'\n\nStack: prod ID Action\n* \u251c\u2500 v1:Namespace:service-multi-stack Create\n* \u251c\u2500 v1:Service:service-multi-stack:service-multi-stack-prod-echoserver-public Create\n* \u2514\u2500 apps/v1:Deployment:service-multi-stack:service-multi-stack-prod-echoserver Create\n")),(0,i.kt)("h2",{id:"apply-changed-stack"},"Apply Changed Stack"),(0,i.kt)("p",null,"Finally, the last step is arrived, i.e. deploy application. The job ",(0,i.kt)("strong",{parentName:"p"},"apply")," calls ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion apply")," to apply the configuration change to the real infrastructure. If the job succeeded, the result will be uploaded to the artifact ",(0,i.kt)("inlineCode",{parentName:"p"},"apply-report"),"."),(0,i.kt)("p",null,"For the stack ",(0,i.kt)("inlineCode",{parentName:"p"},"example/service-multi-stack/prod")," in the example, a Kubernetes Namespace, Service and Deployment get created, which is consistent with the preview result."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"Generating Intent in the Stack prod...\ncloning 'https://github.com/KusionStack/catalog.git' with tag '0.1.2'\n\nStack: prod ID Action\n* \u251c\u2500 v1:Namespace:service-multi-stack UnChanged\n* \u251c\u2500 v1:Service:service-multi-stack:service-multi-stack-prod-echoserver-public Create\n* \u2514\u2500 apps/v1:Deployment:service-multi-stack:service-multi-stack-prod-echoserver Create\n\nStart applying diffs ...\n \nSUCCESS: UnChanged v1:Namespace:service-multi-stack, skip \nSUCCESS: Create v1:Service:service-multi-stack:service-multi-stack-prod-echoserver-public success \nSUCCESS: Create apps/v1:Deployment:service-multi-stack:service-multi-stack-prod-echoserver success\n\nApply complete! Resources: 2 created, 0 updated, 0 deleted.\n")),(0,i.kt)("h2",{id:"summary"},"Summary"),(0,i.kt)("p",null,"This tutorial demonstrates how Kusion integrates with GitHub Actions to deploy an application. By structure check, correctness test, preview and apply, Kusion with GitHub Actions enables you deploy application efficiently and securely."))}u.isMDXComponent=!0},15203:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/kusion-changed-project-stack-de4c7df77236ad9eeb758f1f9e2af703.png"},74559:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/workflow-052aa326816199187357363891109493.png"}}]); \ No newline at end of file diff --git a/assets/js/5a0745f3.8b86feb2.js b/assets/js/5a0745f3.8b86feb2.js deleted file mode 100644 index af172f4c542..00000000000 --- a/assets/js/5a0745f3.8b86feb2.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3486],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>u});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),d=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=d(e.components);return a.createElement(p.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),m=d(n),u=r,k=m["".concat(p,".").concat(u)]||m[u]||s[u]||l;return n?a.createElement(k,o(o({ref:t},c),{},{components:n})):a.createElement(k,o({ref:t},c))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,o=new Array(l);o[0]=m;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:r,o[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>s,frontMatter:()=>l,metadata:()=>i,toc:()=>d});var a=n(87462),r=(n(67294),n(3905));const l={},o="probe",i={unversionedId:"reference/model/catalog_models/internal/container/probe/doc_probe",id:"version-v0.9/reference/model/catalog_models/internal/container/probe/doc_probe",title:"probe",description:"Schema Probe",source:"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/container/probe/doc_probe.md",sourceDirName:"reference/model/catalog_models/internal/container/probe",slug:"/reference/model/catalog_models/internal/container/probe/doc_probe",permalink:"/docs/v0.9/reference/model/catalog_models/internal/container/probe/doc_probe",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/container/probe/doc_probe.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"lifecycle",permalink:"/docs/v0.9/reference/model/catalog_models/internal/container/lifecycle/doc_lifecycle"},next:{title:"common",permalink:"/docs/v0.9/reference/model/catalog_models/internal/doc_common"}},p={},d=[{value:"Schema Probe",id:"schema-probe",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Schema Exec",id:"schema-exec",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3},{value:"Schema Http",id:"schema-http",level:2},{value:"Attributes",id:"attributes-2",level:3},{value:"Examples",id:"examples-2",level:3},{value:"Schema Tcp",id:"schema-tcp",level:2},{value:"Attributes",id:"attributes-3",level:3},{value:"Examples",id:"examples-3",level:3}],c={toc:d};function s(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"probe"},"probe"),(0,r.kt)("h2",{id:"schema-probe"},"Schema Probe"),(0,r.kt)("p",null,"Probe describes a health check to be performed against a container to determine whether it is",(0,r.kt)("br",null),"alive or ready to receive traffic. There are three probe types: readiness, liveness, and startup."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"probeHandler"),(0,r.kt)("br",null),"The action taken to determine the alive or health of a container"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-tcp"},"probe.Tcp")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"initialDelaySeconds"),(0,r.kt)("br",null),"The number of seconds before health checking is activated.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle%5C#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle\\#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"timeoutSeconds"),(0,r.kt)("br",null),"The number of seconds after which the probe times out.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle%5C#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle\\#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"periodSeconds"),(0,r.kt)("br",null),"How often (in seconds) to perform the probe."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"successThreshold"),(0,r.kt)("br",null),"Minimum consecutive successes for the probe to be considered successful after having failed."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"failureThreshold"),(0,r.kt)("br",null),"Minimum consecutive failures for the probe to be considered failed after having succeeded."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"terminationGracePeriod")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nprobe = p.Probe {\n probeHandler: p.Http {\n path: "/healthz"\n }\n initialDelaySeconds: 10\n}\n')),(0,r.kt)("h2",{id:"schema-exec"},"Schema Exec"),(0,r.kt)("p",null,'Exec describes a "run in container" action.'),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command"),(0,r.kt)("br",null),"The command line to execute inside the container."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nexecProbe = p.Exec {\n command: ["probe.sh"]\n}\n')),(0,r.kt)("h2",{id:"schema-http"},"Schema Http"),(0,r.kt)("p",null,"Http describes an action based on HTTP Get requests."),(0,r.kt)("h3",{id:"attributes-2"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url"),(0,r.kt)("br",null),"The full qualified url to send HTTP requests."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"headers"),(0,r.kt)("br",null),"Collection of custom headers to set in the request"),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-2"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nhttpProbe = p.Http {\n url: "http://localhost:80"\n headers: {\n "X-HEADER": "VALUE"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-tcp"},"Schema Tcp"),(0,r.kt)("p",null,"Tcp describes an action based on opening a socket."),(0,r.kt)("h3",{id:"attributes-3"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url"),(0,r.kt)("br",null),"The full qualified url to open a socket."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-3"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\ntcpProbe = p.Tcp {\n url: "tcp://localhost:1234"\n}\n')))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5a0745f3.bb5a50b1.js b/assets/js/5a0745f3.bb5a50b1.js new file mode 100644 index 00000000000..1463378b763 --- /dev/null +++ b/assets/js/5a0745f3.bb5a50b1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3486],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>u});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),d=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=d(e.components);return a.createElement(p.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),m=d(n),u=r,k=m["".concat(p,".").concat(u)]||m[u]||s[u]||l;return n?a.createElement(k,o(o({ref:t},c),{},{components:n})):a.createElement(k,o({ref:t},c))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,o=new Array(l);o[0]=m;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:r,o[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>s,frontMatter:()=>l,metadata:()=>i,toc:()=>d});var a=n(87462),r=(n(67294),n(3905));const l={},o="probe",i={unversionedId:"reference/model/catalog_models/internal/container/probe/doc_probe",id:"version-v0.9/reference/model/catalog_models/internal/container/probe/doc_probe",title:"probe",description:"Schema Probe",source:"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/container/probe/doc_probe.md",sourceDirName:"reference/model/catalog_models/internal/container/probe",slug:"/reference/model/catalog_models/internal/container/probe/doc_probe",permalink:"/docs/v0.9/reference/model/catalog_models/internal/container/probe/doc_probe",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/container/probe/doc_probe.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"lifecycle",permalink:"/docs/v0.9/reference/model/catalog_models/internal/container/lifecycle/doc_lifecycle"},next:{title:"common",permalink:"/docs/v0.9/reference/model/catalog_models/internal/doc_common"}},p={},d=[{value:"Schema Probe",id:"schema-probe",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Schema Exec",id:"schema-exec",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3},{value:"Schema Http",id:"schema-http",level:2},{value:"Attributes",id:"attributes-2",level:3},{value:"Examples",id:"examples-2",level:3},{value:"Schema Tcp",id:"schema-tcp",level:2},{value:"Attributes",id:"attributes-3",level:3},{value:"Examples",id:"examples-3",level:3}],c={toc:d};function s(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"probe"},"probe"),(0,r.kt)("h2",{id:"schema-probe"},"Schema Probe"),(0,r.kt)("p",null,"Probe describes a health check to be performed against a container to determine whether it is",(0,r.kt)("br",null),"alive or ready to receive traffic. There are three probe types: readiness, liveness, and startup."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"probeHandler"),(0,r.kt)("br",null),"The action taken to determine the alive or health of a container"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-tcp"},"probe.Tcp")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"initialDelaySeconds"),(0,r.kt)("br",null),"The number of seconds before health checking is activated.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle%5C#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle\\#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"timeoutSeconds"),(0,r.kt)("br",null),"The number of seconds after which the probe times out.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle%5C#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle\\#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"periodSeconds"),(0,r.kt)("br",null),"How often (in seconds) to perform the probe."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"successThreshold"),(0,r.kt)("br",null),"Minimum consecutive successes for the probe to be considered successful after having failed."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"failureThreshold"),(0,r.kt)("br",null),"Minimum consecutive failures for the probe to be considered failed after having succeeded."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"terminationGracePeriod")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nprobe = p.Probe {\n probeHandler: p.Http {\n path: "/healthz"\n }\n initialDelaySeconds: 10\n}\n')),(0,r.kt)("h2",{id:"schema-exec"},"Schema Exec"),(0,r.kt)("p",null,'Exec describes a "run in container" action.'),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command"),(0,r.kt)("br",null),"The command line to execute inside the container."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nexecProbe = p.Exec {\n command: ["probe.sh"]\n}\n')),(0,r.kt)("h2",{id:"schema-http"},"Schema Http"),(0,r.kt)("p",null,"Http describes an action based on HTTP Get requests."),(0,r.kt)("h3",{id:"attributes-2"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url"),(0,r.kt)("br",null),"The full qualified url to send HTTP requests."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"headers"),(0,r.kt)("br",null),"Collection of custom headers to set in the request"),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-2"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nhttpProbe = p.Http {\n url: "http://localhost:80"\n headers: {\n "X-HEADER": "VALUE"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-tcp"},"Schema Tcp"),(0,r.kt)("p",null,"Tcp describes an action based on opening a socket."),(0,r.kt)("h3",{id:"attributes-3"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url"),(0,r.kt)("br",null),"The full qualified url to open a socket."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-3"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\ntcpProbe = p.Tcp {\n url: "tcp://localhost:1234"\n}\n')))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5a9b41ac.fa2f5aa4.js b/assets/js/5a9b41ac.09bbdc9a.js similarity index 50% rename from assets/js/5a9b41ac.fa2f5aa4.js rename to assets/js/5a9b41ac.09bbdc9a.js index 14066001fbb..e3f0481d8ee 100644 --- a/assets/js/5a9b41ac.fa2f5aa4.js +++ b/assets/js/5a9b41ac.09bbdc9a.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7037],{3905:(e,r,t)=>{t.d(r,{Zo:()=>l,kt:()=>m});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function s(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=n.createContext({}),p=function(e){var r=n.useContext(c),t=r;return e&&(t="function"==typeof e?e(r):s(s({},r),e)),t},l=function(e){var r=p(e.components);return n.createElement(c.Provider,{value:r},e.children)},u={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},d=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=p(t),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||a;return t?n.createElement(f,s(s({ref:r},l),{},{components:t})):n.createElement(f,s({ref:r},l))}));function m(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=t.length,s=new Array(a);s[0]=d;var i={};for(var c in r)hasOwnProperty.call(r,c)&&(i[c]=r[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var p=2;p{t.r(r),t.d(r,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=t(87462),o=(t(67294),t(3905));const a={},s="kusion workspace create",i={unversionedId:"reference/commands/kusion-workspace-create",id:"version-v0.10/reference/commands/kusion-workspace-create",title:"kusion workspace create",description:"Create a new workspace",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace-create.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-create",permalink:"/docs/v0.10/reference/commands/kusion-workspace-create",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace-create.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion version",permalink:"/docs/v0.10/reference/commands/kusion-version"},next:{title:"kusion workspace delete",permalink:"/docs/v0.10/reference/commands/kusion-workspace-delete"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],l={toc:p};function u(e){let{components:r,...t}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-create"},"kusion workspace create"),(0,o.kt)("p",null,"Create a new workspace"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command creates a workspace with specified name and configuration file, where the file must be in the YAML format."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace create\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Create a new workspace\n kusion workspace create dev -f dev.yaml\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -f, --file string the path of workspace configuration file\n -h, --help help for create\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7037],{3905:(e,r,t)=>{t.d(r,{Zo:()=>l,kt:()=>f});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function s(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=n.createContext({}),p=function(e){var r=n.useContext(c),t=r;return e&&(t="function"==typeof e?e(r):s(s({},r),e)),t},l=function(e){var r=p(e.components);return n.createElement(c.Provider,{value:r},e.children)},u={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},d=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=p(t),f=o,m=d["".concat(c,".").concat(f)]||d[f]||u[f]||a;return t?n.createElement(m,s(s({ref:r},l),{},{components:t})):n.createElement(m,s({ref:r},l))}));function f(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=t.length,s=new Array(a);s[0]=d;var i={};for(var c in r)hasOwnProperty.call(r,c)&&(i[c]=r[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var p=2;p{t.r(r),t.d(r,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=t(87462),o=(t(67294),t(3905));const a={},s="kusion workspace create",i={unversionedId:"reference/commands/kusion-workspace-create",id:"version-v0.10/reference/commands/kusion-workspace-create",title:"kusion workspace create",description:"Create a new workspace",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace-create.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-create",permalink:"/docs/v0.10/reference/commands/kusion-workspace-create",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace-create.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion version",permalink:"/docs/v0.10/reference/commands/kusion-version"},next:{title:"kusion workspace delete",permalink:"/docs/v0.10/reference/commands/kusion-workspace-delete"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],l={toc:p};function u(e){let{components:r,...t}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-create"},"kusion workspace create"),(0,o.kt)("p",null,"Create a new workspace"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command creates a workspace with specified name and configuration file, where the file must be in the YAML format."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace create\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Create a new workspace\n kusion workspace create dev -f dev.yaml\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -f, --file string the path of workspace configuration file\n -h, --help help for create\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5b1b6e2c.99ece6ed.js b/assets/js/5b1b6e2c.99ece6ed.js new file mode 100644 index 00000000000..9149403d376 --- /dev/null +++ b/assets/js/5b1b6e2c.99ece6ed.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3752],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},l=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),d=p(n),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||i;return n?r.createElement(f,a(a({ref:t},l),{},{components:n})):r.createElement(f,a({ref:t},l))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>p});var r=n(87462),o=(n(67294),n(3905));const i={},a="kusion init",s={unversionedId:"reference/commands/kusion-init",id:"reference/commands/kusion-init",title:"kusion init",description:"Initialize the scaffolding for a demo project",source:"@site/docs/kusion/6-reference/1-commands/kusion-init.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-init",permalink:"/docs/next/reference/commands/kusion-init",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-init.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion generate",permalink:"/docs/next/reference/commands/kusion-generate"},next:{title:"kusion mod init",permalink:"/docs/next/reference/commands/kusion-mod-init"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-init"},"kusion init"),(0,o.kt)("p",null,"Initialize the scaffolding for a demo project"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command initializes the scaffolding for a demo project with the name of the current directory to help users quickly get started."),(0,o.kt)("p",null," Note that target directory needs to be an empty directory."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion init [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Initialize a demo project with the name of the current directory\n mkdir quickstart && cd quickstart\n kusion init\n \n # Initialize the demo project in a different target directory\n kusion init --target projects/my-demo-project\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for init\n -t, --target string specify the target directory\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5b1b6e2c.9dc9d453.js b/assets/js/5b1b6e2c.9dc9d453.js deleted file mode 100644 index 68a939fe218..00000000000 --- a/assets/js/5b1b6e2c.9dc9d453.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3752],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=l(n),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||i;return n?r.createElement(f,a(a({ref:t},p),{},{components:n})):r.createElement(f,a({ref:t},p))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const i={},a="kusion init",s={unversionedId:"reference/commands/kusion-init",id:"reference/commands/kusion-init",title:"kusion init",description:"Initialize the scaffolding for a demo project",source:"@site/docs/kusion/6-reference/1-commands/kusion-init.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-init",permalink:"/docs/next/reference/commands/kusion-init",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-init.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion generate",permalink:"/docs/next/reference/commands/kusion-generate"},next:{title:"kusion mod init",permalink:"/docs/next/reference/commands/kusion-mod-init"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-init"},"kusion init"),(0,o.kt)("p",null,"Initialize the scaffolding for a demo project"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command initializes the scaffolding for a demo project with the name of the current directory to help users quickly get started."),(0,o.kt)("p",null," Note that target directory needs to be an empty directory."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion init [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Initialize a demo project with the name of the current directory\n mkdir quickstart && cd quickstart\n kusion init\n \n # Initialize the demo project in a different target directory\n kusion init --target projects/my-demo-project\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for init\n -t, --target string specify the target directory\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5b317457.ac8a23b2.js b/assets/js/5b317457.ac8a23b2.js deleted file mode 100644 index 1d62df36deb..00000000000 --- a/assets/js/5b317457.ac8a23b2.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6853],{3905:(e,a,t)=>{t.d(a,{Zo:()=>d,kt:()=>m});var n=t(67294);function r(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}function o(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);a&&(n=n.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,n)}return t}function i(e){for(var a=1;a=0||(r[t]=e[t]);return r}(e,a);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var l=n.createContext({}),p=function(e){var a=n.useContext(l),t=a;return e&&(t="function"==typeof e?e(a):i(i({},a),e)),t},d=function(e){var a=p(e.components);return n.createElement(l.Provider,{value:a},e.children)},c={inlineCode:"code",wrapper:function(e){var a=e.children;return n.createElement(n.Fragment,{},a)}},u=n.forwardRef((function(e,a){var t=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),u=p(t),m=r,h=u["".concat(l,".").concat(m)]||u[m]||c[m]||o;return t?n.createElement(h,i(i({ref:a},d),{},{components:t})):n.createElement(h,i({ref:a},d))}));function m(e,a){var t=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var o=t.length,i=new Array(o);i[0]=u;var s={};for(var l in a)hasOwnProperty.call(a,l)&&(s[l]=a[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var p=2;p{t.r(a),t.d(a,{assets:()=>l,contentTitle:()=>i,default:()=>c,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var n=t(87462),r=(t(67294),t(3905));const o={sidebar_position:6},i="Managed Databases",s={unversionedId:"config-walkthrough/database",id:"version-v0.9/config-walkthrough/database",title:"Managed Databases",description:"The database attribute in the AppConfiguration instance is used to describe the specification for any databases needed for the application.",source:"@site/docs_versioned_docs/version-v0.9/config-walkthrough/database.md",sourceDirName:"config-walkthrough",slug:"/config-walkthrough/database",permalink:"/docs/v0.9/config-walkthrough/database",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/config-walkthrough/database.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:6,frontMatter:{sidebar_position:6},sidebar:"kusion",previous:{title:"Application Networking",permalink:"/docs/v0.9/config-walkthrough/networking"},next:{title:"Secret Management",permalink:"/docs/v0.9/config-walkthrough/secret"}},l={},p=[{value:"Import",id:"import",level:2},{value:"Types of Database offerings",id:"types-of-database-offerings",level:2},{value:"Cloud Credentials and Permissions",id:"cloud-credentials-and-permissions",level:2},{value:"Configure Database",id:"configure-database",level:2},{value:"Provision a Cloud Database",id:"provision-a-cloud-database",level:3},{value:"AWS RDS Instance",id:"aws-rds-instance",level:4},{value:"AliCloud RDS Instance",id:"alicloud-rds-instance",level:4},{value:"Local Database",id:"local-database",level:3},{value:"Database Credentials",id:"database-credentials",level:2},{value:"Configure Network Access",id:"configure-network-access",level:2},{value:"Subnet ID",id:"subnet-id",level:3},{value:"Private Routing",id:"private-routing",level:3}],d={toc:p};function c(e){let{components:a,...t}=e;return(0,r.kt)("wrapper",(0,n.Z)({},d,t,{components:a,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"managed-databases"},"Managed Databases"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"database")," attribute in the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance is used to describe the specification for any databases needed for the application."),(0,r.kt)("p",null,"You can currently have only one ",(0,r.kt)("inlineCode",{parentName:"p"},"database")," per ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),"."),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"catalog")," package. For more details on KCL package import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"../config-walkthrough/overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.accessories.database as db\n")),(0,r.kt)("h2",{id:"types-of-database-offerings"},"Types of Database offerings"),(0,r.kt)("p",null,"As of version 0.9.0, Kusion supports the following database offerings on the cloud:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Relational Database Service (RDS) on ",(0,r.kt)("a",{parentName:"li",href:"https://aws.amazon.com/rds/"},"AWS")),(0,r.kt)("li",{parentName:"ul"},"Relational Database Service (RDS) on ",(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/product/databases"},"AliCloud"))),(0,r.kt)("p",null,"More database types on more cloud vendors will be added in the future."),(0,r.kt)("p",null,"Alternatively, Kusion also supports creating a database at ",(0,r.kt)("inlineCode",{parentName:"p"},"localhost")," for local testing needs. A local database is quicker to stand up and easier to manage. It also eliminates the need for an account and any relevant costs with the cloud providers in the case that a local testing environment is sufficient."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"You do need a local Kubernetes cluster to run the database workloads. You can refer to ",(0,r.kt)("a",{parentName:"p",href:"https://minikube.sigs.k8s.io/docs/start/"},"Minikube")," or ",(0,r.kt)("a",{parentName:"p",href:"https://kind.sigs.k8s.io/docs/user/quick-start/"},"Kind")," to get started.\nTo see an end-to-end use case for standing up a local testing environment including a local database, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"../getting-started/deliver-wordpress"},"Kusion Quickstart"),".")),(0,r.kt)("h2",{id:"cloud-credentials-and-permissions"},"Cloud Credentials and Permissions"),(0,r.kt)("p",null,"Kusion provisions databases on the cloud via ",(0,r.kt)("a",{parentName:"p",href:"https://www.terraform.io/"},"terraform")," providers. For it to create ",(0,r.kt)("em",{parentName:"p"},"any")," cloud resources, it requires a set of credentials that belongs to an account that has the appropriate write access, as well as a provider region so the terraform provider can be initialized properly."),(0,r.kt)("p",null,"For AWS, the environment variables needed:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'export AWS_ACCESS_KEY_ID="xxxxxxxxxxx" # replace it with your AccessKey\nexport AWS_SECRET_ACCESS_KEY="xxxxxxx" # replace it with your SecretKey\nexport AWS_PROVIDER_REGION="xx-xxxx-x" # replace it with your AWS Region\n')),(0,r.kt)("p",null,"For AliCloud, the environment variables needed:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'export ALICLOUD_ACCESS_KEY="xxxxxxxxx" # replace it with your AccessKey\nexport ALICLOUD_SECRET_KEY="xxxxxxxxx" # replace it with your SecretKey\nexport ALICLOUD_PROVIDER_REGION="xx-xxxxxxx" # replace it with your AliCloud Region\n')),(0,r.kt)("p",null,"The user account that owns these credentials would need to have the proper permission policies attached to create databases and security groups. If you are using the cloud-managed policies, the policies needed to provision a database and configure firewall rules are listed below."),(0,r.kt)("p",null,"For AWS:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AmazonVPCFullAccess")," for creating and managing database firewall rules via security group"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AmazonRDSFullAccess")," for creating and managing RDS instances")),(0,r.kt)("p",null,"For AliCloud:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AliyunVPCFullAccess")," for creating and managing database firewall rules via security group"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AliyunRDSFullAccess")," for creating and managing RDS instances")),(0,r.kt)("p",null,"Alternatively, you can use customer managed policies if the cloud provider built-in policies don't meet your needs. The list of permissions needed are in the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonRDSFullAccess.html#AmazonRDSFullAccess-json"},"AmazonRDSFullAccess Policy Document")," and ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonVPCFullAccess.html"},"AmazonVPCFullAccess Policy Document"),". It will most likely be a subset of the permissions in the policy documents."),(0,r.kt)("h2",{id:"configure-database"},"Configure Database"),(0,r.kt)("h3",{id:"provision-a-cloud-database"},"Provision a Cloud Database"),(0,r.kt)("p",null,"Assuming the steps in the ",(0,r.kt)("a",{parentName:"p",href:"#cloud-credentials-and-permissions"},"Cloud Credentials and Permissions")," section is setup properly, you can now provision cloud databases via Kusion."),(0,r.kt)("h4",{id:"aws-rds-instance"},"AWS RDS Instance"),(0,r.kt)("p",null,"To provision an AWS RDS instance with MySQL v5.7:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'wordpress: ac.AppConfiguration {\n # ...\n database: db.Database {\n type: "aws"\n engine: "MySQL"\n version: "5.7"\n size: 20\n instanceType: "db.t3.micro"\n securityIPs = ["0.0.0.0/0"]\n }\n}\n')),(0,r.kt)("p",null,"It's highly recommended to replace ",(0,r.kt)("inlineCode",{parentName:"p"},"0.0.0.0/0")," and closely manage the whitelist of IPs that can access the database for security purposes. The ",(0,r.kt)("inlineCode",{parentName:"p"},"0.0.0.0/0")," in the example above or if ",(0,r.kt)("inlineCode",{parentName:"p"},"securityIPs")," is omitted altogether will allow connections from anywhere which would typically be a security bad practice."),(0,r.kt)("p",null,"The supported ",(0,r.kt)("inlineCode",{parentName:"p"},"engine")," values are ",(0,r.kt)("inlineCode",{parentName:"p"},"MySQL"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"MariaDB"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Postgres")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"SQLServer-SE"),". "),(0,r.kt)("p",null,"The supported engine versions can be found in:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MySQL.Concepts.VersionMgmt.html"},"MySQL versions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MariaDB.Concepts.VersionMgmt.html#MariaDB.Concepts.VersionMgmt.Supported"},"MariaDB versions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_PostgreSQL.html#PostgreSQL.Concepts.General.DBVersions"},"PostgreSQL versions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_SQLServer.html#SQLServer.Concepts.General.VersionSupport"},"Microsoft SQL Server versions"))),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"instanceType")," field determines the computation and memory capacity of the RDS instance. The ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.micro")," instance type in the example above represents the ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3")," instance class with a size of ",(0,r.kt)("inlineCode",{parentName:"p"},"micro"),". In the same ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3")," instance family there are also ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.small"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.medium"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.2xlarge"),", etc."),(0,r.kt)("p",null,"The full list of supported ",(0,r.kt)("inlineCode",{parentName:"p"},"instanceType")," values can be found ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html#Concepts.DBInstanceClass.Support"},"here"),"."),(0,r.kt)("p",null,"You can also adjust the storage capacity for the database instance by changing the ",(0,r.kt)("inlineCode",{parentName:"p"},"size")," field which is storage size measured in gigabytes. The minimum is 20. More details can be found ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#Concepts.Storage.GeneralSSD"},"here"),"."),(0,r.kt)("h4",{id:"alicloud-rds-instance"},"AliCloud RDS Instance"),(0,r.kt)("p",null,"To provision an AWS RDS instance with MySQL v5.7. AliCloud RDS has several additional fields such as ",(0,r.kt)("inlineCode",{parentName:"p"},"category"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'wordpress: ac.AppConfiguration {\n # ...\n database: db.Database {\n type: "alicloud"\n engine: "MySQL"\n version: "8.0"\n size: 20\n instanceType: "mysql.n2.serverless.1cc"\n category = "serverless_basic"\n subnetID = "{your-alicloud-vswitch-id}"\n securityIPs = ["0.0.0.0/0"]\n privateRouting = False\n }\n}\n')),(0,r.kt)("p",null,"We will walkthrough ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting")," in the ",(0,r.kt)("a",{parentName:"p",href:"#configure-network-access"},"Configure Network Access")," section."),(0,r.kt)("p",null,"The supported ",(0,r.kt)("inlineCode",{parentName:"p"},"engine")," values are ",(0,r.kt)("inlineCode",{parentName:"p"},"MySQL"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"MariaDB"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"PostgreSQL")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"SQLServer"),". "),(0,r.kt)("p",null,"The supported engine versions can be found in:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/apsaradb-rds-for-mysql/major-version-lifecycle-description"},"MySQL versions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/developer-reference/api-rds-2014-08-15-createdbinstance"},"MariaDB versions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/apsaradb-rds-for-postgresql/lifecycles-of-major-engine-versions"},"PostgreSQL versions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/apsaradb-rds-for-sql-server/release-notes-for-minor-engine-versions-of-apsaradb-rds-for-sql-server"},"Microsoft SQL Server versions"))),(0,r.kt)("p",null,"A summarized version can be found ",(0,r.kt)("a",{parentName:"p",href:"https://www.alibabacloud.com/help/en/rds/developer-reference/api-rds-2014-08-15-createdbinstance"},"here")," in the ",(0,r.kt)("inlineCode",{parentName:"p"},"EngineVersion")," parameter."),(0,r.kt)("p",null,"The full list of supported ",(0,r.kt)("inlineCode",{parentName:"p"},"instanceType")," values can be found in:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/apsaradb-rds-for-mysql/primary-apsaradb-rds-for-mysql-instance-types#concept-2096487"},"MySQL instance types(x86)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/apsaradb-rds-for-mariadb/instance-types#concept-2096591"},"MariaDB instance types")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/apsaradb-rds-for-postgresql/primary-apsaradb-rds-for-postgresql-instance-types#concept-2096578"},"PostgreSQL instance types")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/apsaradb-rds-for-sql-server/primary-apsaradb-rds-for-sql-server-instance-types#concept-2096545"},"Microsoft SQL Server instance types"))),(0,r.kt)("h3",{id:"local-database"},"Local Database"),(0,r.kt)("p",null,"To deploy a local database with MySQL v8.0:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'wordpress: ac.AppConfiguration {\n # ...\n database: db.Database {\n type: "local"\n engine: "MySQL"\n version: "8.0"\n instanceType: "local"\n }\n}\n')),(0,r.kt)("p",null,"The supported ",(0,r.kt)("inlineCode",{parentName:"p"},"engine")," values are ",(0,r.kt)("inlineCode",{parentName:"p"},"MySQL")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"MariaDB")," as of version 0.9.0. Kusion will stand up a ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql")," deployment and expose it as a service in the local Kubernetes cluster for local workloads to connect to."),(0,r.kt)("h2",{id:"database-credentials"},"Database Credentials"),(0,r.kt)("p",null,"There is no need to manage the database credentials manually. Kusion will automatically generate a random password, set it as the credential when creating the database, and then inject the hostname, username and password into the application runtime."),(0,r.kt)("p",null,"You have the option to BYO (Bring Your Own) username for the database credential by specifying the ",(0,r.kt)("inlineCode",{parentName:"p"},"username")," attribute in the ",(0,r.kt)("inlineCode",{parentName:"p"},"database"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'wordpress: ac.AppConfiguration {\n # ...\n database: db.Database {\n # ...\n username: "my_username"\n }\n}\n')),(0,r.kt)("p",null,"You cannot bring your own password. The password will always be managed by Kusion automatically."),(0,r.kt)("p",null,"The database credentials are injected into the environment variables of the application container. You can access them via the following env vars:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"# env | grep KUSION_DB\nKUSION_DB_HOST=wordpress.xxxxxxxx.us-east-1.rds.amazonaws.com\nKUSION_DB_USERNAME=xxxxxxxxx\nKUSION_DB_PASSWORD=xxxxxxxxx\n")),(0,r.kt)("p",null,"You can use these environment variables out of the box. Or most likely, your application might retrieve the connection details from a different set of environment variables. In that case, you can map the kusion environment variables to the ones expected by your application using the ",(0,r.kt)("inlineCode",{parentName:"p"},"$()")," expression."),(0,r.kt)("p",null,"This example below will assign the value of ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_HOST")," into ",(0,r.kt)("inlineCode",{parentName:"p"},"WORDPRESS_DB_HOST"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"WORDPRESS_DB_USER")," into ",(0,r.kt)("inlineCode",{parentName:"p"},"WORDPRESS_DB_USER"),", likewise for ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_PASSWORD")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"WORDPRESS_DB_PASSWORD"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'wordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n wordpress: c.Container {\n image = "wordpress:6.3-apache"\n env: {\n "WORDPRESS_DB_HOST": "$(KUSION_DB_HOST)"\n "WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME)"\n "WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD)"\n }\n # ...\n }\n }\n # ...\n }\n database: db.Database {\n # ...\n }\n}\n')),(0,r.kt)("h2",{id:"configure-network-access"},"Configure Network Access"),(0,r.kt)("p",null,"You can also optionally configure the network access to the database as part of the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),". This is highly recommended because it dramatically increases the security posture of your cloud environment in the means of least privilege principle."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"securityIPs")," field in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Database")," schema declares the list of network addresses that are allowed to access the database. The network addresses are in the ",(0,r.kt)("a",{parentName:"p",href:"https://aws.amazon.com/what-is/cidr/"},"CIDR notation")," and can be either a private IP range (",(0,r.kt)("a",{parentName:"p",href:"https://datatracker.ietf.org/doc/html/rfc1918"},"RFC-1918")," and ",(0,r.kt)("a",{parentName:"p",href:"https://datatracker.ietf.org/doc/html/rfc6598"},"RFC-6598")," address) or a public one."),(0,r.kt)("p",null,"If the database need to be accessed from a public location (which should most likely not be the case in a production environment), ",(0,r.kt)("inlineCode",{parentName:"p"},"securityIPs")," need to include the public IP address of the traffic source (For instance, if the RDS database needs to be accessed from your computer)."),(0,r.kt)("p",null,"To configure AWS RDS to restrict network access from a VPC with a CIDR of ",(0,r.kt)("inlineCode",{parentName:"p"},"10.0.1.0/24")," and a public IP of ",(0,r.kt)("inlineCode",{parentName:"p"},"103.192.227.125"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'wordpress: ac.AppConfiguration {\n # ...\n database: db.Database {\n type: "aws"\n ...\n securityIPs = ["10.0.1.0/24", "103.192.227.125/32"]\n }\n}\n')),(0,r.kt)("p",null,"Depending on the cloud provider, the default behavior of the database firewall settings may differ if omitted."),(0,r.kt)("h3",{id:"subnet-id"},"Subnet ID"),(0,r.kt)("p",null,"On AWS, you have the option to launch the RDS instance inside a specific VPC if a ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," is present in the application configuration. By default, if ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," is not provided, the RDS will be created in the default VPC for that account. However, the recommendation is to self-manage your VPCs to provider better isolation from a network security perspective."),(0,r.kt)("p",null,"On AliCloud, the ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," is required. The concept of subnet maps to VSwitch in AliCloud."),(0,r.kt)("p",null,"To place the RDS instance into a specific VPC on AWS:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'wordpress: ac.AppConfiguration {\n # ...\n database: db.Database {\n type: "aws"\n ...\n subnetID: "subnet-xxxxxxxxxxxxxxxx" # replace it with your vpc subnet ID\n }\n}\n')),(0,r.kt)("h3",{id:"private-routing"},"Private Routing"),(0,r.kt)("p",null,"There is an option to enforce private routing on certain cloud providers if both the workload and the database are running on the cloud."),(0,r.kt)("p",null,"On AliCloud, you can set the ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting")," flag to ",(0,r.kt)("inlineCode",{parentName:"p"},"True"),". The database host generated will be a private FQDN that is only resolvable and accessible from within the AliCloud VPCs. Setting ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting")," flag to ",(0,r.kt)("inlineCode",{parentName:"p"},"True")," when ",(0,r.kt)("inlineCode",{parentName:"p"},"type")," is ",(0,r.kt)("inlineCode",{parentName:"p"},"aws")," is a no-op."),(0,r.kt)("p",null,"To enforce private routing on AliCloud:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'wordpress: ac.AppConfiguration {\n # ...\n database: db.Database {\n type: "alicloud"\n ...\n privateRouting: true\n }\n}\n')),(0,r.kt)("p",null,"Kusion will then generate a private FQDN and inject it into the application runtime as the environment variable ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_HOST")," for the application to use. A complete list of Kusion-managed environment variable can be found ",(0,r.kt)("a",{parentName:"p",href:"../reference/model/naming-conventions#list-of-magic-variables"},"here"),"."),(0,r.kt)("p",null,"Otherwise when using the public FQDN to connect to a database from the workload, the route will depend on cloud provider's routing preference. The options are generally either:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Travel as far as possible on the cloud provider's global backbone network, or also referred to as cold potato routing, or"),(0,r.kt)("li",{parentName:"ul"},"Egress as early as possible to the public Internet and re-enter the cloud provider's datacenter later, or also referred to as hot potato routing")),(0,r.kt)("p",null,"The prior generally has better performance but is also more expensive."),(0,r.kt)("p",null,"You can find a good read on the ",(0,r.kt)("a",{parentName:"p",href:"https://aws.amazon.com/blogs/architecture/internet-routing-and-traffic-engineering/"},"AWS Blog")," or the ",(0,r.kt)("a",{parentName:"p",href:"https://learn.microsoft.com/en-us/azure/virtual-network/ip-services/routing-preference-overview"},"Microsoft Learn"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5b317457.acf5a882.js b/assets/js/5b317457.acf5a882.js new file mode 100644 index 00000000000..b2f370a5849 --- /dev/null +++ b/assets/js/5b317457.acf5a882.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6853],{3905:(e,a,t)=>{t.d(a,{Zo:()=>d,kt:()=>m});var n=t(67294);function r(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}function o(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);a&&(n=n.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,n)}return t}function i(e){for(var a=1;a=0||(r[t]=e[t]);return r}(e,a);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var l=n.createContext({}),p=function(e){var a=n.useContext(l),t=a;return e&&(t="function"==typeof e?e(a):i(i({},a),e)),t},d=function(e){var a=p(e.components);return n.createElement(l.Provider,{value:a},e.children)},c={inlineCode:"code",wrapper:function(e){var a=e.children;return n.createElement(n.Fragment,{},a)}},u=n.forwardRef((function(e,a){var t=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),u=p(t),m=r,h=u["".concat(l,".").concat(m)]||u[m]||c[m]||o;return t?n.createElement(h,i(i({ref:a},d),{},{components:t})):n.createElement(h,i({ref:a},d))}));function m(e,a){var t=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var o=t.length,i=new Array(o);i[0]=u;var s={};for(var l in a)hasOwnProperty.call(a,l)&&(s[l]=a[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var p=2;p{t.r(a),t.d(a,{assets:()=>l,contentTitle:()=>i,default:()=>c,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var n=t(87462),r=(t(67294),t(3905));const o={sidebar_position:6},i="Managed Databases",s={unversionedId:"config-walkthrough/database",id:"version-v0.9/config-walkthrough/database",title:"Managed Databases",description:"The database attribute in the AppConfiguration instance is used to describe the specification for any databases needed for the application.",source:"@site/docs_versioned_docs/version-v0.9/config-walkthrough/database.md",sourceDirName:"config-walkthrough",slug:"/config-walkthrough/database",permalink:"/docs/v0.9/config-walkthrough/database",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/config-walkthrough/database.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:6,frontMatter:{sidebar_position:6},sidebar:"kusion",previous:{title:"Application Networking",permalink:"/docs/v0.9/config-walkthrough/networking"},next:{title:"Secret Management",permalink:"/docs/v0.9/config-walkthrough/secret"}},l={},p=[{value:"Import",id:"import",level:2},{value:"Types of Database offerings",id:"types-of-database-offerings",level:2},{value:"Cloud Credentials and Permissions",id:"cloud-credentials-and-permissions",level:2},{value:"Configure Database",id:"configure-database",level:2},{value:"Provision a Cloud Database",id:"provision-a-cloud-database",level:3},{value:"AWS RDS Instance",id:"aws-rds-instance",level:4},{value:"AliCloud RDS Instance",id:"alicloud-rds-instance",level:4},{value:"Local Database",id:"local-database",level:3},{value:"Database Credentials",id:"database-credentials",level:2},{value:"Configure Network Access",id:"configure-network-access",level:2},{value:"Subnet ID",id:"subnet-id",level:3},{value:"Private Routing",id:"private-routing",level:3}],d={toc:p};function c(e){let{components:a,...t}=e;return(0,r.kt)("wrapper",(0,n.Z)({},d,t,{components:a,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"managed-databases"},"Managed Databases"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"database")," attribute in the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance is used to describe the specification for any databases needed for the application."),(0,r.kt)("p",null,"You can currently have only one ",(0,r.kt)("inlineCode",{parentName:"p"},"database")," per ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),"."),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"catalog")," package. For more details on KCL package import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"../config-walkthrough/overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.accessories.database as db\n")),(0,r.kt)("h2",{id:"types-of-database-offerings"},"Types of Database offerings"),(0,r.kt)("p",null,"As of version 0.9.0, Kusion supports the following database offerings on the cloud:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Relational Database Service (RDS) on ",(0,r.kt)("a",{parentName:"li",href:"https://aws.amazon.com/rds/"},"AWS")),(0,r.kt)("li",{parentName:"ul"},"Relational Database Service (RDS) on ",(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/product/databases"},"AliCloud"))),(0,r.kt)("p",null,"More database types on more cloud vendors will be added in the future."),(0,r.kt)("p",null,"Alternatively, Kusion also supports creating a database at ",(0,r.kt)("inlineCode",{parentName:"p"},"localhost")," for local testing needs. A local database is quicker to stand up and easier to manage. It also eliminates the need for an account and any relevant costs with the cloud providers in the case that a local testing environment is sufficient."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"You do need a local Kubernetes cluster to run the database workloads. You can refer to ",(0,r.kt)("a",{parentName:"p",href:"https://minikube.sigs.k8s.io/docs/start/"},"Minikube")," or ",(0,r.kt)("a",{parentName:"p",href:"https://kind.sigs.k8s.io/docs/user/quick-start/"},"Kind")," to get started.\nTo see an end-to-end use case for standing up a local testing environment including a local database, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"../getting-started/deliver-wordpress"},"Kusion Quickstart"),".")),(0,r.kt)("h2",{id:"cloud-credentials-and-permissions"},"Cloud Credentials and Permissions"),(0,r.kt)("p",null,"Kusion provisions databases on the cloud via ",(0,r.kt)("a",{parentName:"p",href:"https://www.terraform.io/"},"terraform")," providers. For it to create ",(0,r.kt)("em",{parentName:"p"},"any")," cloud resources, it requires a set of credentials that belongs to an account that has the appropriate write access, as well as a provider region so the terraform provider can be initialized properly."),(0,r.kt)("p",null,"For AWS, the environment variables needed:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'export AWS_ACCESS_KEY_ID="xxxxxxxxxxx" # replace it with your AccessKey\nexport AWS_SECRET_ACCESS_KEY="xxxxxxx" # replace it with your SecretKey\nexport AWS_PROVIDER_REGION="xx-xxxx-x" # replace it with your AWS Region\n')),(0,r.kt)("p",null,"For AliCloud, the environment variables needed:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'export ALICLOUD_ACCESS_KEY="xxxxxxxxx" # replace it with your AccessKey\nexport ALICLOUD_SECRET_KEY="xxxxxxxxx" # replace it with your SecretKey\nexport ALICLOUD_PROVIDER_REGION="xx-xxxxxxx" # replace it with your AliCloud Region\n')),(0,r.kt)("p",null,"The user account that owns these credentials would need to have the proper permission policies attached to create databases and security groups. If you are using the cloud-managed policies, the policies needed to provision a database and configure firewall rules are listed below."),(0,r.kt)("p",null,"For AWS:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AmazonVPCFullAccess")," for creating and managing database firewall rules via security group"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AmazonRDSFullAccess")," for creating and managing RDS instances")),(0,r.kt)("p",null,"For AliCloud:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AliyunVPCFullAccess")," for creating and managing database firewall rules via security group"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AliyunRDSFullAccess")," for creating and managing RDS instances")),(0,r.kt)("p",null,"Alternatively, you can use customer managed policies if the cloud provider built-in policies don't meet your needs. The list of permissions needed are in the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonRDSFullAccess.html#AmazonRDSFullAccess-json"},"AmazonRDSFullAccess Policy Document")," and ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonVPCFullAccess.html"},"AmazonVPCFullAccess Policy Document"),". It will most likely be a subset of the permissions in the policy documents."),(0,r.kt)("h2",{id:"configure-database"},"Configure Database"),(0,r.kt)("h3",{id:"provision-a-cloud-database"},"Provision a Cloud Database"),(0,r.kt)("p",null,"Assuming the steps in the ",(0,r.kt)("a",{parentName:"p",href:"#cloud-credentials-and-permissions"},"Cloud Credentials and Permissions")," section is setup properly, you can now provision cloud databases via Kusion."),(0,r.kt)("h4",{id:"aws-rds-instance"},"AWS RDS Instance"),(0,r.kt)("p",null,"To provision an AWS RDS instance with MySQL v5.7:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'wordpress: ac.AppConfiguration {\n # ...\n database: db.Database {\n type: "aws"\n engine: "MySQL"\n version: "5.7"\n size: 20\n instanceType: "db.t3.micro"\n securityIPs = ["0.0.0.0/0"]\n }\n}\n')),(0,r.kt)("p",null,"It's highly recommended to replace ",(0,r.kt)("inlineCode",{parentName:"p"},"0.0.0.0/0")," and closely manage the whitelist of IPs that can access the database for security purposes. The ",(0,r.kt)("inlineCode",{parentName:"p"},"0.0.0.0/0")," in the example above or if ",(0,r.kt)("inlineCode",{parentName:"p"},"securityIPs")," is omitted altogether will allow connections from anywhere which would typically be a security bad practice."),(0,r.kt)("p",null,"The supported ",(0,r.kt)("inlineCode",{parentName:"p"},"engine")," values are ",(0,r.kt)("inlineCode",{parentName:"p"},"MySQL"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"MariaDB"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Postgres")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"SQLServer-SE"),". "),(0,r.kt)("p",null,"The supported engine versions can be found in:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MySQL.Concepts.VersionMgmt.html"},"MySQL versions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/MariaDB.Concepts.VersionMgmt.html#MariaDB.Concepts.VersionMgmt.Supported"},"MariaDB versions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_PostgreSQL.html#PostgreSQL.Concepts.General.DBVersions"},"PostgreSQL versions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_SQLServer.html#SQLServer.Concepts.General.VersionSupport"},"Microsoft SQL Server versions"))),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"instanceType")," field determines the computation and memory capacity of the RDS instance. The ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.micro")," instance type in the example above represents the ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3")," instance class with a size of ",(0,r.kt)("inlineCode",{parentName:"p"},"micro"),". In the same ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3")," instance family there are also ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.small"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.medium"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.2xlarge"),", etc."),(0,r.kt)("p",null,"The full list of supported ",(0,r.kt)("inlineCode",{parentName:"p"},"instanceType")," values can be found ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html#Concepts.DBInstanceClass.Support"},"here"),"."),(0,r.kt)("p",null,"You can also adjust the storage capacity for the database instance by changing the ",(0,r.kt)("inlineCode",{parentName:"p"},"size")," field which is storage size measured in gigabytes. The minimum is 20. More details can be found ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#Concepts.Storage.GeneralSSD"},"here"),"."),(0,r.kt)("h4",{id:"alicloud-rds-instance"},"AliCloud RDS Instance"),(0,r.kt)("p",null,"To provision an AWS RDS instance with MySQL v5.7. AliCloud RDS has several additional fields such as ",(0,r.kt)("inlineCode",{parentName:"p"},"category"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'wordpress: ac.AppConfiguration {\n # ...\n database: db.Database {\n type: "alicloud"\n engine: "MySQL"\n version: "8.0"\n size: 20\n instanceType: "mysql.n2.serverless.1cc"\n category = "serverless_basic"\n subnetID = "{your-alicloud-vswitch-id}"\n securityIPs = ["0.0.0.0/0"]\n privateRouting = False\n }\n}\n')),(0,r.kt)("p",null,"We will walkthrough ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting")," in the ",(0,r.kt)("a",{parentName:"p",href:"#configure-network-access"},"Configure Network Access")," section."),(0,r.kt)("p",null,"The supported ",(0,r.kt)("inlineCode",{parentName:"p"},"engine")," values are ",(0,r.kt)("inlineCode",{parentName:"p"},"MySQL"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"MariaDB"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"PostgreSQL")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"SQLServer"),". "),(0,r.kt)("p",null,"The supported engine versions can be found in:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/apsaradb-rds-for-mysql/major-version-lifecycle-description"},"MySQL versions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/developer-reference/api-rds-2014-08-15-createdbinstance"},"MariaDB versions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/apsaradb-rds-for-postgresql/lifecycles-of-major-engine-versions"},"PostgreSQL versions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/apsaradb-rds-for-sql-server/release-notes-for-minor-engine-versions-of-apsaradb-rds-for-sql-server"},"Microsoft SQL Server versions"))),(0,r.kt)("p",null,"A summarized version can be found ",(0,r.kt)("a",{parentName:"p",href:"https://www.alibabacloud.com/help/en/rds/developer-reference/api-rds-2014-08-15-createdbinstance"},"here")," in the ",(0,r.kt)("inlineCode",{parentName:"p"},"EngineVersion")," parameter."),(0,r.kt)("p",null,"The full list of supported ",(0,r.kt)("inlineCode",{parentName:"p"},"instanceType")," values can be found in:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/apsaradb-rds-for-mysql/primary-apsaradb-rds-for-mysql-instance-types#concept-2096487"},"MySQL instance types(x86)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/apsaradb-rds-for-mariadb/instance-types#concept-2096591"},"MariaDB instance types")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/apsaradb-rds-for-postgresql/primary-apsaradb-rds-for-postgresql-instance-types#concept-2096578"},"PostgreSQL instance types")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/apsaradb-rds-for-sql-server/primary-apsaradb-rds-for-sql-server-instance-types#concept-2096545"},"Microsoft SQL Server instance types"))),(0,r.kt)("h3",{id:"local-database"},"Local Database"),(0,r.kt)("p",null,"To deploy a local database with MySQL v8.0:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'wordpress: ac.AppConfiguration {\n # ...\n database: db.Database {\n type: "local"\n engine: "MySQL"\n version: "8.0"\n instanceType: "local"\n }\n}\n')),(0,r.kt)("p",null,"The supported ",(0,r.kt)("inlineCode",{parentName:"p"},"engine")," values are ",(0,r.kt)("inlineCode",{parentName:"p"},"MySQL")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"MariaDB")," as of version 0.9.0. Kusion will stand up a ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql")," deployment and expose it as a service in the local Kubernetes cluster for local workloads to connect to."),(0,r.kt)("h2",{id:"database-credentials"},"Database Credentials"),(0,r.kt)("p",null,"There is no need to manage the database credentials manually. Kusion will automatically generate a random password, set it as the credential when creating the database, and then inject the hostname, username and password into the application runtime."),(0,r.kt)("p",null,"You have the option to BYO (Bring Your Own) username for the database credential by specifying the ",(0,r.kt)("inlineCode",{parentName:"p"},"username")," attribute in the ",(0,r.kt)("inlineCode",{parentName:"p"},"database"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'wordpress: ac.AppConfiguration {\n # ...\n database: db.Database {\n # ...\n username: "my_username"\n }\n}\n')),(0,r.kt)("p",null,"You cannot bring your own password. The password will always be managed by Kusion automatically."),(0,r.kt)("p",null,"The database credentials are injected into the environment variables of the application container. You can access them via the following env vars:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"# env | grep KUSION_DB\nKUSION_DB_HOST=wordpress.xxxxxxxx.us-east-1.rds.amazonaws.com\nKUSION_DB_USERNAME=xxxxxxxxx\nKUSION_DB_PASSWORD=xxxxxxxxx\n")),(0,r.kt)("p",null,"You can use these environment variables out of the box. Or most likely, your application might retrieve the connection details from a different set of environment variables. In that case, you can map the kusion environment variables to the ones expected by your application using the ",(0,r.kt)("inlineCode",{parentName:"p"},"$()")," expression."),(0,r.kt)("p",null,"This example below will assign the value of ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_HOST")," into ",(0,r.kt)("inlineCode",{parentName:"p"},"WORDPRESS_DB_HOST"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"WORDPRESS_DB_USER")," into ",(0,r.kt)("inlineCode",{parentName:"p"},"WORDPRESS_DB_USER"),", likewise for ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_PASSWORD")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"WORDPRESS_DB_PASSWORD"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'wordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n wordpress: c.Container {\n image = "wordpress:6.3-apache"\n env: {\n "WORDPRESS_DB_HOST": "$(KUSION_DB_HOST)"\n "WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME)"\n "WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD)"\n }\n # ...\n }\n }\n # ...\n }\n database: db.Database {\n # ...\n }\n}\n')),(0,r.kt)("h2",{id:"configure-network-access"},"Configure Network Access"),(0,r.kt)("p",null,"You can also optionally configure the network access to the database as part of the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),". This is highly recommended because it dramatically increases the security posture of your cloud environment in the means of least privilege principle."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"securityIPs")," field in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Database")," schema declares the list of network addresses that are allowed to access the database. The network addresses are in the ",(0,r.kt)("a",{parentName:"p",href:"https://aws.amazon.com/what-is/cidr/"},"CIDR notation")," and can be either a private IP range (",(0,r.kt)("a",{parentName:"p",href:"https://datatracker.ietf.org/doc/html/rfc1918"},"RFC-1918")," and ",(0,r.kt)("a",{parentName:"p",href:"https://datatracker.ietf.org/doc/html/rfc6598"},"RFC-6598")," address) or a public one."),(0,r.kt)("p",null,"If the database need to be accessed from a public location (which should most likely not be the case in a production environment), ",(0,r.kt)("inlineCode",{parentName:"p"},"securityIPs")," need to include the public IP address of the traffic source (For instance, if the RDS database needs to be accessed from your computer)."),(0,r.kt)("p",null,"To configure AWS RDS to restrict network access from a VPC with a CIDR of ",(0,r.kt)("inlineCode",{parentName:"p"},"10.0.1.0/24")," and a public IP of ",(0,r.kt)("inlineCode",{parentName:"p"},"103.192.227.125"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'wordpress: ac.AppConfiguration {\n # ...\n database: db.Database {\n type: "aws"\n ...\n securityIPs = ["10.0.1.0/24", "103.192.227.125/32"]\n }\n}\n')),(0,r.kt)("p",null,"Depending on the cloud provider, the default behavior of the database firewall settings may differ if omitted."),(0,r.kt)("h3",{id:"subnet-id"},"Subnet ID"),(0,r.kt)("p",null,"On AWS, you have the option to launch the RDS instance inside a specific VPC if a ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," is present in the application configuration. By default, if ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," is not provided, the RDS will be created in the default VPC for that account. However, the recommendation is to self-manage your VPCs to provider better isolation from a network security perspective."),(0,r.kt)("p",null,"On AliCloud, the ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," is required. The concept of subnet maps to VSwitch in AliCloud."),(0,r.kt)("p",null,"To place the RDS instance into a specific VPC on AWS:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'wordpress: ac.AppConfiguration {\n # ...\n database: db.Database {\n type: "aws"\n ...\n subnetID: "subnet-xxxxxxxxxxxxxxxx" # replace it with your vpc subnet ID\n }\n}\n')),(0,r.kt)("h3",{id:"private-routing"},"Private Routing"),(0,r.kt)("p",null,"There is an option to enforce private routing on certain cloud providers if both the workload and the database are running on the cloud."),(0,r.kt)("p",null,"On AliCloud, you can set the ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting")," flag to ",(0,r.kt)("inlineCode",{parentName:"p"},"True"),". The database host generated will be a private FQDN that is only resolvable and accessible from within the AliCloud VPCs. Setting ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting")," flag to ",(0,r.kt)("inlineCode",{parentName:"p"},"True")," when ",(0,r.kt)("inlineCode",{parentName:"p"},"type")," is ",(0,r.kt)("inlineCode",{parentName:"p"},"aws")," is a no-op."),(0,r.kt)("p",null,"To enforce private routing on AliCloud:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'wordpress: ac.AppConfiguration {\n # ...\n database: db.Database {\n type: "alicloud"\n ...\n privateRouting: true\n }\n}\n')),(0,r.kt)("p",null,"Kusion will then generate a private FQDN and inject it into the application runtime as the environment variable ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_HOST")," for the application to use. A complete list of Kusion-managed environment variable can be found ",(0,r.kt)("a",{parentName:"p",href:"../reference/model/naming-conventions#list-of-magic-variables"},"here"),"."),(0,r.kt)("p",null,"Otherwise when using the public FQDN to connect to a database from the workload, the route will depend on cloud provider's routing preference. The options are generally either:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Travel as far as possible on the cloud provider's global backbone network, or also referred to as cold potato routing, or"),(0,r.kt)("li",{parentName:"ul"},"Egress as early as possible to the public Internet and re-enter the cloud provider's datacenter later, or also referred to as hot potato routing")),(0,r.kt)("p",null,"The prior generally has better performance but is also more expensive."),(0,r.kt)("p",null,"You can find a good read on the ",(0,r.kt)("a",{parentName:"p",href:"https://aws.amazon.com/blogs/architecture/internet-routing-and-traffic-engineering/"},"AWS Blog")," or the ",(0,r.kt)("a",{parentName:"p",href:"https://learn.microsoft.com/en-us/azure/virtual-network/ip-services/routing-preference-overview"},"Microsoft Learn"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5bd88873.4375957b.js b/assets/js/5bd88873.4375957b.js new file mode 100644 index 00000000000..c7854955fbd --- /dev/null +++ b/assets/js/5bd88873.4375957b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4409],{3905:(e,n,t)=>{t.d(n,{Zo:()=>s,kt:()=>k});var o=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function a(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var l=o.createContext({}),c=function(e){var n=o.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},s=function(e){var n=c(e.components);return o.createElement(l.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},d=o.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),d=c(t),k=r,g=d["".concat(l,".").concat(k)]||d[k]||u[k]||i;return t?o.createElement(g,a(a({ref:n},s),{},{components:t})):o.createElement(g,a({ref:n},s))}));function k(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,a=new Array(i);a[0]=d;var p={};for(var l in n)hasOwnProperty.call(n,l)&&(p[l]=n[l]);p.originalType=e,p.mdxType="string"==typeof e?e:r,a[1]=p;for(var c=2;c{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>p,toc:()=>c});var o=t(87462),r=(t(67294),t(3905));const i={id:"networking"},a="Application Networking",p={unversionedId:"configuration-walkthrough/networking",id:"version-v0.11/configuration-walkthrough/networking",title:"Application Networking",description:"In addition to configuring application's container specifications, you can also configure its networking behaviors, including how to expose the application and how it can be accessed. You can specify a network module in the accessories field in AppConfiguration to achieve that.",source:"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/5-networking.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/networking",permalink:"/docs/configuration-walkthrough/networking",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/5-networking.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:5,frontMatter:{id:"networking"},sidebar:"kusion",previous:{title:"Workload",permalink:"/docs/configuration-walkthrough/workload"},next:{title:"Managed Databases",permalink:"/docs/configuration-walkthrough/databse"}},l={},c=[{value:"Import",id:"import",level:2},{value:"Private vs Public Access",id:"private-vs-public-access",level:2},{value:"Mapping ports",id:"mapping-ports",level:2},{value:"Exposing multiple ports",id:"exposing-multiple-ports",level:2},{value:"Choosing protocol",id:"choosing-protocol",level:2}],s={toc:c};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,o.Z)({},s,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"application-networking"},"Application Networking"),(0,r.kt)("p",null,"In addition to configuring application's ",(0,r.kt)("a",{parentName:"p",href:"workload#configure-containers"},"container specifications"),", you can also configure its networking behaviors, including how to expose the application and how it can be accessed. You can specify a ",(0,r.kt)("inlineCode",{parentName:"p"},"network")," module in the ",(0,r.kt)("inlineCode",{parentName:"p"},"accessories")," field in ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," to achieve that."),(0,r.kt)("p",null,"In future versions, this will also include ingress-based routing strategy and DNS configurations."),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"kam")," package and the ",(0,r.kt)("inlineCode",{parentName:"p"},"network")," Kusion Module. For more details on KCL package and module import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport network.network as n\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"kcl.mod")," must contain reference to the network module:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'#...\n\n[dependencies]\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\n\n#...\n')),(0,r.kt)("h2",{id:"private-vs-public-access"},"Private vs Public Access"),(0,r.kt)("p",null,"Private network access means the service can only be access from within the target cluster."),(0,r.kt)("p",null,"Public access is implemented using public load balancers on the cloud. This generally requires a Kubernetes cluster that is running on the cloud with a vendor-specific service controller."),(0,r.kt)("p",null,"Any ports defined default to private access unless explicitly specified."),(0,r.kt)("p",null,"To expose port 80 to be accessed privately:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n }\n}\n')),(0,r.kt)("p",null,"To expose port 80 to be accessed publicly:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n public: True\n }\n ]\n }\n }\n}\n')),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"The CSP (Cloud Service Provider) used to provide load balancers is defined by platform engineers in workspace.")),(0,r.kt)("h2",{id:"mapping-ports"},"Mapping ports"),(0,r.kt)("p",null,"To expose a port ",(0,r.kt)("inlineCode",{parentName:"p"},"80")," that maps to a different port ",(0,r.kt)("inlineCode",{parentName:"p"},"8088")," on the container:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n targetPort: 8088\n }\n ]\n }\n }\n}\n')),(0,r.kt)("h2",{id:"exposing-multiple-ports"},"Exposing multiple ports"),(0,r.kt)("p",null,"You can also expose multiple ports and configure them separately. "),(0,r.kt)("p",null,"To expose port 80 to be accessed publicly, and port 9099 for private access (to be scraped by Prometheus, for example):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n public: True\n }\n n.Port {\n port: 9099\n }\n ]\n }\n }\n}\n')),(0,r.kt)("h2",{id:"choosing-protocol"},"Choosing protocol"),(0,r.kt)("p",null,"To expose a port using the ",(0,r.kt)("inlineCode",{parentName:"p"},"UDP")," protocol:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n targetPort: 8088\n protocol: "UDP"\n }\n ]\n }\n }\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5bd88873.ac783374.js b/assets/js/5bd88873.ac783374.js deleted file mode 100644 index 154db8a1d0d..00000000000 --- a/assets/js/5bd88873.ac783374.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4409],{3905:(e,n,t)=>{t.d(n,{Zo:()=>s,kt:()=>k});var o=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function a(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var l=o.createContext({}),c=function(e){var n=o.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},s=function(e){var n=c(e.components);return o.createElement(l.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},d=o.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),d=c(t),k=r,m=d["".concat(l,".").concat(k)]||d[k]||u[k]||i;return t?o.createElement(m,a(a({ref:n},s),{},{components:t})):o.createElement(m,a({ref:n},s))}));function k(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,a=new Array(i);a[0]=d;var p={};for(var l in n)hasOwnProperty.call(n,l)&&(p[l]=n[l]);p.originalType=e,p.mdxType="string"==typeof e?e:r,a[1]=p;for(var c=2;c{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>p,toc:()=>c});var o=t(87462),r=(t(67294),t(3905));const i={id:"networking"},a="Application Networking",p={unversionedId:"configuration-walkthrough/networking",id:"version-v0.11/configuration-walkthrough/networking",title:"Application Networking",description:"In addition to configuring application's container specifications, you can also configure its networking behaviors, including how to expose the application and how it can be accessed. You can specify a network module in the accessories field in AppConfiguration to achieve that.",source:"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/5-networking.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/networking",permalink:"/docs/configuration-walkthrough/networking",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/5-networking.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:5,frontMatter:{id:"networking"},sidebar:"kusion",previous:{title:"Workload",permalink:"/docs/configuration-walkthrough/workload"},next:{title:"Managed Databases",permalink:"/docs/configuration-walkthrough/databse"}},l={},c=[{value:"Import",id:"import",level:2},{value:"Private vs Public Access",id:"private-vs-public-access",level:2},{value:"Mapping ports",id:"mapping-ports",level:2},{value:"Exposing multiple ports",id:"exposing-multiple-ports",level:2},{value:"Choosing protocol",id:"choosing-protocol",level:2}],s={toc:c};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,o.Z)({},s,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"application-networking"},"Application Networking"),(0,r.kt)("p",null,"In addition to configuring application's ",(0,r.kt)("a",{parentName:"p",href:"workload#configure-containers"},"container specifications"),", you can also configure its networking behaviors, including how to expose the application and how it can be accessed. You can specify a ",(0,r.kt)("inlineCode",{parentName:"p"},"network")," module in the ",(0,r.kt)("inlineCode",{parentName:"p"},"accessories")," field in ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," to achieve that."),(0,r.kt)("p",null,"In future versions, this will also include ingress-based routing strategy and DNS configurations."),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"kam")," package and the ",(0,r.kt)("inlineCode",{parentName:"p"},"network")," Kusion Module. For more details on KCL package and module import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport network.network as n\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"kcl.mod")," must contain reference to the network module:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'#...\n\n[dependencies]\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\n\n#...\n')),(0,r.kt)("h2",{id:"private-vs-public-access"},"Private vs Public Access"),(0,r.kt)("p",null,"Private network access means the service can only be access from within the target cluster."),(0,r.kt)("p",null,"Public access is implemented using public load balancers on the cloud. This generally requires a Kubernetes cluster that is running on the cloud with a vendor-specific service controller."),(0,r.kt)("p",null,"Any ports defined default to private access unless explicitly specified."),(0,r.kt)("p",null,"To expose port 80 to be accessed privately:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n }\n}\n')),(0,r.kt)("p",null,"To expose port 80 to be accessed publicly:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n public: True\n }\n ]\n }\n }\n}\n')),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"The CSP (Cloud Service Provider) used to provide load balancers is defined by platform engineers in workspace.")),(0,r.kt)("h2",{id:"mapping-ports"},"Mapping ports"),(0,r.kt)("p",null,"To expose a port ",(0,r.kt)("inlineCode",{parentName:"p"},"80")," that maps to a different port ",(0,r.kt)("inlineCode",{parentName:"p"},"8088")," on the container:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n targetPort: 8088\n }\n ]\n }\n }\n}\n')),(0,r.kt)("h2",{id:"exposing-multiple-ports"},"Exposing multiple ports"),(0,r.kt)("p",null,"You can also expose multiple ports and configure them separately. "),(0,r.kt)("p",null,"To expose port 80 to be accessed publicly, and port 9099 for private access (to be scraped by Prometheus, for example):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n public: True\n }\n n.Port {\n port: 9099\n }\n ]\n }\n }\n}\n')),(0,r.kt)("h2",{id:"choosing-protocol"},"Choosing protocol"),(0,r.kt)("p",null,"To expose a port using the ",(0,r.kt)("inlineCode",{parentName:"p"},"UDP")," protocol:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n targetPort: 8088\n protocol: "UDP"\n }\n ]\n }\n }\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5cbd74ee.15b2e02b.js b/assets/js/5cbd74ee.15b2e02b.js new file mode 100644 index 00000000000..078e76a9a0c --- /dev/null +++ b/assets/js/5cbd74ee.15b2e02b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2106],{3905:(e,t,o)=>{o.d(t,{Zo:()=>c,kt:()=>h});var n=o(67294);function i(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function a(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function r(e){for(var t=1;t=0||(i[o]=e[o]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(i[o]=e[o])}return i}var l=n.createContext({}),p=function(e){var t=n.useContext(l),o=t;return e&&(o="function"==typeof e?e(t):r(r({},t),e)),o},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var o=e.components,i=e.mdxType,a=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(o),h=i,m=d["".concat(l,".").concat(h)]||d[h]||u[h]||a;return o?n.createElement(m,r(r({ref:t},c),{},{components:o})):n.createElement(m,r({ref:t},c))}));function h(e,t){var o=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=o.length,r=new Array(a);r[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,r[1]=s;for(var p=2;p{o.r(t),o.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=o(87462),i=(o(67294),o(3905));const a={id:"overview",title:"Overview",slug:"/"},r="Overview",s={unversionedId:"what-is-kusion/overview",id:"version-v0.10/what-is-kusion/overview",title:"Overview",description:"Welcome to Kusion! This introduction section covers what Kusion is, the problem Kusion aims to solve, and how Kusion compares to other software. If you just want to dive into using Kusion, feel free to skip ahead to the Getting Started section.",source:"@site/docs_versioned_docs/version-v0.10/1-what-is-kusion/1-overview.md",sourceDirName:"1-what-is-kusion",slug:"/",permalink:"/docs/v0.10/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/1-what-is-kusion/1-overview.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"overview",title:"Overview",slug:"/"},sidebar:"kusion",next:{title:"Kusion vs Other Software",permalink:"/docs/v0.10/what-is-kusion/kusion-vs-x"}},l={},p=[{value:"What is Kusion?",id:"what-is-kusion",level:2},{value:"Why Kusion?",id:"why-kusion",level:2},{value:"Kusion Highlights",id:"kusion-highlights",level:2}],c={toc:p};function u(e){let{components:t,...o}=e;return(0,i.kt)("wrapper",(0,n.Z)({},c,o,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"overview"},"Overview"),(0,i.kt)("p",null,"Welcome to Kusion! This introduction section covers what Kusion is, the problem Kusion aims to solve, and how Kusion compares to other software. If you just want to dive into using Kusion, feel free to skip ahead to the ",(0,i.kt)("a",{parentName:"p",href:"getting-started/install-kusion"},"Getting Started")," section."),(0,i.kt)("h2",{id:"what-is-kusion"},"What is Kusion?"),(0,i.kt)("p",null,"Kusion is a modern application delivery and management toolchain that enables developers to specify desired intent in a declarative way and then using a consistent workflow to drive continuous deployment through application lifecycle. Inspired by the phrase ",(0,i.kt)("strong",{parentName:"p"},"Fusion on Kubernetes"),", Kusion aims to help application and platform developers to develop and deliver in a self-serviceable, fast, reliable, and collaborative way."),(0,i.kt)("p",null,(0,i.kt)("img",{parentName:"p",src:"https://raw.githubusercontent.com/KusionStack/kusion/main/docs/workflow.png",alt:"arch"})),(0,i.kt)("h2",{id:"why-kusion"},"Why Kusion?"),(0,i.kt)("p",null,"Developers should be able to deploy and run their applications and services end to end. ",(0,i.kt)("strong",{parentName:"p"},'"You build it, you run it", the original promise of DevOps.')),(0,i.kt)("p",null,"But the modern day for most software organizations this promise quickly become unrelalistic since the increasingly complex cloud-native toolchains, while cloud native technologies made huge improvements in areas such as scalability, availability and operability, it also brings downside - the growing burden on developers, which leads to the rise of ",(0,i.kt)("a",{parentName:"p",href:"https://platformengineering.org/"},"Platform Engineering"),"."),(0,i.kt)("p",null,"Another challenge we saw is that a series of ",(0,i.kt)("a",{parentName:"p",href:"https://web.devopstopologies.com/#anti-types"},"antipatterns")," emerge when regular software organizations tries to implement true DevOps. Without well proven reference architecture and supporting tools, it's much more difficult to accomplish the original promise."),(0,i.kt)("p",null,"On one hand, ",(0,i.kt)("strong",{parentName:"p"},"Kusion was build to minimize developer's cognitive load"),". With application-centric configuration model, you don't need to deal with tedious infrastructure and configuration management tooling, all you need to be familiar with is ",(0,i.kt)("a",{parentName:"p",href:"configuration-walkthrough/overview"},"AppConfigation"),". This approach shields developers from the configurational complexity of Kubernetes but still enable standardization by design."),(0,i.kt)("p",null,"On the other hand, ",(0,i.kt)("strong",{parentName:"p"},"Kusion defines a new way of how different engineering teams collaboration"),". With the separation of concerns, different roles could focus on their work based on their knowledge and responsibility. Through such a division of labor, the platform team can better manage the differences and complexities of the platform, and app developers could participate in ops work with less cognitive load."),(0,i.kt)("h2",{id:"kusion-highlights"},"Kusion Highlights"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Platform as Code")),(0,i.kt)("p",{parentName:"li"},"Specify desired application intent through declarative configuration code, drive continuous deployment with any CI/CD systems or GitOps to match that intent. No ad-hoc scripts, no hard maintain custom workflows, just declarative configuration code.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Dynamic Configuration Management")),(0,i.kt)("p",{parentName:"li"},"Enable platform teams to set baseline-templates, control how and where to deploy application workloads and provision accessory resources. While still enabling application developers freedom via workload-centric specification and deployment. ")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Security & Compliance Built In")),(0,i.kt)("p",{parentName:"li"},"Enforce security and infrastructure best practices with out-of-box ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"base models"),", create security and compliance guardrails for any Kusion deploy with third-party Policy as Code tools. All accessory resource secrets are automatically injected into Workloads.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Lightweight and Open Model Ecosystem")),(0,i.kt)("p",{parentName:"li"},"Pure client-side solution ensures good portability and the rich APIs make it easier to integrate and automate. Large growing model ecosystem covers all stages in application lifecycle, with extensive connections to various infrastructure capabilities. "))),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("strong",{parentName:"p"},"Kusion is an early project.")," The end goal of Kusion is to boost ",(0,i.kt)("a",{parentName:"p",href:"https://internaldeveloperplatform.org/"},"Internal Developer Platform")," revolution, and we are iterating on Kusion quickly to strive towards this goal. For any help or feedback, please contact us in ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/community/discussions/categories/meeting"},"Slack")," or ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/issues"},"issues"),".")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5cbd74ee.fba2c4b5.js b/assets/js/5cbd74ee.fba2c4b5.js deleted file mode 100644 index 1e83a5f8a09..00000000000 --- a/assets/js/5cbd74ee.fba2c4b5.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2106],{3905:(e,t,o)=>{o.d(t,{Zo:()=>c,kt:()=>h});var n=o(67294);function i(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function a(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function r(e){for(var t=1;t=0||(i[o]=e[o]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(i[o]=e[o])}return i}var l=n.createContext({}),p=function(e){var t=n.useContext(l),o=t;return e&&(o="function"==typeof e?e(t):r(r({},t),e)),o},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var o=e.components,i=e.mdxType,a=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(o),h=i,m=d["".concat(l,".").concat(h)]||d[h]||u[h]||a;return o?n.createElement(m,r(r({ref:t},c),{},{components:o})):n.createElement(m,r({ref:t},c))}));function h(e,t){var o=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=o.length,r=new Array(a);r[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,r[1]=s;for(var p=2;p{o.r(t),o.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=o(87462),i=(o(67294),o(3905));const a={id:"overview",title:"Overview",slug:"/"},r="Overview",s={unversionedId:"what-is-kusion/overview",id:"version-v0.10/what-is-kusion/overview",title:"Overview",description:"Welcome to Kusion! This introduction section covers what Kusion is, the problem Kusion aims to solve, and how Kusion compares to other software. If you just want to dive into using Kusion, feel free to skip ahead to the Getting Started section.",source:"@site/docs_versioned_docs/version-v0.10/1-what-is-kusion/1-overview.md",sourceDirName:"1-what-is-kusion",slug:"/",permalink:"/docs/v0.10/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/1-what-is-kusion/1-overview.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"overview",title:"Overview",slug:"/"},sidebar:"kusion",next:{title:"Kusion vs Other Software",permalink:"/docs/v0.10/what-is-kusion/kusion-vs-x"}},l={},p=[{value:"What is Kusion?",id:"what-is-kusion",level:2},{value:"Why Kusion?",id:"why-kusion",level:2},{value:"Kusion Highlights",id:"kusion-highlights",level:2}],c={toc:p};function u(e){let{components:t,...o}=e;return(0,i.kt)("wrapper",(0,n.Z)({},c,o,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"overview"},"Overview"),(0,i.kt)("p",null,"Welcome to Kusion! This introduction section covers what Kusion is, the problem Kusion aims to solve, and how Kusion compares to other software. If you just want to dive into using Kusion, feel free to skip ahead to the ",(0,i.kt)("a",{parentName:"p",href:"getting-started/install-kusion"},"Getting Started")," section."),(0,i.kt)("h2",{id:"what-is-kusion"},"What is Kusion?"),(0,i.kt)("p",null,"Kusion is a modern application delivery and management toolchain that enables developers to specify desired intent in a declarative way and then using a consistent workflow to drive continuous deployment through application lifecycle. Inspired by the phrase ",(0,i.kt)("strong",{parentName:"p"},"Fusion on Kubernetes"),", Kusion aims to help application and platform developers to develop and deliver in a self-serviceable, fast, reliable, and collaborative way."),(0,i.kt)("p",null,(0,i.kt)("img",{parentName:"p",src:"https://raw.githubusercontent.com/KusionStack/kusion/main/docs/workflow.png",alt:"arch"})),(0,i.kt)("h2",{id:"why-kusion"},"Why Kusion?"),(0,i.kt)("p",null,"Developers should be able to deploy and run their applications and services end to end. ",(0,i.kt)("strong",{parentName:"p"},'"You build it, you run it", the original promise of DevOps.')),(0,i.kt)("p",null,"But the modern day for most software organizations this promise quickly become unrelalistic since the increasingly complex cloud-native toolchains, while cloud native technologies made huge improvements in areas such as scalability, availability and operability, it also brings downside - the growing burden on developers, which leads to the rise of ",(0,i.kt)("a",{parentName:"p",href:"https://platformengineering.org/"},"Platform Engineering"),"."),(0,i.kt)("p",null,"Another challenge we saw is that a series of ",(0,i.kt)("a",{parentName:"p",href:"https://web.devopstopologies.com/#anti-types"},"antipatterns")," emerge when regular software organizations tries to implement true DevOps. Without well proven reference architecture and supporting tools, it's much more difficult to accomplish the original promise."),(0,i.kt)("p",null,"On one hand, ",(0,i.kt)("strong",{parentName:"p"},"Kusion was build to minimize developer's cognitive load"),". With application-centric configuration model, you don't need to deal with tedious infrastructure and configuration management tooling, all you need to be familiar with is ",(0,i.kt)("a",{parentName:"p",href:"configuration-walkthrough/overview"},"AppConfigation"),". This approach shields developers from the configurational complexity of Kubernetes but still enable standardization by design."),(0,i.kt)("p",null,"On the other hand, ",(0,i.kt)("strong",{parentName:"p"},"Kusion defines a new way of how different engineering teams collaboration"),". With the separation of concerns, different roles could focus on their work based on their knowledge and responsibility. Through such a division of labor, the platform team can better manage the differences and complexities of the platform, and app developers could participate in ops work with less cognitive load."),(0,i.kt)("h2",{id:"kusion-highlights"},"Kusion Highlights"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Platform as Code")),(0,i.kt)("p",{parentName:"li"},"Specify desired application intent through declarative configuration code, drive continuous deployment with any CI/CD systems or GitOps to match that intent. No ad-hoc scripts, no hard maintain custom workflows, just declarative configuration code.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Dynamic Configuration Management")),(0,i.kt)("p",{parentName:"li"},"Enable platform teams to set baseline-templates, control how and where to deploy application workloads and provision accessory resources. While still enabling application developers freedom via workload-centric specification and deployment. ")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Security & Compliance Built In")),(0,i.kt)("p",{parentName:"li"},"Enforce security and infrastructure best practices with out-of-box ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"base models"),", create security and compliance guardrails for any Kusion deploy with third-party Policy as Code tools. All accessory resource secrets are automatically injected into Workloads.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Lightweight and Open Model Ecosystem")),(0,i.kt)("p",{parentName:"li"},"Pure client-side solution ensures good portability and the rich APIs make it easier to integrate and automate. Large growing model ecosystem covers all stages in application lifecycle, with extensive connections to various infrastructure capabilities. "))),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("strong",{parentName:"p"},"Kusion is an early project.")," The end goal of Kusion is to boost ",(0,i.kt)("a",{parentName:"p",href:"https://internaldeveloperplatform.org/"},"Internal Developer Platform")," revolution, and we are iterating on Kusion quickly to strive towards this goal. For any help or feedback, please contact us in ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/community/discussions/categories/meeting"},"Slack")," or ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/issues"},"issues"),".")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5d01e53a.0665130a.js b/assets/js/5d01e53a.0665130a.js deleted file mode 100644 index 183d8b7c0da..00000000000 --- a/assets/js/5d01e53a.0665130a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8880],{3905:(e,r,t)=>{t.d(r,{Zo:()=>p,kt:()=>m});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function s(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var l=n.createContext({}),u=function(e){var r=n.useContext(l),t=r;return e&&(t="function"==typeof e?e(r):s(s({},r),e)),t},p=function(e){var r=u(e.components);return n.createElement(l.Provider,{value:r},e.children)},c={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},d=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=u(t),m=o,f=d["".concat(l,".").concat(m)]||d[m]||c[m]||a;return t?n.createElement(f,s(s({ref:r},p),{},{components:t})):n.createElement(f,s({ref:r},p))}));function m(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=t.length,s=new Array(a);s[0]=d;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var u=2;u{t.r(r),t.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>u});var n=t(87462),o=(t(67294),t(3905));const a={},s="Roadmap",i={unversionedId:"reference/roadmap",id:"version-v0.11/reference/roadmap",title:"Roadmap",description:"For a finer-grained view into our roadmap and what is being worked on for a release, please refer to the GitHub Issue Tracker",source:"@site/docs_versioned_docs/version-v0.11/6-reference/3-roadmap.md",sourceDirName:"6-reference",slug:"/reference/roadmap",permalink:"/docs/reference/roadmap",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/3-roadmap.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{},sidebar:"kusion",previous:{title:"Resource Naming Conventions",permalink:"/docs/reference/modules/naming-conventions"},next:{title:"Installation",permalink:"/docs/faq/install-error"}},l={},u=[{value:"Resource Ecosystem",id:"resource-ecosystem",level:2},{value:"App Progressive Rollout",id:"app-progressive-rollout",level:2},{value:"Custom Pipelines",id:"custom-pipelines",level:2},{value:"Runtime Plugin",id:"runtime-plugin",level:2}],p={toc:u};function c(e){let{components:r,...t}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"roadmap"},"Roadmap"),(0,o.kt)("p",null,"For a finer-grained view into our roadmap and what is being worked on for a release, please refer to the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/issues"},"GitHub Issue Tracker")),(0,o.kt)("h2",{id:"resource-ecosystem"},"Resource Ecosystem"),(0,o.kt)("p",null,"We plan to expand the range of resource types that our platform can handle. This includes not only traditional cloud IaaS resources, but also popular cloud-native products such as Prometheus, istio and Argo. By supporting a wider variety of resources, we aim to address the heterogeneous needs of modern applications and allow users to harness the full power of the cloud-native technologies."),(0,o.kt)("h2",{id:"app-progressive-rollout"},"App Progressive Rollout"),(0,o.kt)("p",null,"One of the key challenges in delivering applications at scale is to balance the need for speed with the need for reliability. To help our users achieve this balance, we will introduce progressive rollout strategies, such as canary release, rolling release, and percentage release. These techniques enable users to test new features or versions on a small subset of their users or infrastructure before rolling them out to the entire system. By doing so, users can minimize the risk of downtime or errors caused by untested changes."),(0,o.kt)("h2",{id:"custom-pipelines"},"Custom Pipelines"),(0,o.kt)("p",null,"Thie current workflow of KusionStack is ",(0,o.kt)("inlineCode",{parentName:"p"},"write"),",",(0,o.kt)("inlineCode",{parentName:"p"},"preview")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"apply"),", but to handle more complex deployments we need to empower users to customize the deployment pipelines to fit their specific workflows and requirements. This includes the ability to define custom stages, add or remove steps, and integrate with third-party tools. With customizable pipelines, users can streamline their deployment process, automate repetitive tasks, and satisfy their own needs by themselves."),(0,o.kt)("h2",{id:"runtime-plugin"},"Runtime Plugin"),(0,o.kt)("p",null,"We have already supported IaaS cloud resources and Kubernetes resources, but we need a more flexible mechanism to support a broader range of on-premise infrastructure. By supporting a diverse set of infrastructures, we can help users avoid vendor lock-in, optimize their resource usage, and scale their applications across different regions and geographies."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5d01e53a.e38e21f2.js b/assets/js/5d01e53a.e38e21f2.js new file mode 100644 index 00000000000..613144c3891 --- /dev/null +++ b/assets/js/5d01e53a.e38e21f2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8880],{3905:(e,r,t)=>{t.d(r,{Zo:()=>p,kt:()=>m});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function s(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var l=n.createContext({}),u=function(e){var r=n.useContext(l),t=r;return e&&(t="function"==typeof e?e(r):s(s({},r),e)),t},p=function(e){var r=u(e.components);return n.createElement(l.Provider,{value:r},e.children)},c={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},d=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=u(t),m=o,f=d["".concat(l,".").concat(m)]||d[m]||c[m]||a;return t?n.createElement(f,s(s({ref:r},p),{},{components:t})):n.createElement(f,s({ref:r},p))}));function m(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=t.length,s=new Array(a);s[0]=d;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var u=2;u{t.r(r),t.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>u});var n=t(87462),o=(t(67294),t(3905));const a={},s="Roadmap",i={unversionedId:"reference/roadmap",id:"version-v0.11/reference/roadmap",title:"Roadmap",description:"For a finer-grained view into our roadmap and what is being worked on for a release, please refer to the GitHub Issue Tracker",source:"@site/docs_versioned_docs/version-v0.11/6-reference/3-roadmap.md",sourceDirName:"6-reference",slug:"/reference/roadmap",permalink:"/docs/reference/roadmap",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/3-roadmap.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{},sidebar:"kusion",previous:{title:"Resource Naming Conventions",permalink:"/docs/reference/modules/naming-conventions"},next:{title:"Installation",permalink:"/docs/faq/install-error"}},l={},u=[{value:"Resource Ecosystem",id:"resource-ecosystem",level:2},{value:"App Progressive Rollout",id:"app-progressive-rollout",level:2},{value:"Custom Pipelines",id:"custom-pipelines",level:2},{value:"Runtime Plugin",id:"runtime-plugin",level:2}],p={toc:u};function c(e){let{components:r,...t}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"roadmap"},"Roadmap"),(0,o.kt)("p",null,"For a finer-grained view into our roadmap and what is being worked on for a release, please refer to the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/issues"},"GitHub Issue Tracker")),(0,o.kt)("h2",{id:"resource-ecosystem"},"Resource Ecosystem"),(0,o.kt)("p",null,"We plan to expand the range of resource types that our platform can handle. This includes not only traditional cloud IaaS resources, but also popular cloud-native products such as Prometheus, istio and Argo. By supporting a wider variety of resources, we aim to address the heterogeneous needs of modern applications and allow users to harness the full power of the cloud-native technologies."),(0,o.kt)("h2",{id:"app-progressive-rollout"},"App Progressive Rollout"),(0,o.kt)("p",null,"One of the key challenges in delivering applications at scale is to balance the need for speed with the need for reliability. To help our users achieve this balance, we will introduce progressive rollout strategies, such as canary release, rolling release, and percentage release. These techniques enable users to test new features or versions on a small subset of their users or infrastructure before rolling them out to the entire system. By doing so, users can minimize the risk of downtime or errors caused by untested changes."),(0,o.kt)("h2",{id:"custom-pipelines"},"Custom Pipelines"),(0,o.kt)("p",null,"Thie current workflow of KusionStack is ",(0,o.kt)("inlineCode",{parentName:"p"},"write"),",",(0,o.kt)("inlineCode",{parentName:"p"},"preview")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"apply"),", but to handle more complex deployments we need to empower users to customize the deployment pipelines to fit their specific workflows and requirements. This includes the ability to define custom stages, add or remove steps, and integrate with third-party tools. With customizable pipelines, users can streamline their deployment process, automate repetitive tasks, and satisfy their own needs by themselves."),(0,o.kt)("h2",{id:"runtime-plugin"},"Runtime Plugin"),(0,o.kt)("p",null,"We have already supported IaaS cloud resources and Kubernetes resources, but we need a more flexible mechanism to support a broader range of on-premise infrastructure. By supporting a diverse set of infrastructures, we can help users avoid vendor lock-in, optimize their resource usage, and scale their applications across different regions and geographies."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5d07f957.5de78b3d.js b/assets/js/5d07f957.5de78b3d.js deleted file mode 100644 index 76276291f31..00000000000 --- a/assets/js/5d07f957.5de78b3d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7059],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>u});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),p=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=p(e.components);return a.createElement(d.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,d=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),m=p(n),u=r,k=m["".concat(d,".").concat(u)]||m[u]||c[u]||l;return n?a.createElement(k,i(i({ref:t},s),{},{components:n})):a.createElement(k,i({ref:t},s))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,i=new Array(l);i[0]=m;var o={};for(var d in t)hasOwnProperty.call(t,d)&&(o[d]=t[d]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>c,frontMatter:()=>l,metadata:()=>o,toc:()=>p});var a=n(87462),r=(n(67294),n(3905));const l={},i="container",o={unversionedId:"reference/model/catalog_models/internal/container/doc_container",id:"version-v0.9/reference/model/catalog_models/internal/container/doc_container",title:"container",description:"Schema Container",source:"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/container/doc_container.md",sourceDirName:"reference/model/catalog_models/internal/container",slug:"/reference/model/catalog_models/internal/container/doc_container",permalink:"/docs/v0.9/reference/model/catalog_models/internal/container/doc_container",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/container/doc_container.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"opsrule",permalink:"/docs/v0.9/reference/model/catalog_models/trait/doc_opsrule"},next:{title:"lifecycle",permalink:"/docs/v0.9/reference/model/catalog_models/internal/container/lifecycle/doc_lifecycle"}},d={},p=[{value:"Schema Container",id:"schema-container",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Schema FileSpec",id:"schema-filespec",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3}],s={toc:p};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"container"},"container"),(0,r.kt)("h2",{id:"schema-container"},"Schema Container"),(0,r.kt)("p",null,"Container describes how the Application's tasks are expected to be run. Depending on",(0,r.kt)("br",null),"the replicas parameter 1 or more containers can be created from each template."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"image"),(0,r.kt)("br",null),"Image refers to the Docker image name to run for this container.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/images"},"https://kubernetes.io/docs/concepts/containers/images")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command"),(0,r.kt)("br",null),"Entrypoint array. Not executed within a shell.",(0,r.kt)("br",null),"Command will overwrite the ENTRYPOINT value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's ENTRYPOINT is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"args"),(0,r.kt)("br",null),"Arguments to the entrypoint.",(0,r.kt)("br",null),"Args will overwrite the CMD value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's CMD is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"env"),(0,r.kt)("br",null),"List of environment variables to set in the container.",(0,r.kt)("br",null),"The value of the environment variable may be static text or a value from a secret."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"workingDir"),(0,r.kt)("br",null),"The working directory of the running process defined in entrypoint.",(0,r.kt)("br",null),"Default container runtime will be used if this is not specified."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"resources"),(0,r.kt)("br",null),"Map of resource requirements the container should run with.",(0,r.kt)("br",null),"The resources parameter is a dict with the key being the resource name and the value being",(0,r.kt)("br",null),"the resource value."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"files"),(0,r.kt)("br",null),"List of files to create in the container.",(0,r.kt)("br",null),"The files parameter is a dict with the key being the file name in the container and the value",(0,r.kt)("br",null),"being the target file specification."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-filespec"},"container.FileSpec"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"dirs"),(0,r.kt)("br",null),"Collection of volumes mount into the container's filesystem.",(0,r.kt)("br",null),"The dirs parameter is a dict with the key being the folder name in the container and the value",(0,r.kt)("br",null),"being the referenced volume."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"livenessProbe"),(0,r.kt)("br",null),"LivenessProbe indicates if a running process is healthy.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"probe/doc_probe#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"readinessProbe"),(0,r.kt)("br",null),"ReadinessProbe indicates whether an application is available to handle requests."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"probe/doc_probe#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"startupProbe"),(0,r.kt)("br",null),"StartupProbe indicates that the container has started for the first time.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"probe/doc_probe#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"lifecycle"),(0,r.kt)("br",null),"Lifecycle refers to actions that the management system should take in response to container lifecycle events."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"lifecycle/doc_lifecycle#schema-lifecycle"},"lc.Lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container as c\n\nweb = c.Container {\n image: "nginx:latest"\n command: ["/bin/sh", "-c", "echo hi"]\n env: {\n "name": "value"\n }\n resources: {\n "cpu": "2"\n "memory": "4Gi"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-filespec"},"Schema FileSpec"),(0,r.kt)("p",null,"FileSpec defines the target file in a Container."),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"content"),(0,r.kt)("br",null),"File content in plain text."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"contentFrom"),(0,r.kt)("br",null),"Source for the file content, reference to a secret of configmap value."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"mode"),(0,r.kt)("br",null),"Mode bits used to set permissions on this file, must be an octal value",(0,r.kt)("br",null),"between 0000 and 0777 or a decimal value between 0 and 511"),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container as c\n\ntmpFile = c.FileSpec {\n content: "some file contents"\n mode: "0777"\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5d07f957.9a2b83a9.js b/assets/js/5d07f957.9a2b83a9.js new file mode 100644 index 00000000000..61a2a78f78c --- /dev/null +++ b/assets/js/5d07f957.9a2b83a9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7059],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>u});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),p=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=p(e.components);return a.createElement(d.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,d=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),m=p(n),u=r,k=m["".concat(d,".").concat(u)]||m[u]||c[u]||l;return n?a.createElement(k,i(i({ref:t},s),{},{components:n})):a.createElement(k,i({ref:t},s))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,i=new Array(l);i[0]=m;var o={};for(var d in t)hasOwnProperty.call(t,d)&&(o[d]=t[d]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>c,frontMatter:()=>l,metadata:()=>o,toc:()=>p});var a=n(87462),r=(n(67294),n(3905));const l={},i="container",o={unversionedId:"reference/model/catalog_models/internal/container/doc_container",id:"version-v0.9/reference/model/catalog_models/internal/container/doc_container",title:"container",description:"Schema Container",source:"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/container/doc_container.md",sourceDirName:"reference/model/catalog_models/internal/container",slug:"/reference/model/catalog_models/internal/container/doc_container",permalink:"/docs/v0.9/reference/model/catalog_models/internal/container/doc_container",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/container/doc_container.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"opsrule",permalink:"/docs/v0.9/reference/model/catalog_models/trait/doc_opsrule"},next:{title:"lifecycle",permalink:"/docs/v0.9/reference/model/catalog_models/internal/container/lifecycle/doc_lifecycle"}},d={},p=[{value:"Schema Container",id:"schema-container",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Schema FileSpec",id:"schema-filespec",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3}],s={toc:p};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"container"},"container"),(0,r.kt)("h2",{id:"schema-container"},"Schema Container"),(0,r.kt)("p",null,"Container describes how the Application's tasks are expected to be run. Depending on",(0,r.kt)("br",null),"the replicas parameter 1 or more containers can be created from each template."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"image"),(0,r.kt)("br",null),"Image refers to the Docker image name to run for this container.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/images"},"https://kubernetes.io/docs/concepts/containers/images")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command"),(0,r.kt)("br",null),"Entrypoint array. Not executed within a shell.",(0,r.kt)("br",null),"Command will overwrite the ENTRYPOINT value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's ENTRYPOINT is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"args"),(0,r.kt)("br",null),"Arguments to the entrypoint.",(0,r.kt)("br",null),"Args will overwrite the CMD value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's CMD is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"env"),(0,r.kt)("br",null),"List of environment variables to set in the container.",(0,r.kt)("br",null),"The value of the environment variable may be static text or a value from a secret."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"workingDir"),(0,r.kt)("br",null),"The working directory of the running process defined in entrypoint.",(0,r.kt)("br",null),"Default container runtime will be used if this is not specified."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"resources"),(0,r.kt)("br",null),"Map of resource requirements the container should run with.",(0,r.kt)("br",null),"The resources parameter is a dict with the key being the resource name and the value being",(0,r.kt)("br",null),"the resource value."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"files"),(0,r.kt)("br",null),"List of files to create in the container.",(0,r.kt)("br",null),"The files parameter is a dict with the key being the file name in the container and the value",(0,r.kt)("br",null),"being the target file specification."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-filespec"},"container.FileSpec"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"dirs"),(0,r.kt)("br",null),"Collection of volumes mount into the container's filesystem.",(0,r.kt)("br",null),"The dirs parameter is a dict with the key being the folder name in the container and the value",(0,r.kt)("br",null),"being the referenced volume."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"livenessProbe"),(0,r.kt)("br",null),"LivenessProbe indicates if a running process is healthy.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"probe/doc_probe#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"readinessProbe"),(0,r.kt)("br",null),"ReadinessProbe indicates whether an application is available to handle requests."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"probe/doc_probe#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"startupProbe"),(0,r.kt)("br",null),"StartupProbe indicates that the container has started for the first time.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"probe/doc_probe#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"lifecycle"),(0,r.kt)("br",null),"Lifecycle refers to actions that the management system should take in response to container lifecycle events."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"lifecycle/doc_lifecycle#schema-lifecycle"},"lc.Lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container as c\n\nweb = c.Container {\n image: "nginx:latest"\n command: ["/bin/sh", "-c", "echo hi"]\n env: {\n "name": "value"\n }\n resources: {\n "cpu": "2"\n "memory": "4Gi"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-filespec"},"Schema FileSpec"),(0,r.kt)("p",null,"FileSpec defines the target file in a Container."),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"content"),(0,r.kt)("br",null),"File content in plain text."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"contentFrom"),(0,r.kt)("br",null),"Source for the file content, reference to a secret of configmap value."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"mode"),(0,r.kt)("br",null),"Mode bits used to set permissions on this file, must be an octal value",(0,r.kt)("br",null),"between 0000 and 0777 or a decimal value between 0 and 511"),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container as c\n\ntmpFile = c.FileSpec {\n content: "some file contents"\n mode: "0777"\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5d5d02b0.46d9fecf.js b/assets/js/5d5d02b0.46d9fecf.js new file mode 100644 index 00000000000..dcafe2c892f --- /dev/null +++ b/assets/js/5d5d02b0.46d9fecf.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[664],{3905:(e,t,o)=>{o.d(t,{Zo:()=>u,kt:()=>h});var n=o(67294);function r(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function i(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function a(e){for(var t=1;t=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}var p=n.createContext({}),l=function(e){var t=n.useContext(p),o=t;return e&&(o="function"==typeof e?e(t):a(a({},t),e)),o},u=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var o=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),m=l(o),h=r,d=m["".concat(p,".").concat(h)]||m[h]||c[h]||i;return o?n.createElement(d,a(a({ref:t},u),{},{components:o})):n.createElement(d,a({ref:t},u))}));function h(e,t){var o=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=o.length,a=new Array(i);a[0]=m;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:r,a[1]=s;for(var l=2;l{o.r(t),o.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>c,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var n=o(87462),r=(o(67294),o(3905));const i={},a="Configure Monitoring Behavior With Prometheus",s={unversionedId:"guides/observability/prometheus",id:"version-v0.9/guides/observability/prometheus",title:"Configure Monitoring Behavior With Prometheus",description:"This document provides the step-by-step instruction to set up monitoring for your application.",source:"@site/docs_versioned_docs/version-v0.9/guides/observability/prometheus.md",sourceDirName:"guides/observability",slug:"/guides/observability/prometheus",permalink:"/docs/v0.9/guides/observability/prometheus",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/guides/observability/prometheus.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Configure Resource Specification",permalink:"/docs/v0.9/guides/working-with-k8s/resource-spec"},next:{title:"Deploy Application Securely and Efficiently via GitHub Actions",permalink:"/docs/v0.9/guides/github-actions/deploy-application-securely-and-efficiently-via-github-actions"}},p={},l=[{value:"Pre-requisite",id:"pre-requisite",level:2},{value:"Setting up your own Prometheus",id:"setting-up-your-own-prometheus",level:2},{value:"Installing Prometheus operator3.",id:"installing-prometheus-operator3",level:3},{value:"Make sure RBAC is properly set up",id:"make-sure-rbac-is-properly-set-up",level:3},{value:"Configure Prometheus instance via the operator",id:"configure-prometheus-instance-via-the-operator",level:3},{value:"Exposing the Prometheus portal (optional)",id:"exposing-the-prometheus-portal-optional",level:3},{value:"Using kusion to deploy your application with monitoring requirements",id:"using-kusion-to-deploy-your-application-with-monitoring-requirements",level:2},{value:"References",id:"references",level:2}],u={toc:l};function c(e){let{components:t,...i}=e;return(0,r.kt)("wrapper",(0,n.Z)({},u,i,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"configure-monitoring-behavior-with-prometheus"},"Configure Monitoring Behavior With Prometheus"),(0,r.kt)("p",null,"This document provides the step-by-step instruction to set up monitoring for your application. "),(0,r.kt)("p",null,"As of today, kusion supports the configuration of Prometheus scraping behaviors for the target application. In the future, we will add more cloud-provider-native solutions, such as AWS CloudWatch, Azure Monitor, etc."),(0,r.kt)("p",null,"The demo sample is mainly composed of the following components:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Namespace"),(0,r.kt)("li",{parentName:"ul"},"Deployment"),(0,r.kt)("li",{parentName:"ul"},"Service"),(0,r.kt)("li",{parentName:"ul"},"ServiceMonitor")),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"This guide requires you to have a basic understanding of Kubernetes and Prometheus.\nIf you are not familiar with the relevant concepts, please refer to the links below:"),(0,r.kt)("ul",{parentName:"admonition"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/tutorials/kubernetes-basics/"},"Learn Kubernetes Basics")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://prometheus.io/docs/introduction/overview/"},"Prometheus Introduction")))),(0,r.kt)("h2",{id:"pre-requisite"},"Pre-requisite"),(0,r.kt)("p",null,"Please refer to the ",(0,r.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,r.kt)("p",null,"The example below also requires you to have ",(0,r.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#initializing"},"initialized the project")," using the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will generate a ",(0,r.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#kclmod"},(0,r.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the project directory."),(0,r.kt)("h2",{id:"setting-up-your-own-prometheus"},"Setting up your own Prometheus"),(0,r.kt)("p",null,"There a quite a few ways to set up Prometheus in your cluster:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Installing a Prometheus operator"),(0,r.kt)("li",{parentName:"ol"},"Installing a standalone Prometheus server"),(0,r.kt)("li",{parentName:"ol"},"Installing a Prometheus agent and connect to a remote Prometheus server")),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator/issues/1547#issuecomment-401092041"},"The advice from the Prometheus team")," is to use the ",(0,r.kt)("inlineCode",{parentName:"p"},"ServiceMonitor")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"PodMonitor")," CRs via the Prometheus operator to manage scrape configs going forward",(0,r.kt)("sup",null,"[2]"),"."),(0,r.kt)("p",null,"In either case, you only have to do this setup once per cluster. This doc will use a minikube cluster and Prometheus operator as an example."),(0,r.kt)("h3",{id:"installing-prometheus-operator3"},"Installing Prometheus operator",(0,r.kt)("sup",null,"[3]"),"."),(0,r.kt)("p",null,"To get the example in this user guide working, all you need is a running Prometheus operator. You can have that installed by running:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"LATEST=$(curl -s https://api.github.com/repos/prometheus-operator/prometheus-operator/releases/latest | jq -cr .tag_name)\ncurl -sL https://github.com/prometheus-operator/prometheus-operator/releases/download/${LATEST}/bundle.yaml | kubectl create -f -\n")),(0,r.kt)("p",null,"This will install all the necessary CRDs and the Prometheus operator itself in the default namespace. Wait a few minutes, you can confirm the operator is up by running: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kubectl wait --for=condition=Ready pods -l app.kubernetes.io/name=prometheus-operator -n default\n")),(0,r.kt)("h3",{id:"make-sure-rbac-is-properly-set-up"},"Make sure RBAC is properly set up"),(0,r.kt)("p",null,"If you have RBAC enabled on the cluster, the following must be created for Prometheus to work properly:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'apiVersion: v1\nkind: ServiceAccount\nmetadata:\n name: prometheus\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n name: prometheus\nrules:\n- apiGroups: [""]\n resources:\n - nodes\n - nodes/metrics\n - services\n - endpoints\n - pods\n verbs: ["get", "list", "watch"]\n- apiGroups: [""]\n resources:\n - configmaps\n verbs: ["get"]\n- apiGroups:\n - networking.k8s.io\n resources:\n - ingresses\n verbs: ["get", "list", "watch"]\n- nonResourceURLs: ["/metrics"]\n verbs: ["get"]\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n name: prometheus\nroleRef:\n apiGroup: rbac.authorization.k8s.io\n kind: ClusterRole\n name: prometheus\nsubjects:\n- kind: ServiceAccount\n name: prometheus\n namespace: default\n')),(0,r.kt)("h3",{id:"configure-prometheus-instance-via-the-operator"},"Configure Prometheus instance via the operator"),(0,r.kt)("p",null,"Once all of the above is set up, you can then configure the Prometheus instance via the operator:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"apiVersion: monitoring.coreos.com/v1\nkind: Prometheus\nmetadata:\n name: prometheus\nspec:\n serviceAccountName: prometheus\n serviceMonitorNamespaceSelector: {}\n serviceMonitorSelector: {}\n podMonitorNamespaceSelector: {}\n podMonitorSelector: {}\n resources:\n requests:\n memory: 400Mi\n")),(0,r.kt)("p",null,"This Prometheus instance above will be cluster-wide, picking up ALL the service monitors and pod monitors across ALL the namespaces.\nYou can adjust the requests and limits accordingly if you have a larger cluster."),(0,r.kt)("h3",{id:"exposing-the-prometheus-portal-optional"},"Exposing the Prometheus portal (optional)"),(0,r.kt)("p",null,"Once you have the managed Prometheus instance created via the Prometheus CR above, you should be able to see a service created called ",(0,r.kt)("inlineCode",{parentName:"p"},"prometheus-operated"),":"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"prometheus-operated",src:o(91512).Z,width:"631",height:"52"})),(0,r.kt)("p",null,"If you are also running on minikube, you can expose it onto your localhost via kubectl:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kubectl port-forward svc/prometheus-operated 9099:9090\n")),(0,r.kt)("p",null,"You should then be able to see the Prometheus portal via ",(0,r.kt)("inlineCode",{parentName:"p"},"localhost:9099")," in your browser:"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"prometheus-portal",src:o(35443).Z,width:"2878",height:"1096"})),(0,r.kt)("p",null,"If you are running a non-local cluster, you can try to expose it via another way, through an ingress controller for example."),(0,r.kt)("h2",{id:"using-kusion-to-deploy-your-application-with-monitoring-requirements"},"Using kusion to deploy your application with monitoring requirements"),(0,r.kt)("p",null,"At this point we are set up for good! Any new applications you deploy via kusion will now automatically have the monitoring-related resources created, should you declare you want it via the ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," field in the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model."),(0,r.kt)("p",null,"The monitoring in an AppConfiguration is declared in the ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," field. See the example below for a full, deployable AppConfiguration."),(0,r.kt)("p",null,"Please note we are using a new image ",(0,r.kt)("inlineCode",{parentName:"p"},"quay.io/brancz/prometheus-example-app")," since the app itself need to expose metrics for Prometheus to scrape:"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"helloworld/dev/main.k"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.monitoring as m\nimport catalog.models.schema.v1.workload.network as n\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "monitoring-sample-app": c.Container {\n image: "quay.io/brancz/prometheus-example-app:v0.3.0"\n }\n }\n ports: [\n n.Port {\n port: 8080\n }\n ]\n }\n monitoring: m.Prometheus{\n interval: "30s"\n timeout: "15s"\n path: "/metrics"\n scheme: "http"\n }\n}\n')),(0,r.kt)("p",null,"The KCL file above represents an application with a service type workload, exposing the port 8080, and would like Prometheus to scrape the ",(0,r.kt)("inlineCode",{parentName:"p"},"/metrics")," endpoint every 30 seconds."),(0,r.kt)("p",null,"Running ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion apply")," would show that kusion will create a ",(0,r.kt)("inlineCode",{parentName:"p"},"Namespace"),", a ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployment"),", a ",(0,r.kt)("inlineCode",{parentName:"p"},"Service")," and a ",(0,r.kt)("inlineCode",{parentName:"p"},"ServiceMonitor"),":\n",(0,r.kt)("img",{alt:"kusion-apply-with-monitor",src:o(448).Z,width:"705",height:"224"})),(0,r.kt)("p",null,"Continue applying all resources:\n",(0,r.kt)("img",{alt:"kusion-apply-success",src:o(56816).Z,width:"1047",height:"564"})),(0,r.kt)("p",null,"If we want to, we can verify the service monitor has been created successfully:\n",(0,r.kt)("img",{alt:"service-monitor",src:o(58232).Z,width:"693",height:"463"})),(0,r.kt)("p",null,"In a few seconds, you should be able to see in the Prometheus portal that the service we just deployed has now been discovered and monitored by Prometheus:\n",(0,r.kt)("img",{alt:"prometheus-targets",src:o(87594).Z,width:"2880",height:"1636"})),(0,r.kt)("p",null,"You can run a few simply queries for the data that Prometheus scraped from your application:\n",(0,r.kt)("img",{alt:"prometheus-simple-query",src:o(87695).Z,width:"2880",height:"1634"})),(0,r.kt)("p",null,"For more info about PromQL, you can find them ",(0,r.kt)("a",{parentName:"p",href:"https://prometheus.io/docs/prometheus/latest/querying/basics/"},"here"),(0,r.kt)("sup",null,"[4]"),"."),(0,r.kt)("h2",{id:"references"},"References"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Prometheus: ",(0,r.kt)("a",{parentName:"li",href:"https://prometheus.io/docs/introduction/overview/"},"https://prometheus.io/docs/introduction/overview/")),(0,r.kt)("li",{parentName:"ol"},"Prometheus team advise: ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/prometheus-operator/prometheus-operator/issues/1547#issuecomment-446691500"},"https://github.com/prometheus-operator/prometheus-operator/issues/1547#issuecomment-446691500")),(0,r.kt)("li",{parentName:"ol"},"Prometheus operator getting started doc: ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md"},"https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md")),(0,r.kt)("li",{parentName:"ol"},"PromQL basics: ",(0,r.kt)("a",{parentName:"li",href:"https://prometheus.io/docs/prometheus/latest/querying/basics/"},"https://prometheus.io/docs/prometheus/latest/querying/basics/"))))}c.isMDXComponent=!0},56816:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/kusion-apply-success-52d04db670fd184959c3ea5c9e54f69d.png"},448:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/kusion-apply-with-monitor-d27cd1443e1a324d514983d52c055b15.png"},91512:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-operated-4cf8308703e4ec9d06a5078bbceb8d5d.png"},35443:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-portal-b60d8654c309e675fc04f1e74c5c127a.png"},87695:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-simple-query-60205589e762105ebc850e70d8ea7b56.png"},87594:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-targets-05964bad58af16f2e02c57cafa8565e7.png"},58232:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/service-monitor-2374625bfd1180a978a2be50ad4648ce.png"}}]); \ No newline at end of file diff --git a/assets/js/5d5d02b0.8dbc39cf.js b/assets/js/5d5d02b0.8dbc39cf.js deleted file mode 100644 index 7bfa543e176..00000000000 --- a/assets/js/5d5d02b0.8dbc39cf.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[664],{3905:(e,t,o)=>{o.d(t,{Zo:()=>u,kt:()=>h});var n=o(67294);function r(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function i(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function a(e){for(var t=1;t=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}var p=n.createContext({}),l=function(e){var t=n.useContext(p),o=t;return e&&(o="function"==typeof e?e(t):a(a({},t),e)),o},u=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var o=e.components,r=e.mdxType,i=e.originalType,p=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),m=l(o),h=r,d=m["".concat(p,".").concat(h)]||m[h]||c[h]||i;return o?n.createElement(d,a(a({ref:t},u),{},{components:o})):n.createElement(d,a({ref:t},u))}));function h(e,t){var o=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=o.length,a=new Array(i);a[0]=m;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:r,a[1]=s;for(var l=2;l{o.r(t),o.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>c,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var n=o(87462),r=(o(67294),o(3905));const i={},a="Configure Monitoring Behavior With Prometheus",s={unversionedId:"guides/observability/prometheus",id:"version-v0.9/guides/observability/prometheus",title:"Configure Monitoring Behavior With Prometheus",description:"This document provides the step-by-step instruction to set up monitoring for your application.",source:"@site/docs_versioned_docs/version-v0.9/guides/observability/prometheus.md",sourceDirName:"guides/observability",slug:"/guides/observability/prometheus",permalink:"/docs/v0.9/guides/observability/prometheus",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/guides/observability/prometheus.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Configure Resource Specification",permalink:"/docs/v0.9/guides/working-with-k8s/resource-spec"},next:{title:"Deploy Application Securely and Efficiently via GitHub Actions",permalink:"/docs/v0.9/guides/github-actions/deploy-application-securely-and-efficiently-via-github-actions"}},p={},l=[{value:"Pre-requisite",id:"pre-requisite",level:2},{value:"Setting up your own Prometheus",id:"setting-up-your-own-prometheus",level:2},{value:"Installing Prometheus operator3.",id:"installing-prometheus-operator3",level:3},{value:"Make sure RBAC is properly set up",id:"make-sure-rbac-is-properly-set-up",level:3},{value:"Configure Prometheus instance via the operator",id:"configure-prometheus-instance-via-the-operator",level:3},{value:"Exposing the Prometheus portal (optional)",id:"exposing-the-prometheus-portal-optional",level:3},{value:"Using kusion to deploy your application with monitoring requirements",id:"using-kusion-to-deploy-your-application-with-monitoring-requirements",level:2},{value:"References",id:"references",level:2}],u={toc:l};function c(e){let{components:t,...i}=e;return(0,r.kt)("wrapper",(0,n.Z)({},u,i,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"configure-monitoring-behavior-with-prometheus"},"Configure Monitoring Behavior With Prometheus"),(0,r.kt)("p",null,"This document provides the step-by-step instruction to set up monitoring for your application. "),(0,r.kt)("p",null,"As of today, kusion supports the configuration of Prometheus scraping behaviors for the target application. In the future, we will add more cloud-provider-native solutions, such as AWS CloudWatch, Azure Monitor, etc."),(0,r.kt)("p",null,"The demo sample is mainly composed of the following components:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Namespace"),(0,r.kt)("li",{parentName:"ul"},"Deployment"),(0,r.kt)("li",{parentName:"ul"},"Service"),(0,r.kt)("li",{parentName:"ul"},"ServiceMonitor")),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"This guide requires you to have a basic understanding of Kubernetes and Prometheus.\nIf you are not familiar with the relevant concepts, please refer to the links below:"),(0,r.kt)("ul",{parentName:"admonition"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/tutorials/kubernetes-basics/"},"Learn Kubernetes Basics")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://prometheus.io/docs/introduction/overview/"},"Prometheus Introduction")))),(0,r.kt)("h2",{id:"pre-requisite"},"Pre-requisite"),(0,r.kt)("p",null,"Please refer to the ",(0,r.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,r.kt)("p",null,"The example below also requires you to have ",(0,r.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#initializing"},"initialized the project")," using the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will generate a ",(0,r.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#kclmod"},(0,r.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the project directory."),(0,r.kt)("h2",{id:"setting-up-your-own-prometheus"},"Setting up your own Prometheus"),(0,r.kt)("p",null,"There a quite a few ways to set up Prometheus in your cluster:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Installing a Prometheus operator"),(0,r.kt)("li",{parentName:"ol"},"Installing a standalone Prometheus server"),(0,r.kt)("li",{parentName:"ol"},"Installing a Prometheus agent and connect to a remote Prometheus server")),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator/issues/1547#issuecomment-401092041"},"The advice from the Prometheus team")," is to use the ",(0,r.kt)("inlineCode",{parentName:"p"},"ServiceMonitor")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"PodMonitor")," CRs via the Prometheus operator to manage scrape configs going forward",(0,r.kt)("sup",null,"[2]"),"."),(0,r.kt)("p",null,"In either case, you only have to do this setup once per cluster. This doc will use a minikube cluster and Prometheus operator as an example."),(0,r.kt)("h3",{id:"installing-prometheus-operator3"},"Installing Prometheus operator",(0,r.kt)("sup",null,"[3]"),"."),(0,r.kt)("p",null,"To get the example in this user guide working, all you need is a running Prometheus operator. You can have that installed by running:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"LATEST=$(curl -s https://api.github.com/repos/prometheus-operator/prometheus-operator/releases/latest | jq -cr .tag_name)\ncurl -sL https://github.com/prometheus-operator/prometheus-operator/releases/download/${LATEST}/bundle.yaml | kubectl create -f -\n")),(0,r.kt)("p",null,"This will install all the necessary CRDs and the Prometheus operator itself in the default namespace. Wait a few minutes, you can confirm the operator is up by running: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kubectl wait --for=condition=Ready pods -l app.kubernetes.io/name=prometheus-operator -n default\n")),(0,r.kt)("h3",{id:"make-sure-rbac-is-properly-set-up"},"Make sure RBAC is properly set up"),(0,r.kt)("p",null,"If you have RBAC enabled on the cluster, the following must be created for Prometheus to work properly:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'apiVersion: v1\nkind: ServiceAccount\nmetadata:\n name: prometheus\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n name: prometheus\nrules:\n- apiGroups: [""]\n resources:\n - nodes\n - nodes/metrics\n - services\n - endpoints\n - pods\n verbs: ["get", "list", "watch"]\n- apiGroups: [""]\n resources:\n - configmaps\n verbs: ["get"]\n- apiGroups:\n - networking.k8s.io\n resources:\n - ingresses\n verbs: ["get", "list", "watch"]\n- nonResourceURLs: ["/metrics"]\n verbs: ["get"]\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n name: prometheus\nroleRef:\n apiGroup: rbac.authorization.k8s.io\n kind: ClusterRole\n name: prometheus\nsubjects:\n- kind: ServiceAccount\n name: prometheus\n namespace: default\n')),(0,r.kt)("h3",{id:"configure-prometheus-instance-via-the-operator"},"Configure Prometheus instance via the operator"),(0,r.kt)("p",null,"Once all of the above is set up, you can then configure the Prometheus instance via the operator:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"apiVersion: monitoring.coreos.com/v1\nkind: Prometheus\nmetadata:\n name: prometheus\nspec:\n serviceAccountName: prometheus\n serviceMonitorNamespaceSelector: {}\n serviceMonitorSelector: {}\n podMonitorNamespaceSelector: {}\n podMonitorSelector: {}\n resources:\n requests:\n memory: 400Mi\n")),(0,r.kt)("p",null,"This Prometheus instance above will be cluster-wide, picking up ALL the service monitors and pod monitors across ALL the namespaces.\nYou can adjust the requests and limits accordingly if you have a larger cluster."),(0,r.kt)("h3",{id:"exposing-the-prometheus-portal-optional"},"Exposing the Prometheus portal (optional)"),(0,r.kt)("p",null,"Once you have the managed Prometheus instance created via the Prometheus CR above, you should be able to see a service created called ",(0,r.kt)("inlineCode",{parentName:"p"},"prometheus-operated"),":"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"prometheus-operated",src:o(91512).Z,width:"631",height:"52"})),(0,r.kt)("p",null,"If you are also running on minikube, you can expose it onto your localhost via kubectl:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kubectl port-forward svc/prometheus-operated 9099:9090\n")),(0,r.kt)("p",null,"You should then be able to see the Prometheus portal via ",(0,r.kt)("inlineCode",{parentName:"p"},"localhost:9099")," in your browser:"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"prometheus-portal",src:o(35443).Z,width:"2878",height:"1096"})),(0,r.kt)("p",null,"If you are running a non-local cluster, you can try to expose it via another way, through an ingress controller for example."),(0,r.kt)("h2",{id:"using-kusion-to-deploy-your-application-with-monitoring-requirements"},"Using kusion to deploy your application with monitoring requirements"),(0,r.kt)("p",null,"At this point we are set up for good! Any new applications you deploy via kusion will now automatically have the monitoring-related resources created, should you declare you want it via the ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," field in the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model."),(0,r.kt)("p",null,"The monitoring in an AppConfiguration is declared in the ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," field. See the example below for a full, deployable AppConfiguration."),(0,r.kt)("p",null,"Please note we are using a new image ",(0,r.kt)("inlineCode",{parentName:"p"},"quay.io/brancz/prometheus-example-app")," since the app itself need to expose metrics for Prometheus to scrape:"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"helloworld/dev/main.k"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.monitoring as m\nimport catalog.models.schema.v1.workload.network as n\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "monitoring-sample-app": c.Container {\n image: "quay.io/brancz/prometheus-example-app:v0.3.0"\n }\n }\n ports: [\n n.Port {\n port: 8080\n }\n ]\n }\n monitoring: m.Prometheus{\n interval: "30s"\n timeout: "15s"\n path: "/metrics"\n scheme: "http"\n }\n}\n')),(0,r.kt)("p",null,"The KCL file above represents an application with a service type workload, exposing the port 8080, and would like Prometheus to scrape the ",(0,r.kt)("inlineCode",{parentName:"p"},"/metrics")," endpoint every 30 seconds."),(0,r.kt)("p",null,"Running ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion apply")," would show that kusion will create a ",(0,r.kt)("inlineCode",{parentName:"p"},"Namespace"),", a ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployment"),", a ",(0,r.kt)("inlineCode",{parentName:"p"},"Service")," and a ",(0,r.kt)("inlineCode",{parentName:"p"},"ServiceMonitor"),":\n",(0,r.kt)("img",{alt:"kusion-apply-with-monitor",src:o(448).Z,width:"705",height:"224"})),(0,r.kt)("p",null,"Continue applying all resources:\n",(0,r.kt)("img",{alt:"kusion-apply-success",src:o(56816).Z,width:"1047",height:"564"})),(0,r.kt)("p",null,"If we want to, we can verify the service monitor has been created successfully:\n",(0,r.kt)("img",{alt:"service-monitor",src:o(58232).Z,width:"693",height:"463"})),(0,r.kt)("p",null,"In a few seconds, you should be able to see in the Prometheus portal that the service we just deployed has now been discovered and monitored by Prometheus:\n",(0,r.kt)("img",{alt:"prometheus-targets",src:o(87594).Z,width:"2880",height:"1636"})),(0,r.kt)("p",null,"You can run a few simply queries for the data that Prometheus scraped from your application:\n",(0,r.kt)("img",{alt:"prometheus-simple-query",src:o(87695).Z,width:"2880",height:"1634"})),(0,r.kt)("p",null,"For more info about PromQL, you can find them ",(0,r.kt)("a",{parentName:"p",href:"https://prometheus.io/docs/prometheus/latest/querying/basics/"},"here"),(0,r.kt)("sup",null,"[4]"),"."),(0,r.kt)("h2",{id:"references"},"References"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Prometheus: ",(0,r.kt)("a",{parentName:"li",href:"https://prometheus.io/docs/introduction/overview/"},"https://prometheus.io/docs/introduction/overview/")),(0,r.kt)("li",{parentName:"ol"},"Prometheus team advise: ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/prometheus-operator/prometheus-operator/issues/1547#issuecomment-446691500"},"https://github.com/prometheus-operator/prometheus-operator/issues/1547#issuecomment-446691500")),(0,r.kt)("li",{parentName:"ol"},"Prometheus operator getting started doc: ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md"},"https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md")),(0,r.kt)("li",{parentName:"ol"},"PromQL basics: ",(0,r.kt)("a",{parentName:"li",href:"https://prometheus.io/docs/prometheus/latest/querying/basics/"},"https://prometheus.io/docs/prometheus/latest/querying/basics/"))))}c.isMDXComponent=!0},56816:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/kusion-apply-success-52d04db670fd184959c3ea5c9e54f69d.png"},448:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/kusion-apply-with-monitor-d27cd1443e1a324d514983d52c055b15.png"},91512:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-operated-4cf8308703e4ec9d06a5078bbceb8d5d.png"},35443:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-portal-b60d8654c309e675fc04f1e74c5c127a.png"},87695:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-simple-query-60205589e762105ebc850e70d8ea7b56.png"},87594:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-targets-05964bad58af16f2e02c57cafa8565e7.png"},58232:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/service-monitor-2374625bfd1180a978a2be50ad4648ce.png"}}]); \ No newline at end of file diff --git a/assets/js/5d71f5cd.1d61dcf9.js b/assets/js/5d71f5cd.1d61dcf9.js new file mode 100644 index 00000000000..8c7301bb9a5 --- /dev/null +++ b/assets/js/5d71f5cd.1d61dcf9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4233],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var u=o.createContext({}),c=function(e){var t=o.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=c(e.components);return o.createElement(u.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},l=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,u=e.parentName,p=a(e,["components","mdxType","originalType","parentName"]),l=c(n),m=r,h=l["".concat(u,".").concat(m)]||l[m]||d[m]||s;return n?o.createElement(h,i(i({ref:t},p),{},{components:n})):o.createElement(h,i({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,i=new Array(s);i[0]=l;var a={};for(var u in t)hasOwnProperty.call(t,u)&&(a[u]=t[u]);a.originalType=e,a.mdxType="string"==typeof e?e:r,i[1]=a;for(var c=2;c{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>d,frontMatter:()=>s,metadata:()=>a,toc:()=>c});var o=n(87462),r=(n(67294),n(3905));const s={},i="kusion mod push",a={unversionedId:"reference/commands/kusion-mod-push",id:"version-v0.11/reference/commands/kusion-mod-push",title:"kusion mod push",description:"Push a module to OCI registry",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-mod-push.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-mod-push",permalink:"/docs/reference/commands/kusion-mod-push",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-mod-push.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion mod init",permalink:"/docs/reference/commands/kusion-mod-init"},next:{title:"kusion mod",permalink:"/docs/reference/commands/kusion-mod"}},u={},c=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:c};function d(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,o.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"kusion-mod-push"},"kusion mod push"),(0,r.kt)("p",null,"Push a module to OCI registry"),(0,r.kt)("h3",{id:"synopsis"},"Synopsis"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"}," The push command packages the module as an OCI artifact and pushes it to the\n OCI registry using the version as the image tag.\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kusion mod push [MODULE PATH] [OCI REPOSITORY URL]\n")),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"\n # Push a module of current OS arch to an OCI Registry using a token\n kusion mod push /path/to/my-module oci://ghcr.io/org --creds \n\n # Push a module of specific OS arch to an OCI Registry using a token\n kusion mod push /path/to/my-module oci://ghcr.io/org --os-arch==darwin/arm64 --creds \n \n # Push a module to an OCI Registry using a credentials in : format. \n kusion mod push /path/to/my-module oci://ghcr.io/org --creds :\n\n # Push a release candidate without marking it as the latest stable\n kusion mod push /path/to/my-module oci://ghcr.io/org --latest=false\n\n # Push a module with custom OCI annotations\n kusion mod push /path/to/my-module oci://ghcr.io/org \\\n --annotation='org.opencontainers.image.documentation=https://app.org/docs'\n\n # Push and sign a module with Cosign (the cosign binary must be present in PATH)\n export COSIGN_PASSWORD=password\n kusion mod push /path/to/my-module oci://ghcr.io/org \\\n --sign=cosign --cosign-key=/path/to/cosign.key\n")),(0,r.kt)("h3",{id:"options"},"Options"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"}," -a, --annotations strings Set custom OCI annotations in '=' format.\n --cosign-key string The Cosign private key for signing the module.\n --creds string The credentials token for the OCI registry in or : format.\n -h, --help help for push\n --insecure-registry If true, allows connecting to a OCI registry without TLS or with self-signed certificates.\n --latest Tags the current version as the latest stable module version. (default true)\n --os-arch string The os arch of the module e.g. 'darwin/arm64', 'linux/amd64'.\n --sign string Signs the module with the specified provider.\n")),(0,r.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,r.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-mod"},"kusion mod"),"\t - Manage Kusion modules")),(0,r.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5d71f5cd.fffe957a.js b/assets/js/5d71f5cd.fffe957a.js deleted file mode 100644 index 7d6a9096fc6..00000000000 --- a/assets/js/5d71f5cd.fffe957a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4233],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var u=o.createContext({}),c=function(e){var t=o.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=c(e.components);return o.createElement(u.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},l=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,u=e.parentName,p=a(e,["components","mdxType","originalType","parentName"]),l=c(n),m=r,h=l["".concat(u,".").concat(m)]||l[m]||d[m]||s;return n?o.createElement(h,i(i({ref:t},p),{},{components:n})):o.createElement(h,i({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,i=new Array(s);i[0]=l;var a={};for(var u in t)hasOwnProperty.call(t,u)&&(a[u]=t[u]);a.originalType=e,a.mdxType="string"==typeof e?e:r,i[1]=a;for(var c=2;c{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>d,frontMatter:()=>s,metadata:()=>a,toc:()=>c});var o=n(87462),r=(n(67294),n(3905));const s={},i="kusion mod push",a={unversionedId:"reference/commands/kusion-mod-push",id:"version-v0.11/reference/commands/kusion-mod-push",title:"kusion mod push",description:"Push a module to OCI registry",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-mod-push.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-mod-push",permalink:"/docs/reference/commands/kusion-mod-push",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-mod-push.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion mod init",permalink:"/docs/reference/commands/kusion-mod-init"},next:{title:"kusion mod",permalink:"/docs/reference/commands/kusion-mod"}},u={},c=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:c};function d(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,o.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"kusion-mod-push"},"kusion mod push"),(0,r.kt)("p",null,"Push a module to OCI registry"),(0,r.kt)("h3",{id:"synopsis"},"Synopsis"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"}," The push command packages the module as an OCI artifact and pushes it to the\n OCI registry using the version as the image tag.\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kusion mod push [MODULE PATH] [OCI REPOSITORY URL]\n")),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"\n # Push a module of current OS arch to an OCI Registry using a token\n kusion mod push /path/to/my-module oci://ghcr.io/org --creds \n\n # Push a module of specific OS arch to an OCI Registry using a token\n kusion mod push /path/to/my-module oci://ghcr.io/org --os-arch==darwin/arm64 --creds \n \n # Push a module to an OCI Registry using a credentials in : format. \n kusion mod push /path/to/my-module oci://ghcr.io/org --creds :\n\n # Push a release candidate without marking it as the latest stable\n kusion mod push /path/to/my-module oci://ghcr.io/org --latest=false\n\n # Push a module with custom OCI annotations\n kusion mod push /path/to/my-module oci://ghcr.io/org \\\n --annotation='org.opencontainers.image.documentation=https://app.org/docs'\n\n # Push and sign a module with Cosign (the cosign binary must be present in PATH)\n export COSIGN_PASSWORD=password\n kusion mod push /path/to/my-module oci://ghcr.io/org \\\n --sign=cosign --cosign-key=/path/to/cosign.key\n")),(0,r.kt)("h3",{id:"options"},"Options"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"}," -a, --annotations strings Set custom OCI annotations in '=' format.\n --cosign-key string The Cosign private key for signing the module.\n --creds string The credentials token for the OCI registry in or : format.\n -h, --help help for push\n --insecure-registry If true, allows connecting to a OCI registry without TLS or with self-signed certificates.\n --latest Tags the current version as the latest stable module version. (default true)\n --os-arch string The os arch of the module e.g. 'darwin/arm64', 'linux/amd64'.\n --sign string Signs the module with the specified provider.\n")),(0,r.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,r.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-mod"},"kusion mod"),"\t - Manage Kusion modules")),(0,r.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5de204ea.89c5ae44.js b/assets/js/5de204ea.2898ab31.js similarity index 54% rename from assets/js/5de204ea.89c5ae44.js rename to assets/js/5de204ea.2898ab31.js index 1fc2e6223a8..b589d0aaa76 100644 --- a/assets/js/5de204ea.89c5ae44.js +++ b/assets/js/5de204ea.2898ab31.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[394],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},s=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),m=l(n),f=o,d=m["".concat(c,".").concat(f)]||m[f]||u[f]||i;return n?r.createElement(d,a(a({ref:t},s),{},{components:n})):r.createElement(d,a({ref:t},s))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=m;var p={};for(var c in t)hasOwnProperty.call(t,c)&&(p[c]=t[c]);p.originalType=e,p.mdxType="string"==typeof e?e:o,a[1]=p;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>p,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const i={id:"configuration",sidebar_label:"Project Configuration"},a="Project Configuration",p={unversionedId:"concepts/project/configuration",id:"version-v0.10/concepts/project/configuration",title:"Project Configuration",description:"Users can add config items of the project in project.yaml, such as the project name, generator type, Prometheus monitoring, etc.",source:"@site/docs_versioned_docs/version-v0.10/3-concepts/1-project/2-configuration.md",sourceDirName:"3-concepts/1-project",slug:"/concepts/project/configuration",permalink:"/docs/v0.10/concepts/project/configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/3-concepts/1-project/2-configuration.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"configuration",sidebar_label:"Project Configuration"},sidebar:"kusion",previous:{title:"Overview",permalink:"/docs/v0.10/concepts/project/overview"},next:{title:"Overview",permalink:"/docs/v0.10/concepts/stack/overview"}},c={},l=[],s={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"project-configuration"},"Project Configuration"),(0,o.kt)("p",null,"Users can add config items of the project in ",(0,o.kt)("inlineCode",{parentName:"p"},"project.yaml"),", such as the project name, generator type, Prometheus monitoring, etc."),(0,o.kt)("p",null,"Here is an example of ",(0,o.kt)("inlineCode",{parentName:"p"},"project.yaml"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-yaml"},"# The project basic info\nname: helloworld\ngenerator:\n type: AppConfiguration\nprometheus:\n operatorMode: True\n monitorType: Service\n")),(0,o.kt)("p",null,"The config items in ",(0,o.kt)("inlineCode",{parentName:"p"},"project.yaml")," are explained below."),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"name"),": The name of the project"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"generator"),":",(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"type"),": The type of the module generator, supports ",(0,o.kt)("inlineCode",{parentName:"li"},"AppConfiguration")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"KCL"),", default is ",(0,o.kt)("inlineCode",{parentName:"li"},"AppConfiguration"),". If using the schema AppConfiguration, set type as AppConfiguration"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"prometheus"),":",(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"operatorMode"),": Decides whether Kusion runs Prometheus in ",(0,o.kt)("inlineCode",{parentName:"li"},"Operator")," mode. Kusion will generate a ",(0,o.kt)("inlineCode",{parentName:"li"},"Custom Resource")," if it is true, while generate some annotations if it is false"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"monitorType"),": The type of the monitored resource, which can be one of ",(0,o.kt)("inlineCode",{parentName:"li"},"Service")," or ",(0,o.kt)("inlineCode",{parentName:"li"},"Pod"))))))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[394],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},s=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),m=l(n),f=o,d=m["".concat(c,".").concat(f)]||m[f]||u[f]||i;return n?r.createElement(d,a(a({ref:t},s),{},{components:n})):r.createElement(d,a({ref:t},s))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=m;var p={};for(var c in t)hasOwnProperty.call(t,c)&&(p[c]=t[c]);p.originalType=e,p.mdxType="string"==typeof e?e:o,a[1]=p;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>p,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const i={id:"configuration",sidebar_label:"Project Configuration"},a="Project Configuration",p={unversionedId:"concepts/project/configuration",id:"version-v0.10/concepts/project/configuration",title:"Project Configuration",description:"Users can add config items of the project in project.yaml, such as the project name, generator type, Prometheus monitoring, etc.",source:"@site/docs_versioned_docs/version-v0.10/3-concepts/1-project/2-configuration.md",sourceDirName:"3-concepts/1-project",slug:"/concepts/project/configuration",permalink:"/docs/v0.10/concepts/project/configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/3-concepts/1-project/2-configuration.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"configuration",sidebar_label:"Project Configuration"},sidebar:"kusion",previous:{title:"Overview",permalink:"/docs/v0.10/concepts/project/overview"},next:{title:"Overview",permalink:"/docs/v0.10/concepts/stack/overview"}},c={},l=[],s={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"project-configuration"},"Project Configuration"),(0,o.kt)("p",null,"Users can add config items of the project in ",(0,o.kt)("inlineCode",{parentName:"p"},"project.yaml"),", such as the project name, generator type, Prometheus monitoring, etc."),(0,o.kt)("p",null,"Here is an example of ",(0,o.kt)("inlineCode",{parentName:"p"},"project.yaml"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-yaml"},"# The project basic info\nname: helloworld\ngenerator:\n type: AppConfiguration\nprometheus:\n operatorMode: True\n monitorType: Service\n")),(0,o.kt)("p",null,"The config items in ",(0,o.kt)("inlineCode",{parentName:"p"},"project.yaml")," are explained below."),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"name"),": The name of the project"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"generator"),":",(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"type"),": The type of the module generator, supports ",(0,o.kt)("inlineCode",{parentName:"li"},"AppConfiguration")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"KCL"),", default is ",(0,o.kt)("inlineCode",{parentName:"li"},"AppConfiguration"),". If using the schema AppConfiguration, set type as AppConfiguration"))),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"prometheus"),":",(0,o.kt)("ul",{parentName:"li"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"operatorMode"),": Decides whether Kusion runs Prometheus in ",(0,o.kt)("inlineCode",{parentName:"li"},"Operator")," mode. Kusion will generate a ",(0,o.kt)("inlineCode",{parentName:"li"},"Custom Resource")," if it is true, while generate some annotations if it is false"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"monitorType"),": The type of the monitored resource, which can be one of ",(0,o.kt)("inlineCode",{parentName:"li"},"Service")," or ",(0,o.kt)("inlineCode",{parentName:"li"},"Pod"))))))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5f7776bb.c301a574.js b/assets/js/5f7776bb.c301a574.js deleted file mode 100644 index 4210d64949f..00000000000 --- a/assets/js/5f7776bb.c301a574.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8993],{3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),c=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},u=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},l={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),d=c(r),f=o,m=d["".concat(i,".").concat(f)]||d[f]||l[f]||a;return r?n.createElement(m,s(s({ref:t},u),{},{components:r})):n.createElement(m,s({ref:t},u))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=d;var p={};for(var i in t)hasOwnProperty.call(t,i)&&(p[i]=t[i]);p.originalType=e,p.mdxType="string"==typeof e?e:o,s[1]=p;for(var c=2;c{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>s,default:()=>l,frontMatter:()=>a,metadata:()=>p,toc:()=>c});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion workspace update",p={unversionedId:"reference/commands/kusion-workspace-update",id:"version-v0.11/reference/commands/kusion-workspace-update",title:"kusion workspace update",description:"Update a workspace configuration",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-update.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-update",permalink:"/docs/reference/commands/kusion-workspace-update",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-update.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace switch",permalink:"/docs/reference/commands/kusion-workspace-switch"},next:{title:"kusion workspace",permalink:"/docs/reference/commands/kusion-workspace"}},i={},c=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],u={toc:c};function l(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-update"},"kusion workspace update"),(0,o.kt)("p",null,"Update a workspace configuration"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command updates a workspace configuration with specified configuration file, where the file must be in the YAML format."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace update\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Update the current workspace\n kusion workspace update -f dev.yaml\n \n # Update a specified workspace and set as current\n kusion workspace update dev -f dev.yaml --current\n \n # Update a specified workspace in a specified backend\n kusion workspace update prod -f prod.yaml --backend oss-prod\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string the backend name\n --current set the creating workspace as current\n -f, --file string the path of workspace configuration file\n -h, --help help for update\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}l.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5f7776bb.f8a6a15e.js b/assets/js/5f7776bb.f8a6a15e.js new file mode 100644 index 00000000000..99927ee49d9 --- /dev/null +++ b/assets/js/5f7776bb.f8a6a15e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8993],{3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),c=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},u=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},l=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),l=c(r),f=o,m=l["".concat(i,".").concat(f)]||l[f]||d[f]||a;return r?n.createElement(m,s(s({ref:t},u),{},{components:r})):n.createElement(m,s({ref:t},u))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=l;var p={};for(var i in t)hasOwnProperty.call(t,i)&&(p[i]=t[i]);p.originalType=e,p.mdxType="string"==typeof e?e:o,s[1]=p;for(var c=2;c{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>s,default:()=>d,frontMatter:()=>a,metadata:()=>p,toc:()=>c});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion workspace update",p={unversionedId:"reference/commands/kusion-workspace-update",id:"version-v0.11/reference/commands/kusion-workspace-update",title:"kusion workspace update",description:"Update a workspace configuration",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-update.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-update",permalink:"/docs/reference/commands/kusion-workspace-update",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-update.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace switch",permalink:"/docs/reference/commands/kusion-workspace-switch"},next:{title:"kusion workspace",permalink:"/docs/reference/commands/kusion-workspace"}},i={},c=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],u={toc:c};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-update"},"kusion workspace update"),(0,o.kt)("p",null,"Update a workspace configuration"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command updates a workspace configuration with specified configuration file, where the file must be in the YAML format."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace update\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Update the current workspace\n kusion workspace update -f dev.yaml\n \n # Update a specified workspace and set as current\n kusion workspace update dev -f dev.yaml --current\n \n # Update a specified workspace in a specified backend\n kusion workspace update prod -f prod.yaml --backend oss-prod\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string the backend name\n --current set the creating workspace as current\n -f, --file string the path of workspace configuration file\n -h, --help help for update\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5f9bf2e5.86e1ead6.js b/assets/js/5f9bf2e5.86e1ead6.js deleted file mode 100644 index 514c94234dd..00000000000 --- a/assets/js/5f9bf2e5.86e1ead6.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8835],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=s(n),m=i,k=d["".concat(p,".").concat(m)]||d[m]||c[m]||r;return n?a.createElement(k,o(o({ref:t},u),{},{components:n})):a.createElement(k,o({ref:t},u))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,o=new Array(r);o[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:i,o[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>c,frontMatter:()=>r,metadata:()=>l,toc:()=>s});var a=n(87462),i=(n(67294),n(3905));const r={id:"set-up-operational-rules"},o="Set up Operational Rules",l={unversionedId:"user-guides/working-with-k8s/set-up-operational-rules",id:"version-v0.11/user-guides/working-with-k8s/set-up-operational-rules",title:"Set up Operational Rules",description:"You can set up operational rules in the AppConfiguration model with the opsrule accessory and corresponding platform configurations in the workspace directory. The opsrule is the collection of operational rule requirements for the application that are used as a preemptive measure to police and stop any unwanted changes.",source:"@site/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/6-set-up-operational-rules.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/set-up-operational-rules",permalink:"/docs/user-guides/working-with-k8s/set-up-operational-rules",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/6-set-up-operational-rules.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:6,frontMatter:{id:"set-up-operational-rules"},sidebar:"kusion",previous:{title:"Configure Resource Specification",permalink:"/docs/user-guides/working-with-k8s/resource-spec"},next:{title:"Schedule a Job",permalink:"/docs/user-guides/working-with-k8s/job"}},p={},s=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],u={toc:s};function c(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"set-up-operational-rules"},"Set up Operational Rules"),(0,i.kt)("p",null,"You can set up operational rules in the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model with the ",(0,i.kt)("inlineCode",{parentName:"p"},"opsrule")," accessory and corresponding platform configurations in the workspace directory. The ",(0,i.kt)("inlineCode",{parentName:"p"},"opsrule")," is the collection of operational rule requirements for the application that are used as a preemptive measure to police and stop any unwanted changes."),(0,i.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,i.kt)("p",null,"Please refer to the ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,i.kt)("p",null,"The example below also requires you to have ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,i.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,i.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,i.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,i.kt)("p",null,"However, if you (or the platform team) would like to set default values for the opsrule to standardize the behavior of applications, you can do so by updating the ",(0,i.kt)("inlineCode",{parentName:"p"},"~/dev.yaml"),".\nNote that the platform engineers should set the default workload to ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/operating"},"Kusion Operation CollaSet")," and installed the Kusion Operation controllers properly, the ",(0,i.kt)("inlineCode",{parentName:"p"},"opsrules")," module will generate a ",(0,i.kt)("a",{parentName:"p",href:"https://www.kusionstack.io/docs/operating/manuals/podtransitionrule"},"PodTransitionRule")," instead of updating the ",(0,i.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," value in the deployment:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n service:\n default:\n type: CollaSet\n kusionstack/opsrule@0.1.0:\n default:\n maxUnavailable: 30%\n")),(0,i.kt)("p",null,"Please note that the ",(0,i.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," in the workspace configuration only works as a default value and will be overridden by the value set in the application configuration."),(0,i.kt)("p",null,"The workspace configuration need to be updated with the command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace update dev -f ~/dev.yaml\n")),(0,i.kt)("h2",{id:"example"},"Example"),(0,i.kt)("p",null,"Add the ",(0,i.kt)("inlineCode",{parentName:"p"},"opsrule")," module dependency to ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod"),": "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},'[package]\nname = "simple-service"\nversion = "0.1.0"\n\n[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\nopsrule = { oci = "oci://ghcr.io/kusionstack/opsrule", tag = "0.1.0" }\n\n[profile]\nentries = ["main.k"]\n')),(0,i.kt)("p",null,"Add the ",(0,i.kt)("inlineCode",{parentName:"p"},"opsrule")," snippet to the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," in ",(0,i.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-py"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport opsrule\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Service {\n ...\n }\n # Configure the maxUnavailable rule\n accessories: {\n "opsrule": opsrule.OpsRule {\n "maxUnavailable": 50%\n }\n }\n}\n')),(0,i.kt)("h2",{id:"applying"},"Applying"),(0,i.kt)("p",null,"Re-run steps in ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", resource scaling is completed."),(0,i.kt)("h2",{id:"validation"},"Validation"),(0,i.kt)("p",null,"We can verify the application deployment strategy now has the updated attributes ",(0,i.kt)("inlineCode",{parentName:"p"},"maxUnavailable: 50%")," in the container configuration."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5f9bf2e5.9618bbcb.js b/assets/js/5f9bf2e5.9618bbcb.js new file mode 100644 index 00000000000..98660f761b6 --- /dev/null +++ b/assets/js/5f9bf2e5.9618bbcb.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8835],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=s(n),m=i,k=d["".concat(p,".").concat(m)]||d[m]||c[m]||r;return n?a.createElement(k,o(o({ref:t},u),{},{components:n})):a.createElement(k,o({ref:t},u))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,o=new Array(r);o[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:i,o[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>c,frontMatter:()=>r,metadata:()=>l,toc:()=>s});var a=n(87462),i=(n(67294),n(3905));const r={id:"set-up-operational-rules"},o="Set up Operational Rules",l={unversionedId:"user-guides/working-with-k8s/set-up-operational-rules",id:"version-v0.11/user-guides/working-with-k8s/set-up-operational-rules",title:"Set up Operational Rules",description:"You can set up operational rules in the AppConfiguration model with the opsrule accessory and corresponding platform configurations in the workspace directory. The opsrule is the collection of operational rule requirements for the application that are used as a preemptive measure to police and stop any unwanted changes.",source:"@site/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/6-set-up-operational-rules.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/set-up-operational-rules",permalink:"/docs/user-guides/working-with-k8s/set-up-operational-rules",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/6-set-up-operational-rules.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:6,frontMatter:{id:"set-up-operational-rules"},sidebar:"kusion",previous:{title:"Configure Resource Specification",permalink:"/docs/user-guides/working-with-k8s/resource-spec"},next:{title:"Schedule a Job",permalink:"/docs/user-guides/working-with-k8s/job"}},p={},s=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],u={toc:s};function c(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"set-up-operational-rules"},"Set up Operational Rules"),(0,i.kt)("p",null,"You can set up operational rules in the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model with the ",(0,i.kt)("inlineCode",{parentName:"p"},"opsrule")," accessory and corresponding platform configurations in the workspace directory. The ",(0,i.kt)("inlineCode",{parentName:"p"},"opsrule")," is the collection of operational rule requirements for the application that are used as a preemptive measure to police and stop any unwanted changes."),(0,i.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,i.kt)("p",null,"Please refer to the ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,i.kt)("p",null,"The example below also requires you to have ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,i.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,i.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,i.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,i.kt)("p",null,"However, if you (or the platform team) would like to set default values for the opsrule to standardize the behavior of applications, you can do so by updating the ",(0,i.kt)("inlineCode",{parentName:"p"},"~/dev.yaml"),".\nNote that the platform engineers should set the default workload to ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/operating"},"Kusion Operation CollaSet")," and installed the Kusion Operation controllers properly, the ",(0,i.kt)("inlineCode",{parentName:"p"},"opsrules")," module will generate a ",(0,i.kt)("a",{parentName:"p",href:"https://www.kusionstack.io/docs/operating/manuals/podtransitionrule"},"PodTransitionRule")," instead of updating the ",(0,i.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," value in the deployment:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n service:\n default:\n type: CollaSet\n kusionstack/opsrule@0.1.0:\n default:\n maxUnavailable: 30%\n")),(0,i.kt)("p",null,"Please note that the ",(0,i.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," in the workspace configuration only works as a default value and will be overridden by the value set in the application configuration."),(0,i.kt)("p",null,"The workspace configuration need to be updated with the command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace update dev -f ~/dev.yaml\n")),(0,i.kt)("h2",{id:"example"},"Example"),(0,i.kt)("p",null,"Add the ",(0,i.kt)("inlineCode",{parentName:"p"},"opsrule")," module dependency to ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod"),": "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},'[package]\nname = "simple-service"\nversion = "0.1.0"\n\n[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\nopsrule = { oci = "oci://ghcr.io/kusionstack/opsrule", tag = "0.1.0" }\n\n[profile]\nentries = ["main.k"]\n')),(0,i.kt)("p",null,"Add the ",(0,i.kt)("inlineCode",{parentName:"p"},"opsrule")," snippet to the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," in ",(0,i.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-py"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport opsrule\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Service {\n ...\n }\n # Configure the maxUnavailable rule\n accessories: {\n "opsrule": opsrule.OpsRule {\n "maxUnavailable": 50%\n }\n }\n}\n')),(0,i.kt)("h2",{id:"applying"},"Applying"),(0,i.kt)("p",null,"Re-run steps in ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", resource scaling is completed."),(0,i.kt)("h2",{id:"validation"},"Validation"),(0,i.kt)("p",null,"We can verify the application deployment strategy now has the updated attributes ",(0,i.kt)("inlineCode",{parentName:"p"},"maxUnavailable: 50%")," in the container configuration."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/60cfcd23.2f992f85.js b/assets/js/60cfcd23.2f992f85.js deleted file mode 100644 index bf5daaafba2..00000000000 --- a/assets/js/60cfcd23.2f992f85.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6511],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),m=p(n),f=i,d=m["".concat(l,".").concat(f)]||m[f]||u[f]||o;return n?r.createElement(d,a(a({ref:t},c),{},{components:n})):r.createElement(d,a({ref:t},c))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,a=new Array(o);a[0]=m;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,a[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var r=n(87462),i=(n(67294),n(3905));const o={},a="kusion init",s={unversionedId:"reference/commands/kusion-init",id:"version-v0.10/reference/commands/kusion-init",title:"kusion init",description:"Initialize the scaffolding for a project",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-init.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-init",permalink:"/docs/v0.10/reference/commands/kusion-init",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-init.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion destroy",permalink:"/docs/v0.10/reference/commands/kusion-destroy"},next:{title:"kusion preview",permalink:"/docs/v0.10/reference/commands/kusion-preview"}},l={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"kusion-init"},"kusion init"),(0,i.kt)("p",null,"Initialize the scaffolding for a project"),(0,i.kt)("h3",{id:"synopsis"},"Synopsis"),(0,i.kt)("p",null,"This command initializes the scaffolding for a project, generating a project from an appointed template with correct structure."),(0,i.kt)("p",null," The scaffold templates can be retrieved from local or online. The built-in templates are used by default, self-defined templates are also supported by assigning the template repository path."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"kusion init\n")),(0,i.kt)("h3",{id:"examples"},"Examples"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"}," # Initialize a project from internal templates\n kusion init\n \n # Initialize a project from default online templates\n kusion init --online=true\n \n # Initialize a project from a specific online template\n kusion init https://github.com// --online=true\n \n # Initialize a project from a specific local template\n kusion init /path/to/templates\n")),(0,i.kt)("h3",{id:"options"},"Options"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"}," --custom-params string Custom params in JSON. If specified, it will be used as the template default value and skip prompts\n --force Force generating the scaffolding files, even if it would change the existing files\n -h, --help help for init\n --online Use templates from online repository to initialize project, or use locally cached templates\n --project-name string Initialize with specified project name. If not specified, a prompt will request it\n --template-name string Initialize with specified template. If not specified, a prompt will request it\n --yes Skip prompts and proceed with default values\n")),(0,i.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,i.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of KusionStack")),(0,i.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/60cfcd23.7c2398c8.js b/assets/js/60cfcd23.7c2398c8.js new file mode 100644 index 00000000000..33d6c66f2f6 --- /dev/null +++ b/assets/js/60cfcd23.7c2398c8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6511],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),f=p(n),m=i,d=f["".concat(l,".").concat(m)]||f[m]||u[m]||o;return n?r.createElement(d,a(a({ref:t},c),{},{components:n})):r.createElement(d,a({ref:t},c))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,a=new Array(o);a[0]=f;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,a[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var r=n(87462),i=(n(67294),n(3905));const o={},a="kusion init",s={unversionedId:"reference/commands/kusion-init",id:"version-v0.10/reference/commands/kusion-init",title:"kusion init",description:"Initialize the scaffolding for a project",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-init.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-init",permalink:"/docs/v0.10/reference/commands/kusion-init",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-init.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion destroy",permalink:"/docs/v0.10/reference/commands/kusion-destroy"},next:{title:"kusion preview",permalink:"/docs/v0.10/reference/commands/kusion-preview"}},l={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"kusion-init"},"kusion init"),(0,i.kt)("p",null,"Initialize the scaffolding for a project"),(0,i.kt)("h3",{id:"synopsis"},"Synopsis"),(0,i.kt)("p",null,"This command initializes the scaffolding for a project, generating a project from an appointed template with correct structure."),(0,i.kt)("p",null," The scaffold templates can be retrieved from local or online. The built-in templates are used by default, self-defined templates are also supported by assigning the template repository path."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"kusion init\n")),(0,i.kt)("h3",{id:"examples"},"Examples"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"}," # Initialize a project from internal templates\n kusion init\n \n # Initialize a project from default online templates\n kusion init --online=true\n \n # Initialize a project from a specific online template\n kusion init https://github.com// --online=true\n \n # Initialize a project from a specific local template\n kusion init /path/to/templates\n")),(0,i.kt)("h3",{id:"options"},"Options"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"}," --custom-params string Custom params in JSON. If specified, it will be used as the template default value and skip prompts\n --force Force generating the scaffolding files, even if it would change the existing files\n -h, --help help for init\n --online Use templates from online repository to initialize project, or use locally cached templates\n --project-name string Initialize with specified project name. If not specified, a prompt will request it\n --template-name string Initialize with specified template. If not specified, a prompt will request it\n --yes Skip prompts and proceed with default values\n")),(0,i.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,i.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of KusionStack")),(0,i.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6145b3f7.d30adfd8.js b/assets/js/6145b3f7.d30adfd8.js new file mode 100644 index 00000000000..83cc94d1b7f --- /dev/null +++ b/assets/js/6145b3f7.d30adfd8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9172],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>f});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),l=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},p=function(e){var n=l(e.components);return r.createElement(c.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},d=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=l(t),f=o,m=d["".concat(c,".").concat(f)]||d[f]||u[f]||i;return t?r.createElement(m,a(a({ref:n},p),{},{components:t})):r.createElement(m,a({ref:n},p))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=d;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var l=2;l{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var r=t(87462),o=(t(67294),t(3905));const i={},a="Kusion Modules",s={unversionedId:"reference/modules/index",id:"version-v0.10/reference/modules/index",title:"Kusion Modules",description:"KusionStack presets application configuration models described by KCL, where the model is called Kusion Model. The GitHub repository KusionStack/catalog is used to store these models, which is known as Kusion Model Library.",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/index.md",sourceDirName:"6-reference/2-modules",slug:"/reference/modules/",permalink:"/docs/v0.10/reference/modules/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/index.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace",permalink:"/docs/v0.10/reference/commands/kusion-workspace"},next:{title:"appconfiguration",permalink:"/docs/v0.10/reference/modules/catalog-models/app-configuration"}},c={},l=[],p={toc:l};function u(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-modules"},"Kusion Modules"),(0,o.kt)("p",null,"KusionStack presets application configuration models described by KCL, where the model is called ",(0,o.kt)("strong",{parentName:"p"},"Kusion Model"),". The GitHub repository ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"KusionStack/catalog")," is used to store these models, which is known as ",(0,o.kt)("strong",{parentName:"p"},"Kusion Model Library"),"."),(0,o.kt)("p",null,"The original intention of designing Kusion Model is to enhance the efficiency and improve the experience of YAML users. Through the unified application model defined by code, abstract and encapsulate complex configuration items, omit repetitive and derivable configurations, and supplement with necessary verification logic. Only the necessary attributes get exposed, users get an out-of-the-box, easy-to-understand configuration interface, which reduces the difficulty and improves the reliability of the configuration work."),(0,o.kt)("p",null,"Kusion Model Library currently provides the Kusion Model ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),". The design of ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," is developer-centric, based on Ant Group's decades of practice in building and managing hyperscale IDP (Internal Developer Platform), and the best practice of community. ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," describes the full lifecycle of an application."),(0,o.kt)("p",null,"A simple example of using ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," to describe an application is as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},'wordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "wordpress": c.Container {\n image: "wordpress:latest"\n env: {\n "WORDPRESS_DB_HOST": "secret://wordpress-db/hostAddress"\n "WORDPRESS_DB_PASSWORD": "secret://wordpress-db/password"\n }\n resources: {\n "cpu": "1"\n "memory": "2Gi"\n }\n }\n }\n replicas: 2\n ports: [\n n.Port {\n port: 80\n public: True\n }\n ]\n }\n \n database: db.Database {\n type: "alicloud"\n engine: "MySQL"\n version: "5.7"\n size: 20\n instanceType: "mysql.n2.serverless.1c"\n category: "serverless_basic"\n }\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6145b3f7.ea8dc753.js b/assets/js/6145b3f7.ea8dc753.js deleted file mode 100644 index d87924c0ef5..00000000000 --- a/assets/js/6145b3f7.ea8dc753.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9172],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>f});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),l=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},p=function(e){var n=l(e.components);return r.createElement(c.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},d=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=l(t),f=o,m=d["".concat(c,".").concat(f)]||d[f]||u[f]||i;return t?r.createElement(m,a(a({ref:n},p),{},{components:t})):r.createElement(m,a({ref:n},p))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=d;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var l=2;l{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var r=t(87462),o=(t(67294),t(3905));const i={},a="Kusion Modules",s={unversionedId:"reference/modules/index",id:"version-v0.10/reference/modules/index",title:"Kusion Modules",description:"KusionStack presets application configuration models described by KCL, where the model is called Kusion Model. The GitHub repository KusionStack/catalog is used to store these models, which is known as Kusion Model Library.",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/index.md",sourceDirName:"6-reference/2-modules",slug:"/reference/modules/",permalink:"/docs/v0.10/reference/modules/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/index.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace",permalink:"/docs/v0.10/reference/commands/kusion-workspace"},next:{title:"appconfiguration",permalink:"/docs/v0.10/reference/modules/catalog-models/app-configuration"}},c={},l=[],p={toc:l};function u(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-modules"},"Kusion Modules"),(0,o.kt)("p",null,"KusionStack presets application configuration models described by KCL, where the model is called ",(0,o.kt)("strong",{parentName:"p"},"Kusion Model"),". The GitHub repository ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"KusionStack/catalog")," is used to store these models, which is known as ",(0,o.kt)("strong",{parentName:"p"},"Kusion Model Library"),"."),(0,o.kt)("p",null,"The original intention of designing Kusion Model is to enhance the efficiency and improve the experience of YAML users. Through the unified application model defined by code, abstract and encapsulate complex configuration items, omit repetitive and derivable configurations, and supplement with necessary verification logic. Only the necessary attributes get exposed, users get an out-of-the-box, easy-to-understand configuration interface, which reduces the difficulty and improves the reliability of the configuration work."),(0,o.kt)("p",null,"Kusion Model Library currently provides the Kusion Model ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),". The design of ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," is developer-centric, based on Ant Group's decades of practice in building and managing hyperscale IDP (Internal Developer Platform), and the best practice of community. ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," describes the full lifecycle of an application."),(0,o.kt)("p",null,"A simple example of using ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," to describe an application is as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},'wordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "wordpress": c.Container {\n image: "wordpress:latest"\n env: {\n "WORDPRESS_DB_HOST": "secret://wordpress-db/hostAddress"\n "WORDPRESS_DB_PASSWORD": "secret://wordpress-db/password"\n }\n resources: {\n "cpu": "1"\n "memory": "2Gi"\n }\n }\n }\n replicas: 2\n ports: [\n n.Port {\n port: 80\n public: True\n }\n ]\n }\n \n database: db.Database {\n type: "alicloud"\n engine: "MySQL"\n version: "5.7"\n size: 20\n instanceType: "mysql.n2.serverless.1c"\n category: "serverless_basic"\n }\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/61f95e53.5954a63b.js b/assets/js/61f95e53.5954a63b.js deleted file mode 100644 index 834ed4462de..00000000000 --- a/assets/js/61f95e53.5954a63b.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3682],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),d=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=d(e.components);return r.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=d(n),m=a,k=u["".concat(s,".").concat(m)]||u[m]||c[m]||o;return n?r.createElement(k,l(l({ref:t},p),{},{components:n})):r.createElement(k,l({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=u;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var r=n(87462),a=(n(67294),n(3905));const o={id:"naming-conventions",sidebar_label:"Resource Naming Conventions"},l="Resource Naming Conventions",i={unversionedId:"reference/modules/naming-conventions",id:"reference/modules/naming-conventions",title:"Resource Naming Conventions",description:"Kusion will automatically create Kubernetes or Terraform resources for the applications, many of which do not require users' awareness. This document will introduce the naming conventions for these related resources.",source:"@site/docs/kusion/6-reference/2-modules/3-naming-conventions.md",sourceDirName:"6-reference/2-modules",slug:"/reference/modules/naming-conventions",permalink:"/docs/next/reference/modules/naming-conventions",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/3-naming-conventions.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{id:"naming-conventions",sidebar_label:"Resource Naming Conventions"},sidebar:"kusion",previous:{title:"service",permalink:"/docs/next/reference/modules/workspace-configs/workload/service"},next:{title:"Roadmap",permalink:"/docs/next/reference/roadmap"}},s={},d=[{value:"Kubernetes Resources",id:"kubernetes-resources",level:2},{value:"Terraform Resources",id:"terraform-resources",level:2}],p={toc:d};function c(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"resource-naming-conventions"},"Resource Naming Conventions"),(0,a.kt)("p",null,"Kusion will automatically create Kubernetes or Terraform resources for the applications, many of which do not require users' awareness. This document will introduce the naming conventions for these related resources. "),(0,a.kt)("h2",{id:"kubernetes-resources"},"Kubernetes Resources"),(0,a.kt)("p",null,"Kusion adheres to specific rules when generating the Kubernetes resources for users' applications. The table below lists some common Kubernetes resource naming conventions. Note that ",(0,a.kt)("inlineCode",{parentName:"p"},"Namespace")," can now be specified by users. "),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Resource"),(0,a.kt)("th",{parentName:"tr",align:null},"Concatenation Rule"),(0,a.kt)("th",{parentName:"tr",align:null},"Example ID"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"Namespace"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"v1:Namespace:wordpress-local-db")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"Deployment"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"apps/v1:Deployment:wordpress-local-db:wordpress-local-db-dev-wordpress")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"CronJob"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"batch/v1:CronJob:helloworld:helloworld-dev-helloworld")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"Service"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"}," or ")),(0,a.kt)("td",{parentName:"tr",align:null},"v1:Service:helloworld:helloworld-dev-helloworld-public")))),(0,a.kt)("h2",{id:"terraform-resources"},"Terraform Resources"),(0,a.kt)("p",null,"Similarly, Kusion also adheres to specific naming conventions when generating the Terraform Resources. Some common resources are listed below. "),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Resource"),(0,a.kt)("th",{parentName:"tr",align:null},"Concatenation Rule"),(0,a.kt)("th",{parentName:"tr",align:null},"Example ID"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"random_password"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"hashicorp:random:random_password:wordpress-db-mysql")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"aws_security_group"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"hashicorp:aws:aws_security_group:wordpress-db-mysql")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"aws_db_instance"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"hashicorp:aws:aws_db_instance:wordpress-db")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"alicloud_db_instance"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"aliyun:alicloud:alicloud_db_instance:wordpress-db")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"alicloud_db_connection"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"aliyun:alicloud:alicloud_db_connection:wordpress")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"alicloud_rds_account"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"aliyun:alicloud:alicloud_rds_account:wordpress")))),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"")," is composed of two parts, one of which is the ",(0,a.kt)("inlineCode",{parentName:"p"},"key")," of database declared in ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," and the other is the ",(0,a.kt)("inlineCode",{parentName:"p"},"suffix")," declared in ",(0,a.kt)("inlineCode",{parentName:"p"},"workspace")," configuration. Kusion will concatenate the database key and suffix, convert them to uppercase, and replace ",(0,a.kt)("inlineCode",{parentName:"p"},"-")," with ",(0,a.kt)("inlineCode",{parentName:"p"},"_"),". And the ",(0,a.kt)("inlineCode",{parentName:"p"},"")," supported now includes ",(0,a.kt)("inlineCode",{parentName:"p"},"mysql")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"postgres"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/61f95e53.915b50b7.js b/assets/js/61f95e53.915b50b7.js new file mode 100644 index 00000000000..23298cfd56f --- /dev/null +++ b/assets/js/61f95e53.915b50b7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3682],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),d=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=d(e.components);return r.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=d(n),m=a,k=u["".concat(s,".").concat(m)]||u[m]||c[m]||o;return n?r.createElement(k,l(l({ref:t},p),{},{components:n})):r.createElement(k,l({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=u;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var r=n(87462),a=(n(67294),n(3905));const o={id:"naming-conventions",sidebar_label:"Resource Naming Conventions"},l="Resource Naming Conventions",i={unversionedId:"reference/modules/naming-conventions",id:"reference/modules/naming-conventions",title:"Resource Naming Conventions",description:"Kusion will automatically create Kubernetes or Terraform resources for the applications, many of which do not require users' awareness. This document will introduce the naming conventions for these related resources.",source:"@site/docs/kusion/6-reference/2-modules/3-naming-conventions.md",sourceDirName:"6-reference/2-modules",slug:"/reference/modules/naming-conventions",permalink:"/docs/next/reference/modules/naming-conventions",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/3-naming-conventions.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{id:"naming-conventions",sidebar_label:"Resource Naming Conventions"},sidebar:"kusion",previous:{title:"service",permalink:"/docs/next/reference/modules/workspace-configs/workload/service"},next:{title:"Roadmap",permalink:"/docs/next/reference/roadmap"}},s={},d=[{value:"Kubernetes Resources",id:"kubernetes-resources",level:2},{value:"Terraform Resources",id:"terraform-resources",level:2}],p={toc:d};function c(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"resource-naming-conventions"},"Resource Naming Conventions"),(0,a.kt)("p",null,"Kusion will automatically create Kubernetes or Terraform resources for the applications, many of which do not require users' awareness. This document will introduce the naming conventions for these related resources. "),(0,a.kt)("h2",{id:"kubernetes-resources"},"Kubernetes Resources"),(0,a.kt)("p",null,"Kusion adheres to specific rules when generating the Kubernetes resources for users' applications. The table below lists some common Kubernetes resource naming conventions. Note that ",(0,a.kt)("inlineCode",{parentName:"p"},"Namespace")," can now be specified by users. "),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Resource"),(0,a.kt)("th",{parentName:"tr",align:null},"Concatenation Rule"),(0,a.kt)("th",{parentName:"tr",align:null},"Example ID"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"Namespace"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"v1:Namespace:wordpress-local-db")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"Deployment"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"apps/v1:Deployment:wordpress-local-db:wordpress-local-db-dev-wordpress")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"CronJob"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"batch/v1:CronJob:helloworld:helloworld-dev-helloworld")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"Service"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"}," or ")),(0,a.kt)("td",{parentName:"tr",align:null},"v1:Service:helloworld:helloworld-dev-helloworld-public")))),(0,a.kt)("h2",{id:"terraform-resources"},"Terraform Resources"),(0,a.kt)("p",null,"Similarly, Kusion also adheres to specific naming conventions when generating the Terraform Resources. Some common resources are listed below. "),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Resource"),(0,a.kt)("th",{parentName:"tr",align:null},"Concatenation Rule"),(0,a.kt)("th",{parentName:"tr",align:null},"Example ID"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"random_password"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"hashicorp:random:random_password:wordpress-db-mysql")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"aws_security_group"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"hashicorp:aws:aws_security_group:wordpress-db-mysql")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"aws_db_instance"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"hashicorp:aws:aws_db_instance:wordpress-db")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"alicloud_db_instance"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"aliyun:alicloud:alicloud_db_instance:wordpress-db")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"alicloud_db_connection"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"aliyun:alicloud:alicloud_db_connection:wordpress")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"alicloud_rds_account"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"aliyun:alicloud:alicloud_rds_account:wordpress")))),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"")," is composed of two parts, one of which is the ",(0,a.kt)("inlineCode",{parentName:"p"},"key")," of database declared in ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," and the other is the ",(0,a.kt)("inlineCode",{parentName:"p"},"suffix")," declared in ",(0,a.kt)("inlineCode",{parentName:"p"},"workspace")," configuration. Kusion will concatenate the database key and suffix, convert them to uppercase, and replace ",(0,a.kt)("inlineCode",{parentName:"p"},"-")," with ",(0,a.kt)("inlineCode",{parentName:"p"},"_"),". And the ",(0,a.kt)("inlineCode",{parentName:"p"},"")," supported now includes ",(0,a.kt)("inlineCode",{parentName:"p"},"mysql")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"postgres"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/62fad4c6.5366a0a7.js b/assets/js/62fad4c6.5366a0a7.js deleted file mode 100644 index 29df1ee4efb..00000000000 --- a/assets/js/62fad4c6.5366a0a7.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7506],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>u});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=c(n),u=a,k=p["".concat(s,".").concat(u)]||p[u]||m[u]||o;return n?r.createElement(k,l(l({ref:t},d),{},{components:n})):r.createElement(k,l({ref:t},d))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=p;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>m,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const o={},l="common",i={unversionedId:"reference/modules/catalog-models/internal/common",id:"version-v0.10/reference/modules/catalog-models/internal/common",title:"common",description:"Schema WorkloadBase",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/common.md",sourceDirName:"6-reference/2-modules/1-catalog-models/internal",slug:"/reference/modules/catalog-models/internal/common",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/common",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/common.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"postgres",permalink:"/docs/v0.10/reference/modules/catalog-models/database/postgres"},next:{title:"container",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/container/"}},s={},c=[{value:"Schema WorkloadBase",id:"schema-workloadbase",level:2},{value:"Attributes",id:"attributes",level:3}],d={toc:c};function m(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"common"},"common"),(0,a.kt)("h2",{id:"schema-workloadbase"},"Schema WorkloadBase"),(0,a.kt)("p",null,"WorkloadBase defines set of attributes shared by different workload profile, e.g Service",(0,a.kt)("br",null),"and Job. You can inherit this Schema to reuse these common attributes."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"containers"),(0,a.kt)("br",null),"Containers defines the templates of containers to be ran.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers"},"https://kubernetes.io/docs/concepts/containers")),(0,a.kt)("td",{parentName:"tr",align:null},"{str: ",(0,a.kt)("a",{parentName:"td",href:"/docs/v0.10/reference/modules/catalog-models/internal/container/#schema-container"},"container.Container"),"}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"secrets")),(0,a.kt)("td",{parentName:"tr",align:null},"{str: ",(0,a.kt)("a",{parentName:"td",href:"/docs/v0.10/reference/modules/catalog-models/internal/secret/#schema-secret"},"secret.Secret"),"}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"replicas"),(0,a.kt)("br",null),"Number of container replicas based on this configuration that should be ran."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"2"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels"),(0,a.kt)("br",null),"Labels are key/value pairs that are attached to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations"),(0,a.kt)("br",null),"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/62fad4c6.c826fbdd.js b/assets/js/62fad4c6.c826fbdd.js new file mode 100644 index 00000000000..92ec600dfb9 --- /dev/null +++ b/assets/js/62fad4c6.c826fbdd.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7506],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>u});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),p=c(n),u=a,k=p["".concat(s,".").concat(u)]||p[u]||m[u]||o;return n?r.createElement(k,l(l({ref:t},d),{},{components:n})):r.createElement(k,l({ref:t},d))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=p;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>m,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const o={},l="common",i={unversionedId:"reference/modules/catalog-models/internal/common",id:"version-v0.10/reference/modules/catalog-models/internal/common",title:"common",description:"Schema WorkloadBase",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/common.md",sourceDirName:"6-reference/2-modules/1-catalog-models/internal",slug:"/reference/modules/catalog-models/internal/common",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/common",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/common.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"postgres",permalink:"/docs/v0.10/reference/modules/catalog-models/database/postgres"},next:{title:"container",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/container/"}},s={},c=[{value:"Schema WorkloadBase",id:"schema-workloadbase",level:2},{value:"Attributes",id:"attributes",level:3}],d={toc:c};function m(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"common"},"common"),(0,a.kt)("h2",{id:"schema-workloadbase"},"Schema WorkloadBase"),(0,a.kt)("p",null,"WorkloadBase defines set of attributes shared by different workload profile, e.g Service",(0,a.kt)("br",null),"and Job. You can inherit this Schema to reuse these common attributes."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"containers"),(0,a.kt)("br",null),"Containers defines the templates of containers to be ran.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers"},"https://kubernetes.io/docs/concepts/containers")),(0,a.kt)("td",{parentName:"tr",align:null},"{str: ",(0,a.kt)("a",{parentName:"td",href:"/docs/v0.10/reference/modules/catalog-models/internal/container/#schema-container"},"container.Container"),"}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"secrets")),(0,a.kt)("td",{parentName:"tr",align:null},"{str: ",(0,a.kt)("a",{parentName:"td",href:"/docs/v0.10/reference/modules/catalog-models/internal/secret/#schema-secret"},"secret.Secret"),"}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"replicas"),(0,a.kt)("br",null),"Number of container replicas based on this configuration that should be ran."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"2"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels"),(0,a.kt)("br",null),"Labels are key/value pairs that are attached to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations"),(0,a.kt)("br",null),"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/64d48972.379e0dc7.js b/assets/js/64d48972.379e0dc7.js new file mode 100644 index 00000000000..808c6d55c32 --- /dev/null +++ b/assets/js/64d48972.379e0dc7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1228],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>u});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),d=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},c=function(e){var t=d(e.components);return n.createElement(p.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),m=d(a),u=r,g=m["".concat(p,".").concat(u)]||m[u]||s[u]||o;return a?n.createElement(g,l(l({ref:t},c),{},{components:a})):n.createElement(g,l({ref:t},c))}));function u(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,l=new Array(o);l[0]=m;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var d=2;d{a.r(t),a.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>s,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var n=a(87462),r=(a(67294),a(3905));const o={id:"doc_app_configuration",sidebar_label:"App Configuration",sidebar_position:1},l="app_configuration",i={unversionedId:"reference/model/catalog_models/doc_app_configuration",id:"version-v0.9/reference/model/catalog_models/doc_app_configuration",title:"app_configuration",description:"Schema AppConfiguration",source:"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/doc_app_configuration.md",sourceDirName:"reference/model/catalog_models",slug:"/reference/model/catalog_models/doc_app_configuration",permalink:"/docs/v0.9/reference/model/catalog_models/doc_app_configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/catalog_models/doc_app_configuration.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"doc_app_configuration",sidebar_label:"App Configuration",sidebar_position:1},sidebar:"kusion",previous:{title:"Overview",permalink:"/docs/v0.9/reference/model/overview"},next:{title:"Job",permalink:"/docs/v0.9/reference/model/catalog_models/workload/doc_job"}},p={},d=[{value:"Schema AppConfiguration",id:"schema-appconfiguration",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],c={toc:d};function s(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"app_configuration"},"app_configuration"),(0,r.kt)("h2",{id:"schema-appconfiguration"},"Schema AppConfiguration"),(0,r.kt)("p",null,"AppConfiguration is a developer-centric definition that describes how to run an Application.",(0,r.kt)("br",null),"This application model builds upon a decade of experience at AntGroup running super large scale",(0,r.kt)("br",null),"internal developer platform, combined with best-of-breed ideas and practices from the community."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"workload"),(0,r.kt)("br",null),"Workload defines how to run your application code. Currently supported workload profile",(0,r.kt)("br",null),"includes Service and Job."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/v0.9/reference/model/catalog_models/workload/doc_service#schema-service"},"workload.Service")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"/docs/v0.9/reference/model/catalog_models/workload/doc_job#schema-job"},"workload.Job")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"opsRule"),(0,r.kt)("br",null),"OpsRule specifies collection of rules that will be checked for Day-2 operation."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/v0.9/reference/model/catalog_models/trait/doc_opsrule#schema-opsrule"},"trait.OpsRule")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"database")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/v0.9/reference/model/catalog_models/database/doc_database#schema-database"},"database.Database")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"monitoring")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/v0.9/reference/model/catalog_models/monitoring/doc_prometheus#schema-prometheus"},"monitoring.Prometheus")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"labels")),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"annotations")),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'# Instantiate an App with a long-running service and its image is "nginx:v1"\n\nimport catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.accessories.database as db\nimport catalog.models.schema.v1.accessories.monitoring as m\nimport catalog.models.schema.v1.accessories.trait as t\n\nappConfiguration = ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "nginx": c.Container {\n image: "nginx:v1"\n }\n }\n type: "CollaSet"\n }\n opsRule: t.OpsRule {\n maxUnavailable: "30%"\n }\n database: db.Database {\n type: "aws"\n engine: "mysql"\n version: "5.7"\n instanceType: "db.t3.micro"\n }\n monitoring: m.Prometheus{\n interval: "30s"\n timeout: "15s"\n path: "/metrics"\n port: "web"\n scheme: "http"\n }\n}\n')))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/64d48972.ad91f1ad.js b/assets/js/64d48972.ad91f1ad.js deleted file mode 100644 index 3c743f62f7d..00000000000 --- a/assets/js/64d48972.ad91f1ad.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1228],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>u});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),d=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=d(e.components);return a.createElement(p.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),m=d(n),u=r,g=m["".concat(p,".").concat(u)]||m[u]||s[u]||o;return n?a.createElement(g,l(l({ref:t},c),{},{components:n})):a.createElement(g,l({ref:t},c))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=m;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>s,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var a=n(87462),r=(n(67294),n(3905));const o={id:"doc_app_configuration",sidebar_label:"App Configuration",sidebar_position:1},l="app_configuration",i={unversionedId:"reference/model/catalog_models/doc_app_configuration",id:"version-v0.9/reference/model/catalog_models/doc_app_configuration",title:"app_configuration",description:"Schema AppConfiguration",source:"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/doc_app_configuration.md",sourceDirName:"reference/model/catalog_models",slug:"/reference/model/catalog_models/doc_app_configuration",permalink:"/docs/v0.9/reference/model/catalog_models/doc_app_configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/catalog_models/doc_app_configuration.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"doc_app_configuration",sidebar_label:"App Configuration",sidebar_position:1},sidebar:"kusion",previous:{title:"Overview",permalink:"/docs/v0.9/reference/model/overview"},next:{title:"Job",permalink:"/docs/v0.9/reference/model/catalog_models/workload/doc_job"}},p={},d=[{value:"Schema AppConfiguration",id:"schema-appconfiguration",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],c={toc:d};function s(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"app_configuration"},"app_configuration"),(0,r.kt)("h2",{id:"schema-appconfiguration"},"Schema AppConfiguration"),(0,r.kt)("p",null,"AppConfiguration is a developer-centric definition that describes how to run an Application.",(0,r.kt)("br",null),"This application model builds upon a decade of experience at AntGroup running super large scale",(0,r.kt)("br",null),"internal developer platform, combined with best-of-breed ideas and practices from the community."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"workload"),(0,r.kt)("br",null),"Workload defines how to run your application code. Currently supported workload profile",(0,r.kt)("br",null),"includes Service and Job."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/v0.9/reference/model/catalog_models/workload/doc_service#schema-service"},"workload.Service")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"/docs/v0.9/reference/model/catalog_models/workload/doc_job#schema-job"},"workload.Job")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"opsRule"),(0,r.kt)("br",null),"OpsRule specifies collection of rules that will be checked for Day-2 operation."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/v0.9/reference/model/catalog_models/trait/doc_opsrule#schema-opsrule"},"trait.OpsRule")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"database")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/v0.9/reference/model/catalog_models/database/doc_database#schema-database"},"database.Database")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"monitoring")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/v0.9/reference/model/catalog_models/monitoring/doc_prometheus#schema-prometheus"},"monitoring.Prometheus")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"labels")),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"annotations")),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'# Instantiate an App with a long-running service and its image is "nginx:v1"\n\nimport catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.accessories.database as db\nimport catalog.models.schema.v1.accessories.monitoring as m\nimport catalog.models.schema.v1.accessories.trait as t\n\nappConfiguration = ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "nginx": c.Container {\n image: "nginx:v1"\n }\n }\n type: "CollaSet"\n }\n opsRule: t.OpsRule {\n maxUnavailable: "30%"\n }\n database: db.Database {\n type: "aws"\n engine: "mysql"\n version: "5.7"\n instanceType: "db.t3.micro"\n }\n monitoring: m.Prometheus{\n interval: "30s"\n timeout: "15s"\n path: "/metrics"\n port: "web"\n scheme: "http"\n }\n}\n')))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6609e39c.96b388c1.js b/assets/js/6609e39c.80d94871.js similarity index 51% rename from assets/js/6609e39c.96b388c1.js rename to assets/js/6609e39c.80d94871.js index 07440127fae..a6a1cefab68 100644 --- a/assets/js/6609e39c.96b388c1.js +++ b/assets/js/6609e39c.80d94871.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3033],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>d});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),s=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),m=s(n),d=a,f=m["".concat(i,".").concat(d)]||m[d]||u[d]||o;return n?r.createElement(f,l(l({ref:t},p),{},{components:n})):r.createElement(f,l({ref:t},p))}));function d(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=m;var c={};for(var i in t)hasOwnProperty.call(t,i)&&(c[i]=t[i]);c.originalType=e,c.mdxType="string"==typeof e?e:a,l[1]=c;for(var s=2;s{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>c,toc:()=>s});var r=n(87462),a=(n(67294),n(3905));const o={},l="lifecycle",c={unversionedId:"reference/modules/developer-schemas/internal/container/lifecycle/lifecycle",id:"version-v0.11/reference/modules/developer-schemas/internal/container/lifecycle/lifecycle",title:"lifecycle",description:"Schema Lifecycle",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/internal/container/lifecycle/lifecycle.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/internal/container/lifecycle",slug:"/reference/modules/developer-schemas/internal/container/lifecycle/",permalink:"/docs/reference/modules/developer-schemas/internal/container/lifecycle/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/internal/container/lifecycle/lifecycle.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"container",permalink:"/docs/reference/modules/developer-schemas/internal/container/"},next:{title:"probe",permalink:"/docs/reference/modules/developer-schemas/internal/container/probe/"}},i={},s=[{value:"Schema Lifecycle",id:"schema-lifecycle",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:s};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"lifecycle"},"lifecycle"),(0,a.kt)("h2",{id:"schema-lifecycle"},"Schema Lifecycle"),(0,a.kt)("p",null,"Lifecycle describes actions that the management system should take in response",(0,a.kt)("br",null),"to container lifecycle events."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"postStart")),(0,a.kt)("td",{parentName:"tr",align:null}),(0,a.kt)("td",{parentName:"tr",align:null}),(0,a.kt)("td",{parentName:"tr",align:null},"The action to be taken after a container is created.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"preStop")),(0,a.kt)("td",{parentName:"tr",align:null}),(0,a.kt)("td",{parentName:"tr",align:null}),(0,a.kt)("td",{parentName:"tr",align:null},"The action to be taken before a container is terminated due to an API request or",(0,a.kt)("br",null),"management event such as liveness/startup probe failure, preemption, resource contention, etc.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"))))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container.probe as p\nimport kam.workload.container.lifecycle as lc\n\nlifecycleHook = lc.Lifecycle {\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n postStart: p.Http {\n url: "http://localhost:80"\n }\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3033],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>d});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),s=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),m=s(n),d=a,f=m["".concat(i,".").concat(d)]||m[d]||u[d]||o;return n?r.createElement(f,l(l({ref:t},p),{},{components:n})):r.createElement(f,l({ref:t},p))}));function d(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=m;var c={};for(var i in t)hasOwnProperty.call(t,i)&&(c[i]=t[i]);c.originalType=e,c.mdxType="string"==typeof e?e:a,l[1]=c;for(var s=2;s{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>c,toc:()=>s});var r=n(87462),a=(n(67294),n(3905));const o={},l="lifecycle",c={unversionedId:"reference/modules/developer-schemas/internal/container/lifecycle/lifecycle",id:"version-v0.11/reference/modules/developer-schemas/internal/container/lifecycle/lifecycle",title:"lifecycle",description:"Schema Lifecycle",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/internal/container/lifecycle/lifecycle.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/internal/container/lifecycle",slug:"/reference/modules/developer-schemas/internal/container/lifecycle/",permalink:"/docs/reference/modules/developer-schemas/internal/container/lifecycle/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/internal/container/lifecycle/lifecycle.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"container",permalink:"/docs/reference/modules/developer-schemas/internal/container/"},next:{title:"probe",permalink:"/docs/reference/modules/developer-schemas/internal/container/probe/"}},i={},s=[{value:"Schema Lifecycle",id:"schema-lifecycle",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:s};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"lifecycle"},"lifecycle"),(0,a.kt)("h2",{id:"schema-lifecycle"},"Schema Lifecycle"),(0,a.kt)("p",null,"Lifecycle describes actions that the management system should take in response",(0,a.kt)("br",null),"to container lifecycle events."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"postStart")),(0,a.kt)("td",{parentName:"tr",align:null}),(0,a.kt)("td",{parentName:"tr",align:null}),(0,a.kt)("td",{parentName:"tr",align:null},"The action to be taken after a container is created.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"preStop")),(0,a.kt)("td",{parentName:"tr",align:null}),(0,a.kt)("td",{parentName:"tr",align:null}),(0,a.kt)("td",{parentName:"tr",align:null},"The action to be taken before a container is terminated due to an API request or",(0,a.kt)("br",null),"management event such as liveness/startup probe failure, preemption, resource contention, etc.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"))))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container.probe as p\nimport kam.workload.container.lifecycle as lc\n\nlifecycleHook = lc.Lifecycle {\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n postStart: p.Http {\n url: "http://localhost:80"\n }\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/66880af1.4d9c1453.js b/assets/js/66880af1.4d9c1453.js new file mode 100644 index 00000000000..f26955cf5c2 --- /dev/null +++ b/assets/js/66880af1.4d9c1453.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2964],{3905:(t,e,a)=>{a.d(e,{Zo:()=>p,kt:()=>m});var n=a(67294);function r(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function l(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function o(t){for(var e=1;e=0||(r[a]=t[a]);return r}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}var i=n.createContext({}),s=function(t){var e=n.useContext(i),a=e;return t&&(a="function"==typeof t?t(e):o(o({},e),t)),a},p=function(t){var e=s(t.components);return n.createElement(i.Provider,{value:e},t.children)},u={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},c=n.forwardRef((function(t,e){var a=t.components,r=t.mdxType,l=t.originalType,i=t.parentName,p=d(t,["components","mdxType","originalType","parentName"]),c=s(a),m=r,k=c["".concat(i,".").concat(m)]||c[m]||u[m]||l;return a?n.createElement(k,o(o({ref:e},p),{},{components:a})):n.createElement(k,o({ref:e},p))}));function m(t,e){var a=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var l=a.length,o=new Array(l);o[0]=c;var d={};for(var i in e)hasOwnProperty.call(e,i)&&(d[i]=e[i]);d.originalType=t,d.mdxType="string"==typeof t?t:r,o[1]=d;for(var s=2;s{a.r(e),a.d(e,{assets:()=>i,contentTitle:()=>o,default:()=>u,frontMatter:()=>l,metadata:()=>d,toc:()=>s});var n=a(87462),r=(a(67294),a(3905));const l={},o="database",d={unversionedId:"reference/model/catalog_models/database/doc_database",id:"version-v0.9/reference/model/catalog_models/database/doc_database",title:"database",description:"Schema Database",source:"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/database/doc_database.md",sourceDirName:"reference/model/catalog_models/database",slug:"/reference/model/catalog_models/database/doc_database",permalink:"/docs/v0.9/reference/model/catalog_models/database/doc_database",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/catalog_models/database/doc_database.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Service",permalink:"/docs/v0.9/reference/model/catalog_models/workload/doc_service"},next:{title:"prometheus",permalink:"/docs/v0.9/reference/model/catalog_models/monitoring/doc_prometheus"}},i={},s=[{value:"Schema Database",id:"schema-database",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:s};function u(t){let{components:e,...a}=t;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"database"},"database"),(0,r.kt)("h2",{id:"schema-database"},"Schema Database"),(0,r.kt)("p",null,"As an important supporting accessory, Database describes the attributes",(0,r.kt)("br",null),"to locally deploy or create a cloud provider managed database instance for ",(0,r.kt)("br",null),"the workload. "),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type"),(0,r.kt)("br",null),"Type defines the local deployment mode or the specific cloud vendor that ",(0,r.kt)("br",null),"provides the relational database service (rds)."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"engine"),(0,r.kt)("br",null),"Engine defines the database engine to use."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"version"),(0,r.kt)("br",null),"Version defines the database engine version to use."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"instanceType"),(0,r.kt)("br",null),"InstanceType defines the type of the database which is required when ",(0,r.kt)("br",null),"creating an rds instance provided by the cloud vendor."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"size"),(0,r.kt)("br",null),"Size defines the allocated storage size of the rds instance provided by ",(0,r.kt)("br",null),"the cloud vendor in GB."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"10"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"category"),(0,r.kt)("br",null),"Category defines the edition of the rds instance provided by the cloud ",(0,r.kt)("br",null),"vendor."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},'"Basic"'),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"username"),(0,r.kt)("br",null),"Username defines the operation account for the database."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},'"root"'),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"securityIPs"),(0,r.kt)("br",null),"SecurityIPs defines the list of IP addresses allowed to access the rds ",(0,r.kt)("br",null),"instance provided by the cloud vendor."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},'["0.0.0.0/0"]'),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"subnetID"),(0,r.kt)("br",null),"SubnetID defines the virtual subnet ID associated with the VPC that the rds ",(0,r.kt)("br",null),"instance will be created in."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"privateLink"),(0,r.kt)("br",null),"PrivateLink defines whether the host address of the rds instance for the workload ",(0,r.kt)("br",null),"to connect with is via public network or private network of the cloud vendor."),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"True"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"extraMap"),(0,r.kt)("br",null),"ExtraMap defines the diversified rds configuration items from different",(0,r.kt)("br",null),"cloud vendors."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'Instantiate an aws rds with mysql 5.7. \n\nimport catalog.models.schema.v1.accessories.database as db\n\ndatabase: db.Database {\n type: "aws"\n engine: "mysql"\n version: "5.7"\n instanceType: "db.t3.micro"\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/66880af1.7abdeeba.js b/assets/js/66880af1.7abdeeba.js deleted file mode 100644 index fbabdc488a4..00000000000 --- a/assets/js/66880af1.7abdeeba.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2964],{3905:(t,e,a)=>{a.d(e,{Zo:()=>p,kt:()=>m});var n=a(67294);function r(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function l(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function o(t){for(var e=1;e=0||(r[a]=t[a]);return r}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}var i=n.createContext({}),s=function(t){var e=n.useContext(i),a=e;return t&&(a="function"==typeof t?t(e):o(o({},e),t)),a},p=function(t){var e=s(t.components);return n.createElement(i.Provider,{value:e},t.children)},u={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},c=n.forwardRef((function(t,e){var a=t.components,r=t.mdxType,l=t.originalType,i=t.parentName,p=d(t,["components","mdxType","originalType","parentName"]),c=s(a),m=r,k=c["".concat(i,".").concat(m)]||c[m]||u[m]||l;return a?n.createElement(k,o(o({ref:e},p),{},{components:a})):n.createElement(k,o({ref:e},p))}));function m(t,e){var a=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var l=a.length,o=new Array(l);o[0]=c;var d={};for(var i in e)hasOwnProperty.call(e,i)&&(d[i]=e[i]);d.originalType=t,d.mdxType="string"==typeof t?t:r,o[1]=d;for(var s=2;s{a.r(e),a.d(e,{assets:()=>i,contentTitle:()=>o,default:()=>u,frontMatter:()=>l,metadata:()=>d,toc:()=>s});var n=a(87462),r=(a(67294),a(3905));const l={},o="database",d={unversionedId:"reference/model/catalog_models/database/doc_database",id:"version-v0.9/reference/model/catalog_models/database/doc_database",title:"database",description:"Schema Database",source:"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/database/doc_database.md",sourceDirName:"reference/model/catalog_models/database",slug:"/reference/model/catalog_models/database/doc_database",permalink:"/docs/v0.9/reference/model/catalog_models/database/doc_database",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/catalog_models/database/doc_database.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Service",permalink:"/docs/v0.9/reference/model/catalog_models/workload/doc_service"},next:{title:"prometheus",permalink:"/docs/v0.9/reference/model/catalog_models/monitoring/doc_prometheus"}},i={},s=[{value:"Schema Database",id:"schema-database",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:s};function u(t){let{components:e,...a}=t;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"database"},"database"),(0,r.kt)("h2",{id:"schema-database"},"Schema Database"),(0,r.kt)("p",null,"As an important supporting accessory, Database describes the attributes",(0,r.kt)("br",null),"to locally deploy or create a cloud provider managed database instance for ",(0,r.kt)("br",null),"the workload. "),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type"),(0,r.kt)("br",null),"Type defines the local deployment mode or the specific cloud vendor that ",(0,r.kt)("br",null),"provides the relational database service (rds)."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"engine"),(0,r.kt)("br",null),"Engine defines the database engine to use."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"version"),(0,r.kt)("br",null),"Version defines the database engine version to use."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"instanceType"),(0,r.kt)("br",null),"InstanceType defines the type of the database which is required when ",(0,r.kt)("br",null),"creating an rds instance provided by the cloud vendor."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"size"),(0,r.kt)("br",null),"Size defines the allocated storage size of the rds instance provided by ",(0,r.kt)("br",null),"the cloud vendor in GB."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"10"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"category"),(0,r.kt)("br",null),"Category defines the edition of the rds instance provided by the cloud ",(0,r.kt)("br",null),"vendor."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},'"Basic"'),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"username"),(0,r.kt)("br",null),"Username defines the operation account for the database."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},'"root"'),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"securityIPs"),(0,r.kt)("br",null),"SecurityIPs defines the list of IP addresses allowed to access the rds ",(0,r.kt)("br",null),"instance provided by the cloud vendor."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},'["0.0.0.0/0"]'),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"subnetID"),(0,r.kt)("br",null),"SubnetID defines the virtual subnet ID associated with the VPC that the rds ",(0,r.kt)("br",null),"instance will be created in."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"privateLink"),(0,r.kt)("br",null),"PrivateLink defines whether the host address of the rds instance for the workload ",(0,r.kt)("br",null),"to connect with is via public network or private network of the cloud vendor."),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"True"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"extraMap"),(0,r.kt)("br",null),"ExtraMap defines the diversified rds configuration items from different",(0,r.kt)("br",null),"cloud vendors."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'Instantiate an aws rds with mysql 5.7. \n\nimport catalog.models.schema.v1.accessories.database as db\n\ndatabase: db.Database {\n type: "aws"\n engine: "mysql"\n version: "5.7"\n instanceType: "db.t3.micro"\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/66add7b5.79b514ea.js b/assets/js/66add7b5.79b514ea.js deleted file mode 100644 index cc695829b59..00000000000 --- a/assets/js/66add7b5.79b514ea.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4335],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),u=p(r),m=o,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||a;return r?n.createElement(f,c(c({ref:t},l),{},{components:r})):n.createElement(f,c({ref:t},l))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,c=new Array(a);c[0]=u;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,c[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>d,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},c="kusion stack create",i={unversionedId:"reference/commands/kusion-stack-create",id:"version-v0.11/reference/commands/kusion-stack-create",title:"kusion stack create",description:"Create a new stack",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-stack-create.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-stack-create",permalink:"/docs/reference/commands/kusion-stack-create",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-stack-create.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion project",permalink:"/docs/reference/commands/kusion-project"},next:{title:"kusion stack",permalink:"/docs/reference/commands/kusion-stack"}},s={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-stack-create"},"kusion stack create"),(0,o.kt)("p",null,"Create a new stack"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command creates a new stack under the target directory which by default is the current working directory."),(0,o.kt)("p",null," The stack folder to be created contains 'stack.yaml', 'kcl.mod' and 'main.k' with the specified values."),(0,o.kt)("p",null," Note that the target directory needs to be a valid project directory with project.yaml file"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion stack create\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Create a new stack at current project directory\n kusion stack create dev\n \n # Create a new stack in a specified target project directory\n kusion stack create dev --target /dir/to/projects/my-project\n \n # Create a new stack copied from the referenced stack under the target project directory\n kusion stack create prod --copy-from dev\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --copy-from string specify the referenced stack path to copy from\n -h, --help help for create\n -t, --target string specify the target project directory\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-stack"},"kusion stack"),"\t - Stack is a folder that contains a stack.yaml file within the corresponding project directory")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/66add7b5.8c7bc2be.js b/assets/js/66add7b5.8c7bc2be.js new file mode 100644 index 00000000000..38e4f5fc53e --- /dev/null +++ b/assets/js/66add7b5.8c7bc2be.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4335],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),u=p(r),m=o,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||a;return r?n.createElement(f,c(c({ref:t},l),{},{components:r})):n.createElement(f,c({ref:t},l))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,c=new Array(a);c[0]=u;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,c[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>d,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},c="kusion stack create",i={unversionedId:"reference/commands/kusion-stack-create",id:"version-v0.11/reference/commands/kusion-stack-create",title:"kusion stack create",description:"Create a new stack",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-stack-create.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-stack-create",permalink:"/docs/reference/commands/kusion-stack-create",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-stack-create.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion project",permalink:"/docs/reference/commands/kusion-project"},next:{title:"kusion stack",permalink:"/docs/reference/commands/kusion-stack"}},s={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-stack-create"},"kusion stack create"),(0,o.kt)("p",null,"Create a new stack"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command creates a new stack under the target directory which by default is the current working directory."),(0,o.kt)("p",null," The stack folder to be created contains 'stack.yaml', 'kcl.mod' and 'main.k' with the specified values."),(0,o.kt)("p",null," Note that the target directory needs to be a valid project directory with project.yaml file"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion stack create\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Create a new stack at current project directory\n kusion stack create dev\n \n # Create a new stack in a specified target project directory\n kusion stack create dev --target /dir/to/projects/my-project\n \n # Create a new stack copied from the referenced stack under the target project directory\n kusion stack create prod --copy-from dev\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --copy-from string specify the referenced stack path to copy from\n -h, --help help for create\n -t, --target string specify the target project directory\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-stack"},"kusion stack"),"\t - Stack is a folder that contains a stack.yaml file within the corresponding project directory")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/68966825.36ce7642.js b/assets/js/68966825.36ce7642.js new file mode 100644 index 00000000000..1d3563ff22e --- /dev/null +++ b/assets/js/68966825.36ce7642.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9507],{3905:(e,t,o)=>{o.d(t,{Zo:()=>c,kt:()=>h});var n=o(67294);function i(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function a(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function r(e){for(var t=1;t=0||(i[o]=e[o]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(i[o]=e[o])}return i}var l=n.createContext({}),p=function(e){var t=n.useContext(l),o=t;return e&&(o="function"==typeof e?e(t):r(r({},t),e)),o},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var o=e.components,i=e.mdxType,a=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(o),h=i,m=d["".concat(l,".").concat(h)]||d[h]||u[h]||a;return o?n.createElement(m,r(r({ref:t},c),{},{components:o})):n.createElement(m,r({ref:t},c))}));function h(e,t){var o=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=o.length,r=new Array(a);r[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,r[1]=s;for(var p=2;p{o.r(t),o.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=o(87462),i=(o(67294),o(3905));const a={id:"overview",title:"Overview",slug:"/"},r="Overview",s={unversionedId:"what-is-kusion/overview",id:"version-v0.11/what-is-kusion/overview",title:"Overview",description:"Welcome to Kusion! This introduction section covers what Kusion is, the problem Kusion aims to solve, and how Kusion compares to other software. If you just want to dive into using Kusion, feel free to skip ahead to the Getting Started section.",source:"@site/docs_versioned_docs/version-v0.11/1-what-is-kusion/1-overview.md",sourceDirName:"1-what-is-kusion",slug:"/",permalink:"/docs/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/1-what-is-kusion/1-overview.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"overview",title:"Overview",slug:"/"},sidebar:"kusion",next:{title:"Kusion vs Other Software",permalink:"/docs/what-is-kusion/kusion-vs-x"}},l={},p=[{value:"What is Kusion?",id:"what-is-kusion",level:2},{value:"Why Kusion?",id:"why-kusion",level:2},{value:"Kusion Highlights",id:"kusion-highlights",level:2}],c={toc:p};function u(e){let{components:t,...o}=e;return(0,i.kt)("wrapper",(0,n.Z)({},c,o,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"overview"},"Overview"),(0,i.kt)("p",null,"Welcome to Kusion! This introduction section covers what Kusion is, the problem Kusion aims to solve, and how Kusion compares to other software. If you just want to dive into using Kusion, feel free to skip ahead to the ",(0,i.kt)("a",{parentName:"p",href:"getting-started/install-kusion"},"Getting Started")," section."),(0,i.kt)("h2",{id:"what-is-kusion"},"What is Kusion?"),(0,i.kt)("p",null,"Kusion is an intent-based Platform Orchestrator that enables developers to specify their desired intent in a declarative way and then using a consistent workflow to drive continuous deployment through application lifecycle. Inspired by the phrase ",(0,i.kt)("strong",{parentName:"p"},"Fusion on Kubernetes"),", Kusion aims to help application and platform developers to develop and deliver in a self-serviceable, fast, reliable, and collaborative way."),(0,i.kt)("p",null,(0,i.kt)("img",{parentName:"p",src:"https://raw.githubusercontent.com/KusionStack/kusion/main/docs/workflow.png",alt:"arch"})),(0,i.kt)("h2",{id:"why-kusion"},"Why Kusion?"),(0,i.kt)("p",null,"Developers should be able to deploy and run their applications and services end to end. ",(0,i.kt)("strong",{parentName:"p"},'"You build it, you run it", the original promise of DevOps.')),(0,i.kt)("p",null,"But the modern day for most software organizations this promise quickly become unrelalistic since the increasingly complex cloud-native toolchains, while cloud native technologies made huge improvements in areas such as scalability, availability and operability, it also brings downside - the growing burden on developers, which leads to the rise of ",(0,i.kt)("a",{parentName:"p",href:"https://platformengineering.org/"},"Platform Engineering"),"."),(0,i.kt)("p",null,"Another challenge we saw is that a series of ",(0,i.kt)("a",{parentName:"p",href:"https://web.devopstopologies.com/#anti-types"},"antipatterns")," emerge when regular software organizations tries to implement true DevOps. Without well proven reference architecture and supporting tools, it's much more difficult to accomplish the original promise."),(0,i.kt)("p",null,"On one hand, ",(0,i.kt)("strong",{parentName:"p"},"Kusion was build to minimize developer's cognitive load"),". With application-centric configuration model, you don't need to deal with tedious infrastructure and configuration management tooling, all you need to be familiar with is ",(0,i.kt)("a",{parentName:"p",href:"configuration-walkthrough/overview"},"AppConfiguration"),". This approach shields developers from the configurational complexity of Kubernetes but still enable standardization by design."),(0,i.kt)("p",null,"On the other hand, ",(0,i.kt)("strong",{parentName:"p"},"Kusion defines a new way for different engineering organizations to collaborate"),'. With the separation of concerns, different roles could focus on their aspects of the configuration based on their knowledge and responsibility, whereas Kusion will dynamically manage and "glue" the opinionated configurations together. Through such a division of labor, the platform team can better manage the differences and complexities of the platform, and app developers could participate in ops work with much less cognitive load.'),(0,i.kt)("h2",{id:"kusion-highlights"},"Kusion Highlights"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Platform as Code")),(0,i.kt)("p",{parentName:"li"},"Specify desired application intent through declarative configuration code, drive continuous deployment with any CI/CD systems or GitOps to match that intent. No ad-hoc scripts, no hard maintain custom workflows, just declarative configuration code.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Dynamic Configuration Management")),(0,i.kt)("p",{parentName:"li"},"Enable platform teams to set baseline-templates, control how and where to deploy application workloads and provision accessory resources. While still enabling application developers freedom via workload-centric specification and deployment. ")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Security & Compliance Built In")),(0,i.kt)("p",{parentName:"li"},"Enforce security and infrastructure best practices with out-of-box ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"base models"),", create security and compliance guardrails for any Kusion deploy with third-party Policy as Code tools. All accessory resource secrets are automatically injected into Workloads.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Lightweight and Open Model Ecosystem")),(0,i.kt)("p",{parentName:"li"},"Pure client-side solution ensures good portability and the rich APIs make it easier to integrate and automate. Large growing model ecosystem covers all stages in application lifecycle, with extensive connections to various infrastructure capabilities. "))),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("strong",{parentName:"p"},"Kusion is an early project.")," The end goal of Kusion is to boost ",(0,i.kt)("a",{parentName:"p",href:"https://internaldeveloperplatform.org/"},"Internal Developer Platform")," revolution, and we are iterating on Kusion quickly to strive towards this goal. For any help or feedback, please contact us in ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/community/discussions/categories/meeting"},"Slack")," or ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/issues"},"issues"),".")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/68966825.921ddbb7.js b/assets/js/68966825.921ddbb7.js deleted file mode 100644 index f8ea8ef17d8..00000000000 --- a/assets/js/68966825.921ddbb7.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9507],{3905:(e,t,o)=>{o.d(t,{Zo:()=>c,kt:()=>h});var n=o(67294);function i(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function a(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function r(e){for(var t=1;t=0||(i[o]=e[o]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(i[o]=e[o])}return i}var l=n.createContext({}),p=function(e){var t=n.useContext(l),o=t;return e&&(o="function"==typeof e?e(t):r(r({},t),e)),o},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var o=e.components,i=e.mdxType,a=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(o),h=i,m=d["".concat(l,".").concat(h)]||d[h]||u[h]||a;return o?n.createElement(m,r(r({ref:t},c),{},{components:o})):n.createElement(m,r({ref:t},c))}));function h(e,t){var o=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=o.length,r=new Array(a);r[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,r[1]=s;for(var p=2;p{o.r(t),o.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=o(87462),i=(o(67294),o(3905));const a={id:"overview",title:"Overview",slug:"/"},r="Overview",s={unversionedId:"what-is-kusion/overview",id:"version-v0.11/what-is-kusion/overview",title:"Overview",description:"Welcome to Kusion! This introduction section covers what Kusion is, the problem Kusion aims to solve, and how Kusion compares to other software. If you just want to dive into using Kusion, feel free to skip ahead to the Getting Started section.",source:"@site/docs_versioned_docs/version-v0.11/1-what-is-kusion/1-overview.md",sourceDirName:"1-what-is-kusion",slug:"/",permalink:"/docs/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/1-what-is-kusion/1-overview.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"overview",title:"Overview",slug:"/"},sidebar:"kusion",next:{title:"Kusion vs Other Software",permalink:"/docs/what-is-kusion/kusion-vs-x"}},l={},p=[{value:"What is Kusion?",id:"what-is-kusion",level:2},{value:"Why Kusion?",id:"why-kusion",level:2},{value:"Kusion Highlights",id:"kusion-highlights",level:2}],c={toc:p};function u(e){let{components:t,...o}=e;return(0,i.kt)("wrapper",(0,n.Z)({},c,o,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"overview"},"Overview"),(0,i.kt)("p",null,"Welcome to Kusion! This introduction section covers what Kusion is, the problem Kusion aims to solve, and how Kusion compares to other software. If you just want to dive into using Kusion, feel free to skip ahead to the ",(0,i.kt)("a",{parentName:"p",href:"getting-started/install-kusion"},"Getting Started")," section."),(0,i.kt)("h2",{id:"what-is-kusion"},"What is Kusion?"),(0,i.kt)("p",null,"Kusion is an intent-based Platform Orchestrator that enables developers to specify their desired intent in a declarative way and then using a consistent workflow to drive continuous deployment through application lifecycle. Inspired by the phrase ",(0,i.kt)("strong",{parentName:"p"},"Fusion on Kubernetes"),", Kusion aims to help application and platform developers to develop and deliver in a self-serviceable, fast, reliable, and collaborative way."),(0,i.kt)("p",null,(0,i.kt)("img",{parentName:"p",src:"https://raw.githubusercontent.com/KusionStack/kusion/main/docs/workflow.png",alt:"arch"})),(0,i.kt)("h2",{id:"why-kusion"},"Why Kusion?"),(0,i.kt)("p",null,"Developers should be able to deploy and run their applications and services end to end. ",(0,i.kt)("strong",{parentName:"p"},'"You build it, you run it", the original promise of DevOps.')),(0,i.kt)("p",null,"But the modern day for most software organizations this promise quickly become unrelalistic since the increasingly complex cloud-native toolchains, while cloud native technologies made huge improvements in areas such as scalability, availability and operability, it also brings downside - the growing burden on developers, which leads to the rise of ",(0,i.kt)("a",{parentName:"p",href:"https://platformengineering.org/"},"Platform Engineering"),"."),(0,i.kt)("p",null,"Another challenge we saw is that a series of ",(0,i.kt)("a",{parentName:"p",href:"https://web.devopstopologies.com/#anti-types"},"antipatterns")," emerge when regular software organizations tries to implement true DevOps. Without well proven reference architecture and supporting tools, it's much more difficult to accomplish the original promise."),(0,i.kt)("p",null,"On one hand, ",(0,i.kt)("strong",{parentName:"p"},"Kusion was build to minimize developer's cognitive load"),". With application-centric configuration model, you don't need to deal with tedious infrastructure and configuration management tooling, all you need to be familiar with is ",(0,i.kt)("a",{parentName:"p",href:"configuration-walkthrough/overview"},"AppConfiguration"),". This approach shields developers from the configurational complexity of Kubernetes but still enable standardization by design."),(0,i.kt)("p",null,"On the other hand, ",(0,i.kt)("strong",{parentName:"p"},"Kusion defines a new way for different engineering organizations to collaborate"),'. With the separation of concerns, different roles could focus on their aspects of the configuration based on their knowledge and responsibility, whereas Kusion will dynamically manage and "glue" the opinionated configurations together. Through such a division of labor, the platform team can better manage the differences and complexities of the platform, and app developers could participate in ops work with much less cognitive load.'),(0,i.kt)("h2",{id:"kusion-highlights"},"Kusion Highlights"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Platform as Code")),(0,i.kt)("p",{parentName:"li"},"Specify desired application intent through declarative configuration code, drive continuous deployment with any CI/CD systems or GitOps to match that intent. No ad-hoc scripts, no hard maintain custom workflows, just declarative configuration code.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Dynamic Configuration Management")),(0,i.kt)("p",{parentName:"li"},"Enable platform teams to set baseline-templates, control how and where to deploy application workloads and provision accessory resources. While still enabling application developers freedom via workload-centric specification and deployment. ")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Security & Compliance Built In")),(0,i.kt)("p",{parentName:"li"},"Enforce security and infrastructure best practices with out-of-box ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"base models"),", create security and compliance guardrails for any Kusion deploy with third-party Policy as Code tools. All accessory resource secrets are automatically injected into Workloads.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Lightweight and Open Model Ecosystem")),(0,i.kt)("p",{parentName:"li"},"Pure client-side solution ensures good portability and the rich APIs make it easier to integrate and automate. Large growing model ecosystem covers all stages in application lifecycle, with extensive connections to various infrastructure capabilities. "))),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("strong",{parentName:"p"},"Kusion is an early project.")," The end goal of Kusion is to boost ",(0,i.kt)("a",{parentName:"p",href:"https://internaldeveloperplatform.org/"},"Internal Developer Platform")," revolution, and we are iterating on Kusion quickly to strive towards this goal. For any help or feedback, please contact us in ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/community/discussions/categories/meeting"},"Slack")," or ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/issues"},"issues"),".")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6a5caa1d.3ca38124.js b/assets/js/6a5caa1d.3ca38124.js new file mode 100644 index 00000000000..fb5c69edc84 --- /dev/null +++ b/assets/js/6a5caa1d.3ca38124.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9441],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var p=a.createContext({}),s=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=s(e.components);return a.createElement(p.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,i=e.mdxType,r=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(t),m=i,k=u["".concat(p,".").concat(m)]||u[m]||d[m]||r;return t?a.createElement(k,o(o({ref:n},c),{},{components:t})):a.createElement(k,o({ref:n},c))}));function m(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var r=t.length,o=new Array(r);o[0]=u;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:i,o[1]=l;for(var s=2;s{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>o,default:()=>d,frontMatter:()=>r,metadata:()=>l,toc:()=>s});var a=t(87462),i=(t(67294),t(3905));const r={id:"container"},o="Configure Containers",l={unversionedId:"user-guides/working-with-k8s/container",id:"version-v0.11/user-guides/working-with-k8s/container",title:"Configure Containers",description:"You can manage container-level configurations in the AppConfiguration model via the containers field (under the workload schema). By default, everything defined in the containers field will be treated as application containers. Sidecar containers will be supported in a future version of kusion.",source:"@site/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/2-container.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/container",permalink:"/docs/user-guides/working-with-k8s/container",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/2-container.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"container"},sidebar:"kusion",previous:{title:"Deploy Application",permalink:"/docs/user-guides/working-with-k8s/deploy-application"},next:{title:"Expose Service",permalink:"/docs/user-guides/working-with-k8s/service"}},p={},s=[{value:"Pre-requisite",id:"pre-requisite",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Apply",id:"apply",level:2},{value:"Validation",id:"validation",level:2}],c={toc:s};function d(e){let{components:n,...t}=e;return(0,i.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"configure-containers"},"Configure Containers"),(0,i.kt)("p",null,"You can manage container-level configurations in the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model via the ",(0,i.kt)("inlineCode",{parentName:"p"},"containers")," field (under the ",(0,i.kt)("inlineCode",{parentName:"p"},"workload")," schema). By default, everything defined in the ",(0,i.kt)("inlineCode",{parentName:"p"},"containers")," field will be treated as application containers. Sidecar containers will be supported in a future version of kusion."),(0,i.kt)("p",null,"For the full ",(0,i.kt)("inlineCode",{parentName:"p"},"Container")," schema reference, please see ",(0,i.kt)("a",{parentName:"p",href:"../../reference/modules/developer-schemas/workload/service#schema-container"},"here")," for more details."),(0,i.kt)("h2",{id:"pre-requisite"},"Pre-requisite"),(0,i.kt)("p",null,"Please refer to the ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,i.kt)("p",null,"The example below also requires you to have ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,i.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,i.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,i.kt)("p",null,"In the last guide, we introduced a step to ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,i.kt)("p",null,"However, if you (or the platform team) would like to set default values for the workloads to standardize the behavior of applications in the ",(0,i.kt)("inlineCode",{parentName:"p"},"dev")," workspace, you can do so by updating the ",(0,i.kt)("inlineCode",{parentName:"p"},"~/dev.yaml"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n service:\n default:\n replicas: 3\n labels:\n label-key: label-value\n annotations:\n annotation-key: annotation-value\n type: CollaSet\n")),(0,i.kt)("p",null,"Please note that the ",(0,i.kt)("inlineCode",{parentName:"p"},"replicas")," in the workspace configuration only works as a default value and will be overridden by the value set in the application configuration."),(0,i.kt)("p",null,"The workspace configuration need to be updated with the command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace update dev -f ~/dev.yaml\n")),(0,i.kt)("p",null,"For a full reference of what can be configured in the workspace level, please see the ",(0,i.kt)("a",{parentName:"p",href:"../../reference/modules/workspace-configs/workload/service"},"workspace reference"),"."),(0,i.kt)("h2",{id:"example"},"Example"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\n\n"helloworld": ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "helloworld": c.Container {\n image = "gcr.io/google-samples/gb-frontend:v4"\n env: {\n "env1": "VALUE"\n "env2": "VALUE2"\n }\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n # Configure an HTTP readiness probe\n readinessProbe: p.Probe {\n probeHandler: p.Http {\n url: "http://localhost:80"\n }\n initialDelaySeconds: 10\n }\n }\n }\n replicas: 2\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n }\n}\n')),(0,i.kt)("h2",{id:"apply"},"Apply"),(0,i.kt)("p",null,"Re-run steps in ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", new container configuration can be applied."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private UnChanged\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Update\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS UnChanged v1:Service:simple-service:simple-service-dev-helloworld-private, skip \n SUCCESS Update apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \nUpdate apps/v1:Deployment:simple-service:simple-service-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,i.kt)("h2",{id:"validation"},"Validation"),(0,i.kt)("p",null,"We can verify the container (in the deployment template) now has the updated attributes as defined in the container configuration:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"$ kubectl get deployment -n simple-service -o yaml\n...\n template:\n ...\n spec:\n containers:\n - env:\n - name: env1\n value: VALUE\n - name: env2\n value: VALUE2\n image: gcr.io/google-samples/gb-frontend:v4\n imagePullPolicy: IfNotPresent\n name: helloworld\n readinessProbe:\n failureThreshold: 3\n httpGet:\n host: localhost\n path: /\n port: 80\n scheme: HTTP\n initialDelaySeconds: 10\n periodSeconds: 10\n successThreshold: 1\n timeoutSeconds: 1\n resources:\n limits:\n cpu: 500m\n memory: 512M\n...\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6a5caa1d.d20023dc.js b/assets/js/6a5caa1d.d20023dc.js deleted file mode 100644 index a0e85671dff..00000000000 --- a/assets/js/6a5caa1d.d20023dc.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9441],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var p=a.createContext({}),s=function(e){var n=a.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=s(e.components);return a.createElement(p.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,i=e.mdxType,r=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(t),m=i,k=u["".concat(p,".").concat(m)]||u[m]||d[m]||r;return t?a.createElement(k,o(o({ref:n},c),{},{components:t})):a.createElement(k,o({ref:n},c))}));function m(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var r=t.length,o=new Array(r);o[0]=u;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:i,o[1]=l;for(var s=2;s{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>o,default:()=>d,frontMatter:()=>r,metadata:()=>l,toc:()=>s});var a=t(87462),i=(t(67294),t(3905));const r={id:"container"},o="Configure Containers",l={unversionedId:"user-guides/working-with-k8s/container",id:"version-v0.11/user-guides/working-with-k8s/container",title:"Configure Containers",description:"You can manage container-level configurations in the AppConfiguration model via the containers field (under the workload schema). By default, everything defined in the containers field will be treated as application containers. Sidecar containers will be supported in a future version of kusion.",source:"@site/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/2-container.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/container",permalink:"/docs/user-guides/working-with-k8s/container",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/2-container.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"container"},sidebar:"kusion",previous:{title:"Deploy Application",permalink:"/docs/user-guides/working-with-k8s/deploy-application"},next:{title:"Expose Service",permalink:"/docs/user-guides/working-with-k8s/service"}},p={},s=[{value:"Pre-requisite",id:"pre-requisite",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Apply",id:"apply",level:2},{value:"Validation",id:"validation",level:2}],c={toc:s};function d(e){let{components:n,...t}=e;return(0,i.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"configure-containers"},"Configure Containers"),(0,i.kt)("p",null,"You can manage container-level configurations in the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model via the ",(0,i.kt)("inlineCode",{parentName:"p"},"containers")," field (under the ",(0,i.kt)("inlineCode",{parentName:"p"},"workload")," schema). By default, everything defined in the ",(0,i.kt)("inlineCode",{parentName:"p"},"containers")," field will be treated as application containers. Sidecar containers will be supported in a future version of kusion."),(0,i.kt)("p",null,"For the full ",(0,i.kt)("inlineCode",{parentName:"p"},"Container")," schema reference, please see ",(0,i.kt)("a",{parentName:"p",href:"../../reference/modules/developer-schemas/workload/service#schema-container"},"here")," for more details."),(0,i.kt)("h2",{id:"pre-requisite"},"Pre-requisite"),(0,i.kt)("p",null,"Please refer to the ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,i.kt)("p",null,"The example below also requires you to have ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,i.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,i.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,i.kt)("p",null,"In the last guide, we introduced a step to ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,i.kt)("p",null,"However, if you (or the platform team) would like to set default values for the workloads to standardize the behavior of applications in the ",(0,i.kt)("inlineCode",{parentName:"p"},"dev")," workspace, you can do so by updating the ",(0,i.kt)("inlineCode",{parentName:"p"},"~/dev.yaml"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n service:\n default:\n replicas: 3\n labels:\n label-key: label-value\n annotations:\n annotation-key: annotation-value\n type: CollaSet\n")),(0,i.kt)("p",null,"Please note that the ",(0,i.kt)("inlineCode",{parentName:"p"},"replicas")," in the workspace configuration only works as a default value and will be overridden by the value set in the application configuration."),(0,i.kt)("p",null,"The workspace configuration need to be updated with the command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace update dev -f ~/dev.yaml\n")),(0,i.kt)("p",null,"For a full reference of what can be configured in the workspace level, please see the ",(0,i.kt)("a",{parentName:"p",href:"../../reference/modules/workspace-configs/workload/service"},"workspace reference"),"."),(0,i.kt)("h2",{id:"example"},"Example"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\n\n"helloworld": ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "helloworld": c.Container {\n image = "gcr.io/google-samples/gb-frontend:v4"\n env: {\n "env1": "VALUE"\n "env2": "VALUE2"\n }\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n # Configure an HTTP readiness probe\n readinessProbe: p.Probe {\n probeHandler: p.Http {\n url: "http://localhost:80"\n }\n initialDelaySeconds: 10\n }\n }\n }\n replicas: 2\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n }\n}\n')),(0,i.kt)("h2",{id:"apply"},"Apply"),(0,i.kt)("p",null,"Re-run steps in ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", new container configuration can be applied."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private UnChanged\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Update\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS UnChanged v1:Service:simple-service:simple-service-dev-helloworld-private, skip \n SUCCESS Update apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \nUpdate apps/v1:Deployment:simple-service:simple-service-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,i.kt)("h2",{id:"validation"},"Validation"),(0,i.kt)("p",null,"We can verify the container (in the deployment template) now has the updated attributes as defined in the container configuration:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"$ kubectl get deployment -n simple-service -o yaml\n...\n template:\n ...\n spec:\n containers:\n - env:\n - name: env1\n value: VALUE\n - name: env2\n value: VALUE2\n image: gcr.io/google-samples/gb-frontend:v4\n imagePullPolicy: IfNotPresent\n name: helloworld\n readinessProbe:\n failureThreshold: 3\n httpGet:\n host: localhost\n path: /\n port: 80\n scheme: HTTP\n initialDelaySeconds: 10\n periodSeconds: 10\n successThreshold: 1\n timeoutSeconds: 1\n resources:\n limits:\n cpu: 500m\n memory: 512M\n...\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6b2b9057.76e77f82.js b/assets/js/6b2b9057.76e77f82.js new file mode 100644 index 00000000000..ddd66a24fd4 --- /dev/null +++ b/assets/js/6b2b9057.76e77f82.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3925],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=r.createContext({}),l=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=l(e.components);return r.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),u=l(n),m=i,h=u["".concat(s,".").concat(m)]||u[m]||d[m]||a;return n?r.createElement(h,o(o({ref:t},c),{},{components:n})):r.createElement(h,o({ref:t},c))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,o=new Array(a);o[0]=u;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p.mdxType="string"==typeof e?e:i,o[1]=p;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>p,toc:()=>l});var r=n(87462),i=(n(67294),n(3905));const a={},o="Expose Service",p={unversionedId:"user-guides/working-with-k8s/service",id:"version-v0.10/user-guides/working-with-k8s/service",title:"Expose Service",description:"You can determine how to expose your service in the AppConfiguration model via the ports field (under the workload schemas). The ports field defines a list of all the Ports you want to expose for the application (and their corresponding listening ports on the container, if they don't match the service ports), so that it can be consumed by other applications.",source:"@site/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/3-service.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/service",permalink:"/docs/v0.10/user-guides/working-with-k8s/service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/3-service.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{},sidebar:"kusion",previous:{title:"Configure Containers",permalink:"/docs/v0.10/user-guides/working-with-k8s/container"},next:{title:"Upgrade Image",permalink:"/docs/v0.10/user-guides/working-with-k8s/image-upgrade"}},s={},l=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],c={toc:l};function d(e){let{components:t,...a}=e;return(0,i.kt)("wrapper",(0,r.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"expose-service"},"Expose Service"),(0,i.kt)("p",null,"You can determine how to expose your service in the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model via the ",(0,i.kt)("inlineCode",{parentName:"p"},"ports")," field (under the ",(0,i.kt)("inlineCode",{parentName:"p"},"workload")," schemas). The ",(0,i.kt)("inlineCode",{parentName:"p"},"ports")," field defines a list of all the ",(0,i.kt)("inlineCode",{parentName:"p"},"Port"),"s you want to expose for the application (and their corresponding listening ports on the container, if they don't match the service ports), so that it can be consumed by other applications."),(0,i.kt)("p",null,"Unless explicitly defined, each of the ports exposed is by default exposed privately as a ",(0,i.kt)("inlineCode",{parentName:"p"},"ClusterIP")," type service. You can expose a port publicly by specifying the ",(0,i.kt)("inlineCode",{parentName:"p"},"exposeInternet")," field in the ",(0,i.kt)("inlineCode",{parentName:"p"},"Port")," schema. At the moment, the implementation for publicly access is done via Load Balancer type service backed by cloud providers. Ingress will be supported in a future version of kusion."),(0,i.kt)("p",null,"For the ",(0,i.kt)("inlineCode",{parentName:"p"},"Port")," schema reference, please see ",(0,i.kt)("a",{parentName:"p",href:"../../reference/modules/catalog-models/workload/service#schema-port"},"here")," for more details."),(0,i.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,i.kt)("p",null,"Please refer to the ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,i.kt)("p",null,"The example below also requires you to have ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,i.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,i.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,i.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,i.kt)("p",null,"However, if you (or the platform team) would like to set default values for the services to standardize the behavior of applications in the ",(0,i.kt)("inlineCode",{parentName:"p"},"dev")," workspace, you can do so by updating the ",(0,i.kt)("inlineCode",{parentName:"p"},"~/dev.yaml"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n port:\n default:\n type: alicloud\n labels:\n kusionstack.io/control: "true"\n annotations:\n service.beta.kubernetes.io/alibaba-cloud-loadbalancer-spec: slb.s1.small\n')),(0,i.kt)("p",null,"The workspace configuration need to be updated with the command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace update dev -f ~/dev.yaml\n")),(0,i.kt)("p",null,"For a full reference of what can be configured in the workspace level, please see the ",(0,i.kt)("a",{parentName:"p",href:"../../reference/modules/workspace-configs/networking/port"},"workspace reference"),"."),(0,i.kt)("h2",{id:"example"},"Example"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-py"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.network as n\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "helloworld": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v4"\n env: {\n "env1": "VALUE"\n "env2": "VALUE2"\n }\n resources: {\n "cpu": "500m"\n "memory": "512M"\n }\n # Configure an HTTP readiness probe\n readinessProbe: p.Probe {\n probeHandler: p.Http {\n url: "http://localhost:80"\n }\n initialDelaySeconds: 10\n }\n }\n }\n replicas: 2\n ports: [\n n.Port {\n port: 8080\n targetPort: 80\n }\n ]\n }\n}\n')),(0,i.kt)("p",null,"The code above changes the service port to expose from ",(0,i.kt)("inlineCode",{parentName:"p"},"80")," in the last guide to ",(0,i.kt)("inlineCode",{parentName:"p"},"8080"),", but still targeting the container port ",(0,i.kt)("inlineCode",{parentName:"p"},"80")," because that's what the application is listening on."),(0,i.kt)("h2",{id:"applying"},"Applying"),(0,i.kt)("p",null,"Re-run steps in ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", new service configuration can be applied."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Intent in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private Update\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld UnChanged\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS Update v1:Service:simple-service:simple-service-dev-helloworld-private success \n SUCCESS UnChanged apps/v1:Deployment:simple-service:simple-service-dev-helloworld, skip \nUnChanged apps/v1:Deployment:simple-service:simple-service-dev-helloworld, skip [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,i.kt)("h2",{id:"validation"},"Validation"),(0,i.kt)("p",null,"We can verify the Kubernetes service now has the updated attributes (mapping service port 8080 to container port 80) as defined in the ",(0,i.kt)("inlineCode",{parentName:"p"},"ports")," configuration:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"kubectl get svc -n simple-service -o yaml\n...\n spec:\n ...\n ports:\n - name: simple-service-dev-helloworld-private-8080-tcp\n port: 8080\n protocol: TCP\n targetPort: 80\n...\n")),(0,i.kt)("p",null,"Exposing service port 8080:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"kubectl port-forward svc/simple-service-dev-helloworld-private -n simple-service 30000:8080\n")),(0,i.kt)("p",null,"Open browser and visit ",(0,i.kt)("a",{parentName:"p",href:"http://127.0.0.1:30000"},"http://127.0.0.1:30000"),", the application should be up and running\uff1a"),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"app-preview",src:n(92287).Z,width:"1830",height:"330"})))}d.isMDXComponent=!0},92287:(e,t,n)=>{n.d(t,{Z:()=>r});const r=n.p+"assets/images/app-preview-de5274f4267fa725d2a65099e47c6c2c.png"}}]); \ No newline at end of file diff --git a/assets/js/6b2b9057.81d9e7c2.js b/assets/js/6b2b9057.81d9e7c2.js deleted file mode 100644 index ad029586112..00000000000 --- a/assets/js/6b2b9057.81d9e7c2.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3925],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=r.createContext({}),l=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=l(e.components);return r.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),u=l(n),m=i,h=u["".concat(s,".").concat(m)]||u[m]||d[m]||a;return n?r.createElement(h,o(o({ref:t},c),{},{components:n})):r.createElement(h,o({ref:t},c))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,o=new Array(a);o[0]=u;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p.mdxType="string"==typeof e?e:i,o[1]=p;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>p,toc:()=>l});var r=n(87462),i=(n(67294),n(3905));const a={},o="Expose Service",p={unversionedId:"user-guides/working-with-k8s/service",id:"version-v0.10/user-guides/working-with-k8s/service",title:"Expose Service",description:"You can determine how to expose your service in the AppConfiguration model via the ports field (under the workload schemas). The ports field defines a list of all the Ports you want to expose for the application (and their corresponding listening ports on the container, if they don't match the service ports), so that it can be consumed by other applications.",source:"@site/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/3-service.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/service",permalink:"/docs/v0.10/user-guides/working-with-k8s/service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/3-service.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{},sidebar:"kusion",previous:{title:"Configure Containers",permalink:"/docs/v0.10/user-guides/working-with-k8s/container"},next:{title:"Upgrade Image",permalink:"/docs/v0.10/user-guides/working-with-k8s/image-upgrade"}},s={},l=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],c={toc:l};function d(e){let{components:t,...a}=e;return(0,i.kt)("wrapper",(0,r.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"expose-service"},"Expose Service"),(0,i.kt)("p",null,"You can determine how to expose your service in the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model via the ",(0,i.kt)("inlineCode",{parentName:"p"},"ports")," field (under the ",(0,i.kt)("inlineCode",{parentName:"p"},"workload")," schemas). The ",(0,i.kt)("inlineCode",{parentName:"p"},"ports")," field defines a list of all the ",(0,i.kt)("inlineCode",{parentName:"p"},"Port"),"s you want to expose for the application (and their corresponding listening ports on the container, if they don't match the service ports), so that it can be consumed by other applications."),(0,i.kt)("p",null,"Unless explicitly defined, each of the ports exposed is by default exposed privately as a ",(0,i.kt)("inlineCode",{parentName:"p"},"ClusterIP")," type service. You can expose a port publicly by specifying the ",(0,i.kt)("inlineCode",{parentName:"p"},"exposeInternet")," field in the ",(0,i.kt)("inlineCode",{parentName:"p"},"Port")," schema. At the moment, the implementation for publicly access is done via Load Balancer type service backed by cloud providers. Ingress will be supported in a future version of kusion."),(0,i.kt)("p",null,"For the ",(0,i.kt)("inlineCode",{parentName:"p"},"Port")," schema reference, please see ",(0,i.kt)("a",{parentName:"p",href:"../../reference/modules/catalog-models/workload/service#schema-port"},"here")," for more details."),(0,i.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,i.kt)("p",null,"Please refer to the ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,i.kt)("p",null,"The example below also requires you to have ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,i.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,i.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,i.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,i.kt)("p",null,"However, if you (or the platform team) would like to set default values for the services to standardize the behavior of applications in the ",(0,i.kt)("inlineCode",{parentName:"p"},"dev")," workspace, you can do so by updating the ",(0,i.kt)("inlineCode",{parentName:"p"},"~/dev.yaml"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n port:\n default:\n type: alicloud\n labels:\n kusionstack.io/control: "true"\n annotations:\n service.beta.kubernetes.io/alibaba-cloud-loadbalancer-spec: slb.s1.small\n')),(0,i.kt)("p",null,"The workspace configuration need to be updated with the command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace update dev -f ~/dev.yaml\n")),(0,i.kt)("p",null,"For a full reference of what can be configured in the workspace level, please see the ",(0,i.kt)("a",{parentName:"p",href:"../../reference/modules/workspace-configs/networking/port"},"workspace reference"),"."),(0,i.kt)("h2",{id:"example"},"Example"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-py"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.network as n\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "helloworld": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v4"\n env: {\n "env1": "VALUE"\n "env2": "VALUE2"\n }\n resources: {\n "cpu": "500m"\n "memory": "512M"\n }\n # Configure an HTTP readiness probe\n readinessProbe: p.Probe {\n probeHandler: p.Http {\n url: "http://localhost:80"\n }\n initialDelaySeconds: 10\n }\n }\n }\n replicas: 2\n ports: [\n n.Port {\n port: 8080\n targetPort: 80\n }\n ]\n }\n}\n')),(0,i.kt)("p",null,"The code above changes the service port to expose from ",(0,i.kt)("inlineCode",{parentName:"p"},"80")," in the last guide to ",(0,i.kt)("inlineCode",{parentName:"p"},"8080"),", but still targeting the container port ",(0,i.kt)("inlineCode",{parentName:"p"},"80")," because that's what the application is listening on."),(0,i.kt)("h2",{id:"applying"},"Applying"),(0,i.kt)("p",null,"Re-run steps in ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", new service configuration can be applied."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Intent in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private Update\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld UnChanged\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS Update v1:Service:simple-service:simple-service-dev-helloworld-private success \n SUCCESS UnChanged apps/v1:Deployment:simple-service:simple-service-dev-helloworld, skip \nUnChanged apps/v1:Deployment:simple-service:simple-service-dev-helloworld, skip [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,i.kt)("h2",{id:"validation"},"Validation"),(0,i.kt)("p",null,"We can verify the Kubernetes service now has the updated attributes (mapping service port 8080 to container port 80) as defined in the ",(0,i.kt)("inlineCode",{parentName:"p"},"ports")," configuration:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"kubectl get svc -n simple-service -o yaml\n...\n spec:\n ...\n ports:\n - name: simple-service-dev-helloworld-private-8080-tcp\n port: 8080\n protocol: TCP\n targetPort: 80\n...\n")),(0,i.kt)("p",null,"Exposing service port 8080:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"kubectl port-forward svc/simple-service-dev-helloworld-private -n simple-service 30000:8080\n")),(0,i.kt)("p",null,"Open browser and visit ",(0,i.kt)("a",{parentName:"p",href:"http://127.0.0.1:30000"},"http://127.0.0.1:30000"),", the application should be up and running\uff1a"),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"app-preview",src:n(92287).Z,width:"1830",height:"330"})))}d.isMDXComponent=!0},92287:(e,t,n)=>{n.d(t,{Z:()=>r});const r=n.p+"assets/images/app-preview-de5274f4267fa725d2a65099e47c6c2c.png"}}]); \ No newline at end of file diff --git a/assets/js/6b830420.6adaf4a0.js b/assets/js/6b830420.6adaf4a0.js new file mode 100644 index 00000000000..2e2c665e070 --- /dev/null +++ b/assets/js/6b830420.6adaf4a0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[992],{3905:(e,t,o)=>{o.d(t,{Zo:()=>u,kt:()=>h});var n=o(67294);function r(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function a(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function i(e){for(var t=1;t=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}var p=n.createContext({}),l=function(e){var t=n.useContext(p),o=t;return e&&(o="function"==typeof e?e(t):i(i({},t),e)),o},u=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var o=e.components,r=e.mdxType,a=e.originalType,p=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),c=l(o),h=r,d=c["".concat(p,".").concat(h)]||c[h]||m[h]||a;return o?n.createElement(d,i(i({ref:t},u),{},{components:o})):n.createElement(d,i({ref:t},u))}));function h(e,t){var o=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=o.length,i=new Array(a);i[0]=c;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var l=2;l{o.r(t),o.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var n=o(87462),r=(o(67294),o(3905));const a={id:"prometheus"},i="Configure Monitoring Behavior With Prometheus",s={unversionedId:"user-guides/observability/prometheus",id:"user-guides/observability/prometheus",title:"Configure Monitoring Behavior With Prometheus",description:"This document provides the step-by-step instruction to set up monitoring for your application.",source:"@site/docs/kusion/5-user-guides/3-observability/1-prometheus.md",sourceDirName:"5-user-guides/3-observability",slug:"/user-guides/observability/prometheus",permalink:"/docs/next/user-guides/observability/prometheus",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/5-user-guides/3-observability/1-prometheus.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"prometheus"},sidebar:"kusion",previous:{title:"Schedule a Job",permalink:"/docs/next/user-guides/working-with-k8s/job"},next:{title:"Using Cloud Secrets Manager",permalink:"/docs/next/user-guides/secrets-management/using-cloud-secrets"}},p={},l=[{value:"Pre-requisite",id:"pre-requisite",level:2},{value:"Setting up your own Prometheus",id:"setting-up-your-own-prometheus",level:2},{value:"Installing Prometheus operator3.",id:"installing-prometheus-operator3",level:3},{value:"Make sure RBAC is properly set up",id:"make-sure-rbac-is-properly-set-up",level:3},{value:"Configure Prometheus instance via the operator",id:"configure-prometheus-instance-via-the-operator",level:3},{value:"Exposing the Prometheus portal (optional)",id:"exposing-the-prometheus-portal-optional",level:3},{value:"Setting up workspace configs",id:"setting-up-workspace-configs",level:2},{value:"Operator mode",id:"operator-mode",level:3},{value:"Monitor types",id:"monitor-types",level:3},{value:"Overriding with projectSelector",id:"overriding-with-projectselector",level:3},{value:"Updating the workspace config",id:"updating-the-workspace-config",level:2},{value:"Using kusion to deploy your application with monitoring requirements",id:"using-kusion-to-deploy-your-application-with-monitoring-requirements",level:2},{value:"References",id:"references",level:2}],u={toc:l};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"configure-monitoring-behavior-with-prometheus"},"Configure Monitoring Behavior With Prometheus"),(0,r.kt)("p",null,"This document provides the step-by-step instruction to set up monitoring for your application. "),(0,r.kt)("p",null,"As of today, Kusion supports the configuration of Prometheus scraping behaviors for the target application. In the future, we will add more cloud-provider-native solutions, such as AWS CloudWatch, Azure Monitor, etc."),(0,r.kt)("p",null,"The user guide below is composed of the following components:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Namespace"),(0,r.kt)("li",{parentName:"ul"},"Deployment"),(0,r.kt)("li",{parentName:"ul"},"Service"),(0,r.kt)("li",{parentName:"ul"},"ServiceMonitor")),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"This guide requires you to have a basic understanding of Kubernetes and Prometheus.\nIf you are not familiar with the relevant concepts, please refer to the links below:"),(0,r.kt)("ul",{parentName:"admonition"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/tutorials/kubernetes-basics/"},"Learn Kubernetes Basics")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://prometheus.io/docs/introduction/overview/"},"Prometheus Introduction")))),(0,r.kt)("h2",{id:"pre-requisite"},"Pre-requisite"),(0,r.kt)("p",null,"Please refer to the ",(0,r.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,r.kt)("p",null,"The example below also requires you to have ",(0,r.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#initializing"},"initialized the project")," using the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will generate a ",(0,r.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#kclmod"},(0,r.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the project directory."),(0,r.kt)("h2",{id:"setting-up-your-own-prometheus"},"Setting up your own Prometheus"),(0,r.kt)("p",null,"There a quite a few ways to set up Prometheus in your cluster:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Installing a Prometheus operator"),(0,r.kt)("li",{parentName:"ol"},"Installing a standalone Prometheus server"),(0,r.kt)("li",{parentName:"ol"},"Installing a Prometheus agent and connect to a remote Prometheus server")),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator/issues/1547#issuecomment-401092041"},"The advice from the Prometheus team")," is to use the ",(0,r.kt)("inlineCode",{parentName:"p"},"ServiceMonitor")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"PodMonitor")," CRs via the Prometheus operator to manage scrape configs going forward",(0,r.kt)("sup",null,"[2]"),"."),(0,r.kt)("p",null,"In either case, you only have to do this setup once per cluster. This doc will use a minikube cluster and Prometheus operator as an example."),(0,r.kt)("h3",{id:"installing-prometheus-operator3"},"Installing Prometheus operator",(0,r.kt)("sup",null,"[3]"),"."),(0,r.kt)("p",null,"To get the example in this user guide working, all you need is a running Prometheus operator. You can have that installed by running:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"LATEST=$(curl -s https://api.github.com/repos/prometheus-operator/prometheus-operator/releases/latest | jq -cr .tag_name)\ncurl -sL https://github.com/prometheus-operator/prometheus-operator/releases/download/${LATEST}/bundle.yaml | kubectl create -f -\n")),(0,r.kt)("p",null,"This will install all the necessary CRDs and the Prometheus operator itself in the default namespace. Wait a few minutes, you can confirm the operator is up by running: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kubectl wait --for=condition=Ready pods -l app.kubernetes.io/name=prometheus-operator -n default\n")),(0,r.kt)("h3",{id:"make-sure-rbac-is-properly-set-up"},"Make sure RBAC is properly set up"),(0,r.kt)("p",null,"If you have RBAC enabled on the cluster, the following must be created for Prometheus to work properly:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'apiVersion: v1\nkind: ServiceAccount\nmetadata:\n name: prometheus\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n name: prometheus\nrules:\n- apiGroups: [""]\n resources:\n - nodes\n - nodes/metrics\n - services\n - endpoints\n - pods\n verbs: ["get", "list", "watch"]\n- apiGroups: [""]\n resources:\n - configmaps\n verbs: ["get"]\n- apiGroups:\n - networking.k8s.io\n resources:\n - ingresses\n verbs: ["get", "list", "watch"]\n- nonResourceURLs: ["/metrics"]\n verbs: ["get"]\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n name: prometheus\nroleRef:\n apiGroup: rbac.authorization.k8s.io\n kind: ClusterRole\n name: prometheus\nsubjects:\n- kind: ServiceAccount\n name: prometheus\n namespace: default\n')),(0,r.kt)("h3",{id:"configure-prometheus-instance-via-the-operator"},"Configure Prometheus instance via the operator"),(0,r.kt)("p",null,"Once all of the above is set up, you can then configure the Prometheus instance via the operator:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"apiVersion: monitoring.coreos.com/v1\nkind: Prometheus\nmetadata:\n name: prometheus\nspec:\n serviceAccountName: prometheus\n serviceMonitorNamespaceSelector: {}\n serviceMonitorSelector: {}\n podMonitorNamespaceSelector: {}\n podMonitorSelector: {}\n resources:\n requests:\n memory: 400Mi\n")),(0,r.kt)("p",null,"This Prometheus instance above will be cluster-wide, picking up ALL the service monitors and pod monitors across ALL the namespaces.\nYou can adjust the requests and limits accordingly if you have a larger cluster."),(0,r.kt)("h3",{id:"exposing-the-prometheus-portal-optional"},"Exposing the Prometheus portal (optional)"),(0,r.kt)("p",null,"Once you have the managed Prometheus instance created via the Prometheus CR above, you should be able to see a service created called ",(0,r.kt)("inlineCode",{parentName:"p"},"prometheus-operated"),":"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"prometheus-operated",src:o(91512).Z,width:"631",height:"52"})),(0,r.kt)("p",null,"If you are also running on minikube, you can expose it onto your localhost via kubectl:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kubectl port-forward svc/prometheus-operated 9099:9090\n")),(0,r.kt)("p",null,"You should then be able to see the Prometheus portal via ",(0,r.kt)("inlineCode",{parentName:"p"},"localhost:9099")," in your browser:"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"prometheus-portal",src:o(35443).Z,width:"2878",height:"1096"})),(0,r.kt)("p",null,"If you are running a non-local cluster, you can try to expose it via another way, through an ingress controller for example."),(0,r.kt)("h2",{id:"setting-up-workspace-configs"},"Setting up workspace configs"),(0,r.kt)("p",null,"Since v0.10.0, we have introduced the concept of ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/concepts/workspace"},"workspaces"),", whose configurations represent the part of the application behaviors that platform teams are interested in standardizing, or the ones to eliminate from developer's mind to make their lives easier."),(0,r.kt)("p",null,"In the case of setting up Prometheus, there are a few things to set up on the workspace level:"),(0,r.kt)("h3",{id:"operator-mode"},"Operator mode"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," flag indicates to Kusion whether the Prometheus instance installed in the cluster runs as a Kubernetes operator or not. This determines the different kinds of resources Kusion manages."),(0,r.kt)("p",null,"To see more about different ways to run Prometheus in the Kubernetes cluster, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/prometheus.md#prometheus-installation"},"design documentation"),"."),(0,r.kt)("p",null,"Most cloud vendors provide an out-of-the-box monitoring solutions for workloads running in a managed-Kubernetes cluster (EKS, AKS, etc), such as AWS CloudWatch, Azure Monitor, etc. These solutions mostly involve installing an agent (CloudWatch Agent, OMS Agent, etc) in the cluster and collecting the metrics to a centralized monitoring server. In those cases, you don't need to set ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," to ",(0,r.kt)("inlineCode",{parentName:"p"},"True"),". It only needs to be set to ",(0,r.kt)("inlineCode",{parentName:"p"},"True")," when you have an installation of the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator"},"Prometheus operator")," running inside the Kubernetes cluster."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"For differences between ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator"},"Prometheus operator"),", ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/kube-prometheus"},"kube-prometheus")," and the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack"},"community kube-prometheus-stack helm chart"),", the details are documented ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator#prometheus-operator-vs-kube-prometheus-vs-community-helm-chart"},"here"),".")),(0,r.kt)("h3",{id:"monitor-types"},"Monitor types"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"monitorType")," flag indicates the kind of monitor Kusion will create. It only applies when ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," is set to ",(0,r.kt)("inlineCode",{parentName:"p"},"True"),". As of version 0.10.0, Kusion provides options to scrape metrics from either the application pods or its corresponding Kubernetes services. This determines the different kinds of resources Kusion manages when Prometheus runs as an operator in the target cluster."),(0,r.kt)("p",null,"A sample ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," with Prometheus settings:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n ...\n kusionstack/monitoring@0.1.0:\n default:\n operatorMode: True\n monitorType: Service\n scheme: http\n interval: 30s\n timeout: 15s\n...\n")),(0,r.kt)("p",null,"To instruct Prometheus to scrape from pod targets instead:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n ...\n kusionstack/monitoring@0.1.0:\n default:\n operatorMode: True\n monitorType: Pod\n scheme: http\n interval: 30s\n timeout: 15s\n...\n")),(0,r.kt)("p",null,"If the ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," is omitted from the ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),", Kusion defaults ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," to false."),(0,r.kt)("h3",{id:"overriding-with-projectselector"},"Overriding with projectSelector"),(0,r.kt)("p",null,"Workspace configurations contain a set of default setting group for all projects in the workspace, with means to override them by Projects using a ",(0,r.kt)("inlineCode",{parentName:"p"},"projectSelector")," keyword."),(0,r.kt)("p",null,"Projects with the name matching those in projectSelector will use the values defined in that override group instead of the default. If a key is not present in the override group, the default value will be used."),(0,r.kt)("p",null,"Take a look at the sample ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n ...\n kusionstack/monitoring@0.1.0:\n default:\n operatorMode: True\n monitorType: Pod\n scheme: http\n interval: 30s\n timeout: 15s\n low_frequency:\n operatorMode: False\n interval: 2m\n projectSelector:\n - foobar\n high_frequency:\n monitorType: Service\n projectSelector:\n - helloworld\n...\n")),(0,r.kt)("p",null,"In the example above, a project with the name ",(0,r.kt)("inlineCode",{parentName:"p"},"helloworld")," will have the monitoring settings where ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," is set to ",(0,r.kt)("inlineCode",{parentName:"p"},"False"),", a 2 minute scraping interval, 15 seconds timeout (coming from default) and http scheme (coming from default)."),(0,r.kt)("p",null,"You cannot have the same project appear in two projectSelectors."),(0,r.kt)("p",null,"For a full reference of what can be configured in the workspace level, please see the ",(0,r.kt)("a",{parentName:"p",href:"../../reference/modules/workspace-configs/monitoring/prometheus"},"workspace reference"),"."),(0,r.kt)("h2",{id:"updating-the-workspace-config"},"Updating the workspace config"),(0,r.kt)("p",null,"Assuming you now have a ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," that looks like the following:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n kusionstack/monitoring@0.1.0:\n default:\n operatorMode: True\n monitorType: Service\n scheme: http\n interval: 30s\n timeout: 15s\n...\n")),(0,r.kt)("p",null,"Update the workspace configuration by running the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kusion workspace update dev -f workspace.yaml\n")),(0,r.kt)("p",null,"Verify the workspace config is properly updated by running the command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kusion workspace show dev\n")),(0,r.kt)("h2",{id:"using-kusion-to-deploy-your-application-with-monitoring-requirements"},"Using kusion to deploy your application with monitoring requirements"),(0,r.kt)("p",null,"At this point we are set up for good! Any new applications you deploy via kusion will now automatically have the monitoring-related resources created, should you declare you want it via the ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," field in the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model."),(0,r.kt)("p",null,"The monitoring in an AppConfiguration is declared in the ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," field. See the example below for a full, deployable AppConfiguration."),(0,r.kt)("p",null,"Please note we are using a new image ",(0,r.kt)("inlineCode",{parentName:"p"},"quay.io/brancz/prometheus-example-app")," since the app itself need to expose metrics for Prometheus to scrape:"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"helloworld/dev/kcl.mod"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'[package]\nname = "helloworld"\n\n[dependencies]\nmonitoring = { oci = "oci://ghcr.io/kusionstack/monitoring", tag = "0.1.0" }\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\n\n[profile]\nentries = ["main.k"]\n')),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"helloworld/dev/main.k"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport monitoring as m\nimport network.network as n\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "monitoring-sample-app": c.Container {\n image: "quay.io/brancz/prometheus-example-app:v0.3.0"\n }\n }\n }\n # Add the monitoring configuration backed by Prometheus\n accessories: {\n "monitoring": m.Prometheus {\n path: "/metrics"\n }\n "network": n.Network {\n ports: [\n n.Port {\n port: 8080\n }\n ]\n }\n }\n}\n')),(0,r.kt)("p",null,"The KCL file above represents an application with a service type workload, exposing the port 8080, and would like Prometheus to scrape the ",(0,r.kt)("inlineCode",{parentName:"p"},"/metrics")," endpoint every 2 minutes."),(0,r.kt)("p",null,"Running ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion apply")," would show that kusion will create a ",(0,r.kt)("inlineCode",{parentName:"p"},"Namespace"),", a ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployment"),", a ",(0,r.kt)("inlineCode",{parentName:"p"},"Service")," and a ",(0,r.kt)("inlineCode",{parentName:"p"},"ServiceMonitor"),":\n",(0,r.kt)("img",{alt:"kusion-apply-with-monitor",src:o(448).Z,width:"705",height:"224"})),(0,r.kt)("p",null,"Continue applying all resources:\n",(0,r.kt)("img",{alt:"kusion-apply-success",src:o(56816).Z,width:"1047",height:"564"})),(0,r.kt)("p",null,"If we want to, we can verify the service monitor has been created successfully:\n",(0,r.kt)("img",{alt:"service-monitor",src:o(58232).Z,width:"693",height:"463"})),(0,r.kt)("p",null,"In a few seconds, you should be able to see in the Prometheus portal that the service we just deployed has now been discovered and monitored by Prometheus:\n",(0,r.kt)("img",{alt:"prometheus-targets",src:o(87594).Z,width:"2880",height:"1636"})),(0,r.kt)("p",null,"You can run a few simply queries for the data that Prometheus scraped from your application:\n",(0,r.kt)("img",{alt:"prometheus-simple-query",src:o(87695).Z,width:"2880",height:"1634"})),(0,r.kt)("p",null,"For more info about PromQL, you can find them ",(0,r.kt)("a",{parentName:"p",href:"https://prometheus.io/docs/prometheus/latest/querying/basics/"},"here"),(0,r.kt)("sup",null,"[4]"),"."),(0,r.kt)("h2",{id:"references"},"References"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Prometheus: ",(0,r.kt)("a",{parentName:"li",href:"https://prometheus.io/docs/introduction/overview/"},"https://prometheus.io/docs/introduction/overview/")),(0,r.kt)("li",{parentName:"ol"},"Prometheus team advise: ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/prometheus-operator/prometheus-operator/issues/1547#issuecomment-446691500"},"https://github.com/prometheus-operator/prometheus-operator/issues/1547#issuecomment-446691500")),(0,r.kt)("li",{parentName:"ol"},"Prometheus operator getting started doc: ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md"},"https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md")),(0,r.kt)("li",{parentName:"ol"},"PromQL basics: ",(0,r.kt)("a",{parentName:"li",href:"https://prometheus.io/docs/prometheus/latest/querying/basics/"},"https://prometheus.io/docs/prometheus/latest/querying/basics/"))))}m.isMDXComponent=!0},56816:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/kusion-apply-success-52d04db670fd184959c3ea5c9e54f69d.png"},448:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/kusion-apply-with-monitor-d27cd1443e1a324d514983d52c055b15.png"},91512:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-operated-4cf8308703e4ec9d06a5078bbceb8d5d.png"},35443:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-portal-b60d8654c309e675fc04f1e74c5c127a.png"},87695:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-simple-query-60205589e762105ebc850e70d8ea7b56.png"},87594:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-targets-05964bad58af16f2e02c57cafa8565e7.png"},58232:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/service-monitor-2374625bfd1180a978a2be50ad4648ce.png"}}]); \ No newline at end of file diff --git a/assets/js/6b830420.dee41f7c.js b/assets/js/6b830420.dee41f7c.js deleted file mode 100644 index cb5a72a6aa3..00000000000 --- a/assets/js/6b830420.dee41f7c.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[992],{3905:(e,t,o)=>{o.d(t,{Zo:()=>u,kt:()=>h});var n=o(67294);function r(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function a(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function i(e){for(var t=1;t=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}var p=n.createContext({}),l=function(e){var t=n.useContext(p),o=t;return e&&(o="function"==typeof e?e(t):i(i({},t),e)),o},u=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var o=e.components,r=e.mdxType,a=e.originalType,p=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),c=l(o),h=r,d=c["".concat(p,".").concat(h)]||c[h]||m[h]||a;return o?n.createElement(d,i(i({ref:t},u),{},{components:o})):n.createElement(d,i({ref:t},u))}));function h(e,t){var o=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=o.length,i=new Array(a);i[0]=c;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var l=2;l{o.r(t),o.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var n=o(87462),r=(o(67294),o(3905));const a={id:"prometheus"},i="Configure Monitoring Behavior With Prometheus",s={unversionedId:"user-guides/observability/prometheus",id:"user-guides/observability/prometheus",title:"Configure Monitoring Behavior With Prometheus",description:"This document provides the step-by-step instruction to set up monitoring for your application.",source:"@site/docs/kusion/5-user-guides/3-observability/1-prometheus.md",sourceDirName:"5-user-guides/3-observability",slug:"/user-guides/observability/prometheus",permalink:"/docs/next/user-guides/observability/prometheus",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/5-user-guides/3-observability/1-prometheus.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"prometheus"},sidebar:"kusion",previous:{title:"Schedule a Job",permalink:"/docs/next/user-guides/working-with-k8s/job"},next:{title:"Using Cloud Secrets Manager",permalink:"/docs/next/user-guides/secrets-management/using-cloud-secrets"}},p={},l=[{value:"Pre-requisite",id:"pre-requisite",level:2},{value:"Setting up your own Prometheus",id:"setting-up-your-own-prometheus",level:2},{value:"Installing Prometheus operator3.",id:"installing-prometheus-operator3",level:3},{value:"Make sure RBAC is properly set up",id:"make-sure-rbac-is-properly-set-up",level:3},{value:"Configure Prometheus instance via the operator",id:"configure-prometheus-instance-via-the-operator",level:3},{value:"Exposing the Prometheus portal (optional)",id:"exposing-the-prometheus-portal-optional",level:3},{value:"Setting up workspace configs",id:"setting-up-workspace-configs",level:2},{value:"Operator mode",id:"operator-mode",level:3},{value:"Monitor types",id:"monitor-types",level:3},{value:"Overriding with projectSelector",id:"overriding-with-projectselector",level:3},{value:"Updating the workspace config",id:"updating-the-workspace-config",level:2},{value:"Using kusion to deploy your application with monitoring requirements",id:"using-kusion-to-deploy-your-application-with-monitoring-requirements",level:2},{value:"References",id:"references",level:2}],u={toc:l};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"configure-monitoring-behavior-with-prometheus"},"Configure Monitoring Behavior With Prometheus"),(0,r.kt)("p",null,"This document provides the step-by-step instruction to set up monitoring for your application. "),(0,r.kt)("p",null,"As of today, Kusion supports the configuration of Prometheus scraping behaviors for the target application. In the future, we will add more cloud-provider-native solutions, such as AWS CloudWatch, Azure Monitor, etc."),(0,r.kt)("p",null,"The user guide below is composed of the following components:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Namespace"),(0,r.kt)("li",{parentName:"ul"},"Deployment"),(0,r.kt)("li",{parentName:"ul"},"Service"),(0,r.kt)("li",{parentName:"ul"},"ServiceMonitor")),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"This guide requires you to have a basic understanding of Kubernetes and Prometheus.\nIf you are not familiar with the relevant concepts, please refer to the links below:"),(0,r.kt)("ul",{parentName:"admonition"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/tutorials/kubernetes-basics/"},"Learn Kubernetes Basics")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://prometheus.io/docs/introduction/overview/"},"Prometheus Introduction")))),(0,r.kt)("h2",{id:"pre-requisite"},"Pre-requisite"),(0,r.kt)("p",null,"Please refer to the ",(0,r.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,r.kt)("p",null,"The example below also requires you to have ",(0,r.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#initializing"},"initialized the project")," using the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will generate a ",(0,r.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#kclmod"},(0,r.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the project directory."),(0,r.kt)("h2",{id:"setting-up-your-own-prometheus"},"Setting up your own Prometheus"),(0,r.kt)("p",null,"There a quite a few ways to set up Prometheus in your cluster:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Installing a Prometheus operator"),(0,r.kt)("li",{parentName:"ol"},"Installing a standalone Prometheus server"),(0,r.kt)("li",{parentName:"ol"},"Installing a Prometheus agent and connect to a remote Prometheus server")),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator/issues/1547#issuecomment-401092041"},"The advice from the Prometheus team")," is to use the ",(0,r.kt)("inlineCode",{parentName:"p"},"ServiceMonitor")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"PodMonitor")," CRs via the Prometheus operator to manage scrape configs going forward",(0,r.kt)("sup",null,"[2]"),"."),(0,r.kt)("p",null,"In either case, you only have to do this setup once per cluster. This doc will use a minikube cluster and Prometheus operator as an example."),(0,r.kt)("h3",{id:"installing-prometheus-operator3"},"Installing Prometheus operator",(0,r.kt)("sup",null,"[3]"),"."),(0,r.kt)("p",null,"To get the example in this user guide working, all you need is a running Prometheus operator. You can have that installed by running:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"LATEST=$(curl -s https://api.github.com/repos/prometheus-operator/prometheus-operator/releases/latest | jq -cr .tag_name)\ncurl -sL https://github.com/prometheus-operator/prometheus-operator/releases/download/${LATEST}/bundle.yaml | kubectl create -f -\n")),(0,r.kt)("p",null,"This will install all the necessary CRDs and the Prometheus operator itself in the default namespace. Wait a few minutes, you can confirm the operator is up by running: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kubectl wait --for=condition=Ready pods -l app.kubernetes.io/name=prometheus-operator -n default\n")),(0,r.kt)("h3",{id:"make-sure-rbac-is-properly-set-up"},"Make sure RBAC is properly set up"),(0,r.kt)("p",null,"If you have RBAC enabled on the cluster, the following must be created for Prometheus to work properly:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'apiVersion: v1\nkind: ServiceAccount\nmetadata:\n name: prometheus\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n name: prometheus\nrules:\n- apiGroups: [""]\n resources:\n - nodes\n - nodes/metrics\n - services\n - endpoints\n - pods\n verbs: ["get", "list", "watch"]\n- apiGroups: [""]\n resources:\n - configmaps\n verbs: ["get"]\n- apiGroups:\n - networking.k8s.io\n resources:\n - ingresses\n verbs: ["get", "list", "watch"]\n- nonResourceURLs: ["/metrics"]\n verbs: ["get"]\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n name: prometheus\nroleRef:\n apiGroup: rbac.authorization.k8s.io\n kind: ClusterRole\n name: prometheus\nsubjects:\n- kind: ServiceAccount\n name: prometheus\n namespace: default\n')),(0,r.kt)("h3",{id:"configure-prometheus-instance-via-the-operator"},"Configure Prometheus instance via the operator"),(0,r.kt)("p",null,"Once all of the above is set up, you can then configure the Prometheus instance via the operator:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"apiVersion: monitoring.coreos.com/v1\nkind: Prometheus\nmetadata:\n name: prometheus\nspec:\n serviceAccountName: prometheus\n serviceMonitorNamespaceSelector: {}\n serviceMonitorSelector: {}\n podMonitorNamespaceSelector: {}\n podMonitorSelector: {}\n resources:\n requests:\n memory: 400Mi\n")),(0,r.kt)("p",null,"This Prometheus instance above will be cluster-wide, picking up ALL the service monitors and pod monitors across ALL the namespaces.\nYou can adjust the requests and limits accordingly if you have a larger cluster."),(0,r.kt)("h3",{id:"exposing-the-prometheus-portal-optional"},"Exposing the Prometheus portal (optional)"),(0,r.kt)("p",null,"Once you have the managed Prometheus instance created via the Prometheus CR above, you should be able to see a service created called ",(0,r.kt)("inlineCode",{parentName:"p"},"prometheus-operated"),":"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"prometheus-operated",src:o(91512).Z,width:"631",height:"52"})),(0,r.kt)("p",null,"If you are also running on minikube, you can expose it onto your localhost via kubectl:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kubectl port-forward svc/prometheus-operated 9099:9090\n")),(0,r.kt)("p",null,"You should then be able to see the Prometheus portal via ",(0,r.kt)("inlineCode",{parentName:"p"},"localhost:9099")," in your browser:"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"prometheus-portal",src:o(35443).Z,width:"2878",height:"1096"})),(0,r.kt)("p",null,"If you are running a non-local cluster, you can try to expose it via another way, through an ingress controller for example."),(0,r.kt)("h2",{id:"setting-up-workspace-configs"},"Setting up workspace configs"),(0,r.kt)("p",null,"Since v0.10.0, we have introduced the concept of ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/concepts/workspace"},"workspaces"),", whose configurations represent the part of the application behaviors that platform teams are interested in standardizing, or the ones to eliminate from developer's mind to make their lives easier."),(0,r.kt)("p",null,"In the case of setting up Prometheus, there are a few things to set up on the workspace level:"),(0,r.kt)("h3",{id:"operator-mode"},"Operator mode"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," flag indicates to Kusion whether the Prometheus instance installed in the cluster runs as a Kubernetes operator or not. This determines the different kinds of resources Kusion manages."),(0,r.kt)("p",null,"To see more about different ways to run Prometheus in the Kubernetes cluster, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/prometheus.md#prometheus-installation"},"design documentation"),"."),(0,r.kt)("p",null,"Most cloud vendors provide an out-of-the-box monitoring solutions for workloads running in a managed-Kubernetes cluster (EKS, AKS, etc), such as AWS CloudWatch, Azure Monitor, etc. These solutions mostly involve installing an agent (CloudWatch Agent, OMS Agent, etc) in the cluster and collecting the metrics to a centralized monitoring server. In those cases, you don't need to set ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," to ",(0,r.kt)("inlineCode",{parentName:"p"},"True"),". It only needs to be set to ",(0,r.kt)("inlineCode",{parentName:"p"},"True")," when you have an installation of the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator"},"Prometheus operator")," running inside the Kubernetes cluster."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"For differences between ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator"},"Prometheus operator"),", ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/kube-prometheus"},"kube-prometheus")," and the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack"},"community kube-prometheus-stack helm chart"),", the details are documented ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator#prometheus-operator-vs-kube-prometheus-vs-community-helm-chart"},"here"),".")),(0,r.kt)("h3",{id:"monitor-types"},"Monitor types"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"monitorType")," flag indicates the kind of monitor Kusion will create. It only applies when ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," is set to ",(0,r.kt)("inlineCode",{parentName:"p"},"True"),". As of version 0.10.0, Kusion provides options to scrape metrics from either the application pods or its corresponding Kubernetes services. This determines the different kinds of resources Kusion manages when Prometheus runs as an operator in the target cluster."),(0,r.kt)("p",null,"A sample ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," with Prometheus settings:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n ...\n kusionstack/monitoring@0.1.0:\n default:\n operatorMode: True\n monitorType: Service\n scheme: http\n interval: 30s\n timeout: 15s\n...\n")),(0,r.kt)("p",null,"To instruct Prometheus to scrape from pod targets instead:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n ...\n kusionstack/monitoring@0.1.0:\n default:\n operatorMode: True\n monitorType: Pod\n scheme: http\n interval: 30s\n timeout: 15s\n...\n")),(0,r.kt)("p",null,"If the ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," is omitted from the ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),", Kusion defaults ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," to false."),(0,r.kt)("h3",{id:"overriding-with-projectselector"},"Overriding with projectSelector"),(0,r.kt)("p",null,"Workspace configurations contain a set of default setting group for all projects in the workspace, with means to override them by Projects using a ",(0,r.kt)("inlineCode",{parentName:"p"},"projectSelector")," keyword."),(0,r.kt)("p",null,"Projects with the name matching those in projectSelector will use the values defined in that override group instead of the default. If a key is not present in the override group, the default value will be used."),(0,r.kt)("p",null,"Take a look at the sample ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n ...\n kusionstack/monitoring@0.1.0:\n default:\n operatorMode: True\n monitorType: Pod\n scheme: http\n interval: 30s\n timeout: 15s\n low_frequency:\n operatorMode: False\n interval: 2m\n projectSelector:\n - foobar\n high_frequency:\n monitorType: Service\n projectSelector:\n - helloworld\n...\n")),(0,r.kt)("p",null,"In the example above, a project with the name ",(0,r.kt)("inlineCode",{parentName:"p"},"helloworld")," will have the monitoring settings where ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," is set to ",(0,r.kt)("inlineCode",{parentName:"p"},"False"),", a 2 minute scraping interval, 15 seconds timeout (coming from default) and http scheme (coming from default)."),(0,r.kt)("p",null,"You cannot have the same project appear in two projectSelectors."),(0,r.kt)("p",null,"For a full reference of what can be configured in the workspace level, please see the ",(0,r.kt)("a",{parentName:"p",href:"../../reference/modules/workspace-configs/monitoring/prometheus"},"workspace reference"),"."),(0,r.kt)("h2",{id:"updating-the-workspace-config"},"Updating the workspace config"),(0,r.kt)("p",null,"Assuming you now have a ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," that looks like the following:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n kusionstack/monitoring@0.1.0:\n default:\n operatorMode: True\n monitorType: Service\n scheme: http\n interval: 30s\n timeout: 15s\n...\n")),(0,r.kt)("p",null,"Update the workspace configuration by running the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kusion workspace update dev -f workspace.yaml\n")),(0,r.kt)("p",null,"Verify the workspace config is properly updated by running the command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kusion workspace show dev\n")),(0,r.kt)("h2",{id:"using-kusion-to-deploy-your-application-with-monitoring-requirements"},"Using kusion to deploy your application with monitoring requirements"),(0,r.kt)("p",null,"At this point we are set up for good! Any new applications you deploy via kusion will now automatically have the monitoring-related resources created, should you declare you want it via the ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," field in the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model."),(0,r.kt)("p",null,"The monitoring in an AppConfiguration is declared in the ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," field. See the example below for a full, deployable AppConfiguration."),(0,r.kt)("p",null,"Please note we are using a new image ",(0,r.kt)("inlineCode",{parentName:"p"},"quay.io/brancz/prometheus-example-app")," since the app itself need to expose metrics for Prometheus to scrape:"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"helloworld/dev/kcl.mod"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'[package]\nname = "helloworld"\n\n[dependencies]\nmonitoring = { oci = "oci://ghcr.io/kusionstack/monitoring", tag = "0.1.0" }\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\n\n[profile]\nentries = ["main.k"]\n')),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"helloworld/dev/main.k"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport monitoring as m\nimport network.network as n\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "monitoring-sample-app": c.Container {\n image: "quay.io/brancz/prometheus-example-app:v0.3.0"\n }\n }\n }\n # Add the monitoring configuration backed by Prometheus\n accessories: {\n "monitoring": m.Prometheus {\n path: "/metrics"\n }\n "network": n.Network {\n ports: [\n n.Port {\n port: 8080\n }\n ]\n }\n }\n}\n')),(0,r.kt)("p",null,"The KCL file above represents an application with a service type workload, exposing the port 8080, and would like Prometheus to scrape the ",(0,r.kt)("inlineCode",{parentName:"p"},"/metrics")," endpoint every 2 minutes."),(0,r.kt)("p",null,"Running ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion apply")," would show that kusion will create a ",(0,r.kt)("inlineCode",{parentName:"p"},"Namespace"),", a ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployment"),", a ",(0,r.kt)("inlineCode",{parentName:"p"},"Service")," and a ",(0,r.kt)("inlineCode",{parentName:"p"},"ServiceMonitor"),":\n",(0,r.kt)("img",{alt:"kusion-apply-with-monitor",src:o(448).Z,width:"705",height:"224"})),(0,r.kt)("p",null,"Continue applying all resources:\n",(0,r.kt)("img",{alt:"kusion-apply-success",src:o(56816).Z,width:"1047",height:"564"})),(0,r.kt)("p",null,"If we want to, we can verify the service monitor has been created successfully:\n",(0,r.kt)("img",{alt:"service-monitor",src:o(58232).Z,width:"693",height:"463"})),(0,r.kt)("p",null,"In a few seconds, you should be able to see in the Prometheus portal that the service we just deployed has now been discovered and monitored by Prometheus:\n",(0,r.kt)("img",{alt:"prometheus-targets",src:o(87594).Z,width:"2880",height:"1636"})),(0,r.kt)("p",null,"You can run a few simply queries for the data that Prometheus scraped from your application:\n",(0,r.kt)("img",{alt:"prometheus-simple-query",src:o(87695).Z,width:"2880",height:"1634"})),(0,r.kt)("p",null,"For more info about PromQL, you can find them ",(0,r.kt)("a",{parentName:"p",href:"https://prometheus.io/docs/prometheus/latest/querying/basics/"},"here"),(0,r.kt)("sup",null,"[4]"),"."),(0,r.kt)("h2",{id:"references"},"References"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Prometheus: ",(0,r.kt)("a",{parentName:"li",href:"https://prometheus.io/docs/introduction/overview/"},"https://prometheus.io/docs/introduction/overview/")),(0,r.kt)("li",{parentName:"ol"},"Prometheus team advise: ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/prometheus-operator/prometheus-operator/issues/1547#issuecomment-446691500"},"https://github.com/prometheus-operator/prometheus-operator/issues/1547#issuecomment-446691500")),(0,r.kt)("li",{parentName:"ol"},"Prometheus operator getting started doc: ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md"},"https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md")),(0,r.kt)("li",{parentName:"ol"},"PromQL basics: ",(0,r.kt)("a",{parentName:"li",href:"https://prometheus.io/docs/prometheus/latest/querying/basics/"},"https://prometheus.io/docs/prometheus/latest/querying/basics/"))))}m.isMDXComponent=!0},56816:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/kusion-apply-success-52d04db670fd184959c3ea5c9e54f69d.png"},448:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/kusion-apply-with-monitor-d27cd1443e1a324d514983d52c055b15.png"},91512:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-operated-4cf8308703e4ec9d06a5078bbceb8d5d.png"},35443:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-portal-b60d8654c309e675fc04f1e74c5c127a.png"},87695:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-simple-query-60205589e762105ebc850e70d8ea7b56.png"},87594:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-targets-05964bad58af16f2e02c57cafa8565e7.png"},58232:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/service-monitor-2374625bfd1180a978a2be50ad4648ce.png"}}]); \ No newline at end of file diff --git a/assets/js/6c13589d.f196275e.js b/assets/js/6c13589d.b05a3592.js similarity index 51% rename from assets/js/6c13589d.f196275e.js rename to assets/js/6c13589d.b05a3592.js index 4ec0de39423..504553422fe 100644 --- a/assets/js/6c13589d.f196275e.js +++ b/assets/js/6c13589d.b05a3592.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1472],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>d});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),s=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),m=s(n),d=a,f=m["".concat(i,".").concat(d)]||m[d]||u[d]||l;return n?r.createElement(f,o(o({ref:t},p),{},{components:n})):r.createElement(f,o({ref:t},p))}));function d(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,o=new Array(l);o[0]=m;var c={};for(var i in t)hasOwnProperty.call(t,i)&&(c[i]=t[i]);c.originalType=e,c.mdxType="string"==typeof e?e:a,o[1]=c;for(var s=2;s{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>u,frontMatter:()=>l,metadata:()=>c,toc:()=>s});var r=n(87462),a=(n(67294),n(3905));const l={},o="lifecycle",c={unversionedId:"reference/modules/developer-schemas/internal/container/lifecycle/lifecycle",id:"reference/modules/developer-schemas/internal/container/lifecycle/lifecycle",title:"lifecycle",description:"Schema Lifecycle",source:"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/internal/container/lifecycle/lifecycle.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/internal/container/lifecycle",slug:"/reference/modules/developer-schemas/internal/container/lifecycle/",permalink:"/docs/next/reference/modules/developer-schemas/internal/container/lifecycle/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/1-developer-schemas/internal/container/lifecycle/lifecycle.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"container",permalink:"/docs/next/reference/modules/developer-schemas/internal/container/"},next:{title:"probe",permalink:"/docs/next/reference/modules/developer-schemas/internal/container/probe/"}},i={},s=[{value:"Schema Lifecycle",id:"schema-lifecycle",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:s};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"lifecycle"},"lifecycle"),(0,a.kt)("h2",{id:"schema-lifecycle"},"Schema Lifecycle"),(0,a.kt)("p",null,"Lifecycle describes actions that the management system should take in response",(0,a.kt)("br",null),"to container lifecycle events."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"postStart")),(0,a.kt)("td",{parentName:"tr",align:null}),(0,a.kt)("td",{parentName:"tr",align:null}),(0,a.kt)("td",{parentName:"tr",align:null},"The action to be taken after a container is created.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"preStop")),(0,a.kt)("td",{parentName:"tr",align:null}),(0,a.kt)("td",{parentName:"tr",align:null}),(0,a.kt)("td",{parentName:"tr",align:null},"The action to be taken before a container is terminated due to an API request or",(0,a.kt)("br",null),"management event such as liveness/startup probe failure, preemption, resource contention, etc.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"))))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container.probe as p\nimport kam.workload.container.lifecycle as lc\n\nlifecycleHook = lc.Lifecycle {\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n postStart: p.Http {\n url: "http://localhost:80"\n }\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1472],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>d});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),s=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=s(e.components);return r.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),m=s(n),d=a,f=m["".concat(i,".").concat(d)]||m[d]||u[d]||l;return n?r.createElement(f,o(o({ref:t},p),{},{components:n})):r.createElement(f,o({ref:t},p))}));function d(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,o=new Array(l);o[0]=m;var c={};for(var i in t)hasOwnProperty.call(t,i)&&(c[i]=t[i]);c.originalType=e,c.mdxType="string"==typeof e?e:a,o[1]=c;for(var s=2;s{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>u,frontMatter:()=>l,metadata:()=>c,toc:()=>s});var r=n(87462),a=(n(67294),n(3905));const l={},o="lifecycle",c={unversionedId:"reference/modules/developer-schemas/internal/container/lifecycle/lifecycle",id:"reference/modules/developer-schemas/internal/container/lifecycle/lifecycle",title:"lifecycle",description:"Schema Lifecycle",source:"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/internal/container/lifecycle/lifecycle.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/internal/container/lifecycle",slug:"/reference/modules/developer-schemas/internal/container/lifecycle/",permalink:"/docs/next/reference/modules/developer-schemas/internal/container/lifecycle/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/1-developer-schemas/internal/container/lifecycle/lifecycle.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"container",permalink:"/docs/next/reference/modules/developer-schemas/internal/container/"},next:{title:"probe",permalink:"/docs/next/reference/modules/developer-schemas/internal/container/probe/"}},i={},s=[{value:"Schema Lifecycle",id:"schema-lifecycle",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:s};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"lifecycle"},"lifecycle"),(0,a.kt)("h2",{id:"schema-lifecycle"},"Schema Lifecycle"),(0,a.kt)("p",null,"Lifecycle describes actions that the management system should take in response",(0,a.kt)("br",null),"to container lifecycle events."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"postStart")),(0,a.kt)("td",{parentName:"tr",align:null}),(0,a.kt)("td",{parentName:"tr",align:null}),(0,a.kt)("td",{parentName:"tr",align:null},"The action to be taken after a container is created.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"preStop")),(0,a.kt)("td",{parentName:"tr",align:null}),(0,a.kt)("td",{parentName:"tr",align:null}),(0,a.kt)("td",{parentName:"tr",align:null},"The action to be taken before a container is terminated due to an API request or",(0,a.kt)("br",null),"management event such as liveness/startup probe failure, preemption, resource contention, etc.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"))))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container.probe as p\nimport kam.workload.container.lifecycle as lc\n\nlifecycleHook = lc.Lifecycle {\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n postStart: p.Http {\n url: "http://localhost:80"\n }\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6dc132fb.6044aa53.js b/assets/js/6dc132fb.6044aa53.js new file mode 100644 index 00000000000..04674349f1e --- /dev/null +++ b/assets/js/6dc132fb.6044aa53.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[120],{3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function s(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),c=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},d=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=c(a),m=r,h=u["".concat(l,".").concat(m)]||u[m]||p[m]||o;return a?n.createElement(h,s(s({ref:t},d),{},{components:a})):n.createElement(h,s({ref:t},d))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var c=2;c{a.d(t,{Z:()=>s});var n=a(67294),r=a(86010);const o="tabItem_Ymn6";function s(e){let{children:t,hidden:a,className:s}=e;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(o,s),hidden:a},t)}},74866:(e,t,a)=>{a.d(t,{Z:()=>S});var n=a(87462),r=a(67294),o=a(86010),s=a(12466),i=a(76775),l=a(91980),c=a(67392),d=a(50012);function p(e){return function(e){var t;return(null==(t=r.Children.map(e,(e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})))?void 0:t.filter(Boolean))??[]}(e).map((e=>{let{props:{value:t,label:a,attributes:n,default:r}}=e;return{value:t,label:a,attributes:n,default:r}}))}function u(e){const{values:t,children:a}=e;return(0,r.useMemo)((()=>{const e=t??p(a);return function(e){const t=(0,c.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,a])}function m(e){let{value:t,tabValues:a}=e;return a.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:a}=e;const n=(0,i.k6)(),o=function(e){let{queryString:t=!1,groupId:a}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!a)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return a??null}({queryString:t,groupId:a});return[(0,l._X)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(n.location.search);t.set(o,e),n.replace({...n.location,search:t.toString()})}),[o,n])]}function f(e){const{defaultValue:t,queryString:a=!1,groupId:n}=e,o=u(e),[s,i]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:a}=e;if(0===a.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:a}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${a.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const n=a.find((e=>e.default))??a[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:o}))),[l,c]=h({queryString:a,groupId:n}),[p,f]=function(e){let{groupId:t}=e;const a=function(e){return e?`docusaurus.tab.${e}`:null}(t),[n,o]=(0,d.Nk)(a);return[n,(0,r.useCallback)((e=>{a&&o.set(e)}),[a,o])]}({groupId:n}),g=(()=>{const e=l??p;return m({value:e,tabValues:o})?e:null})();(0,r.useLayoutEffect)((()=>{g&&i(g)}),[g]);return{selectedValue:s,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);i(e),c(e),f(e)}),[c,f,o]),tabValues:o}}var g=a(72389);const k="tabList__CuJ",v="tabItem_LNqP";function w(e){let{className:t,block:a,selectedValue:i,selectValue:l,tabValues:c}=e;const d=[],{blockElementScrollPositionUntilNextRender:p}=(0,s.o5)(),u=e=>{const t=e.currentTarget,a=d.indexOf(t),n=c[a].value;n!==i&&(p(t),l(n))},m=e=>{var t;let a=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const t=d.indexOf(e.currentTarget)+1;a=d[t]??d[0];break}case"ArrowLeft":{const t=d.indexOf(e.currentTarget)-1;a=d[t]??d[d.length-1];break}}null==(t=a)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":a},t)},c.map((e=>{let{value:t,label:a,attributes:s}=e;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:i===t?0:-1,"aria-selected":i===t,key:t,ref:e=>d.push(e),onKeyDown:m,onClick:u},s,{className:(0,o.Z)("tabs__item",v,null==s?void 0:s.className,{"tabs__item--active":i===t})}),a??t)})))}function b(e){let{lazy:t,children:a,selectedValue:n}=e;const o=(Array.isArray(a)?a:[a]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===n));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==n}))))}function y(e){const t=f(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",k)},r.createElement(w,(0,n.Z)({},e,t)),r.createElement(b,(0,n.Z)({},e,t)))}function S(e){const t=(0,g.Z)();return r.createElement(y,(0,n.Z)({key:String(t)},e))}},45395:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>c,toc:()=>p});var n=a(87462),r=(a(67294),a(3905)),o=a(74866),s=a(85162);const i={},l="Deliver the WordPress Application with Cloud RDS",c={unversionedId:"guides/cloud-resources/database",id:"version-v0.9/guides/cloud-resources/database",title:"Deliver the WordPress Application with Cloud RDS",description:"This tutorial will demonstrate how to deploy a WordPress application with Kusion, which relies on both Kubernetes and IaaS resources provided by cloud vendors. We can learn how to declare the Relational Database Service (RDS) to provide a cloud-based database solution for our application from this article.",source:"@site/docs_versioned_docs/version-v0.9/guides/cloud-resources/database.md",sourceDirName:"guides/cloud-resources",slug:"/guides/cloud-resources/database",permalink:"/docs/v0.9/guides/cloud-resources/database",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/guides/cloud-resources/database.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"User Guide",permalink:"/docs/v0.9/guides/"},next:{title:"Expose Application Service Deployed on CSP Kubernetes",permalink:"/docs/v0.9/guides/cloud-resources/expose-service"}},d={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Init Project",id:"init-project",level:2},{value:"Review Config Files",id:"review-config-files",level:3},{value:"Deliver WordPress Application",id:"deliver-wordpress-application",level:2},{value:"Verify WordPress Application",id:"verify-wordpress-application",level:2},{value:"Delete WordPress Application",id:"delete-wordpress-application",level:2}],u={toc:p};function m(e){let{components:t,...i}=e;return(0,r.kt)("wrapper",(0,n.Z)({},u,i,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"deliver-the-wordpress-application-with-cloud-rds"},"Deliver the WordPress Application with Cloud RDS"),(0,r.kt)("p",null,"This tutorial will demonstrate how to deploy a WordPress application with Kusion, which relies on both Kubernetes and IaaS resources provided by cloud vendors. We can learn how to declare the Relational Database Service (RDS) to provide a cloud-based database solution for our application from this article. "),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"../../getting-started/install-kusion"},"Install Kusion")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://kubernetes.io/"},"Deploy Kubernetes")," or ",(0,r.kt)("a",{parentName:"li",href:"https://kind.sigs.k8s.io/"},"Kind")," or ",(0,r.kt)("a",{parentName:"li",href:"https://minikube.sigs.k8s.io/docs/tutorials/multi_node/"},"Minikube")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.terraform.io/"},"Install Terraform")),(0,r.kt)("li",{parentName:"ul"},"Prepare a cloud service account and create a user with ",(0,r.kt)("inlineCode",{parentName:"li"},"VPCFullAccess")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"RDSFullAccess")," permissions to use the Relational Database Service (RDS). This kind of user can be created and managed in the Identity and Access Management (IAM) console"),(0,r.kt)("li",{parentName:"ul"},"The environment that executes ",(0,r.kt)("inlineCode",{parentName:"li"},"kusion")," need to have connectivity to terraform registry to download the terraform providers")),(0,r.kt)("p",null,"Additionally, we also need to configure the obtained AccessKey and SecretKey as environment variables, along with the region if you are using certain cloud provider: "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'export AWS_ACCESS_KEY_ID="AKIAQZDxxxx" # replace it with your AccessKey\nexport AWS_SECRET_ACCESS_KEY="oE/xxxx" # replace it with your SecretKey\nexport AWS_PROVIDER_REGION="xx-xxxx-x" # replace it with your AWS Region\n')),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"aws iam account",src:a(24838).Z,width:"2874",height:"1398"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'export ALICLOUD_ACCESS_KEY="LTAI5txxx" # replace it with your AccessKey\nexport ALICLOUD_SECRET_KEY="nxuowIxxx" # replace it with your SecretKey\nexport ALICLOUD_PROVIDER_REGION="xx-xxxxxxx" # replace it with your AliCloud Region\n')),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"alicloud iam account",src:a(73725).Z,width:"1500",height:"629"})))),(0,r.kt)("h2",{id:"init-project"},"Init Project"),(0,r.kt)("p",null,"We can start by initializing this tutorial project with online templates: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion init --online\n")),(0,r.kt)("p",null,"All init templates are listed as follows:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"\u279c kusion_playground kusion init --online\n? Please choose a template: wordpress-cloud-rds A sample wordpress project with cloud rds\nThis command will walk you through creating a new kusion project.\n\nEnter a value or leave blank to accept the (default), and press .\nPress ^C at any time to quit.\n\nProject Config:\n? Project Name: wordpress-cloud-rds\n? AppName: wordpress\n? ProjectName: wordpress\nStack Config: dev\n? Image: wordpress:6.3\nCreated project 'wordpress-cloud-rds'\n")),(0,r.kt)("p",null,"Select ",(0,r.kt)("inlineCode",{parentName:"p"},"wordpress-cloud-rds")," and press ",(0,r.kt)("inlineCode",{parentName:"p"},"Enter"),". After that, we will see hints below and use the default value to config this project and stack."),(0,r.kt)("p",null,(0,r.kt)("img",{src:a(82605).Z,width:"2560",height:"1440"})),(0,r.kt)("p",null,"The directory structure looks like the following:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"\u279c kusion_playground tree wordpress-cloud-rds\nwordpress-cloud-rds\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod.lock\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u251c\u2500\u2500 platform.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n\n1 directory, 6 files\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about the directory structure can be found in\n",(0,r.kt)("a",{parentName:"p",href:"../../concepts/glossary"},"Concepts"),".")),(0,r.kt)("h3",{id:"review-config-files"},"Review Config Files"),(0,r.kt)("p",null,"Let's take a look at the configuration files located in ",(0,r.kt)("inlineCode",{parentName:"p"},"wordpress-cloud-rds/dev"),"."),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"dev/main.k")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.trait as t\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.secret as sec\nimport catalog.models.schema.v1.workload.network as n\nimport catalog.models.schema.v1.monitoring as m\nimport catalog.models.schema.v1.accessories.database as db\n\n# main.k declares reusable configurations for dev stacks.\nwordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n wordpress: c.Container {\n image = "wordpress:6.3"\n env: {\n "WORDPRESS_DB_HOST": "$(KUSION_DB_HOST)"\n "WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME)"\n "WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD)"\n "WORDPRESS_DB_NAME": "mysql"\n }\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n database: db.Database {\n type: "aws"\n engine: "MySQL"\n version: "8.0"\n size: 20\n instanceType: "db.t3.micro"\n }\n}\n')),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"dev/platform.k")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},"import catalog.models.schema.v1 as ac\n\n# platform.k declares customized configurations\nwordpress: ac.AppConfiguration {\n database: {\n privateRouting = False\n\n # SubnetID defines the virtual subnet ID associated with the VPC that the rds\n # instance will be created in. The rds instance won't be created in user's own VPC\n # but in default VPC of cloud vendor, if this field is not provided.\n # subnetID = [your-subnet-id]\n\n # category = \"serverless_basic\"\n }\n}\n")),(0,r.kt)("p",null,"The template project defaults to use ",(0,r.kt)("inlineCode",{parentName:"p"},"AWS")," RDS instance for the WordPress application. If you would like to try creating the ",(0,r.kt)("inlineCode",{parentName:"p"},"Alicloud")," RDS instance, you could modify the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/main.k")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/platform.k")," to the following and replace the ",(0,r.kt)("inlineCode",{parentName:"p"},"[your-subnet-id]")," in ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/platform.k")," with the ",(0,r.kt)("inlineCode",{parentName:"p"},"vSwitchID")," to provision the database in. "),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"dev/main.k")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.trait as t\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.secret as sec\nimport catalog.models.schema.v1.workload.network as n\nimport catalog.models.schema.v1.monitoring as m\nimport catalog.models.schema.v1.accessories.database as db\n\n# main.k declares reusable configurations for dev stacks.\nwordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n wordpress: c.Container {\n image = "wordpress:6.3"\n env: {\n "WORDPRESS_DB_HOST": "$(KUSION_DB_HOST)"\n "WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME)"\n "WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD)"\n "WORDPRESS_DB_NAME": "mysql"\n }\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n database: db.Database {\n type: "alicloud"\n engine: "MySQL"\n version: "8.0"\n size: 20\n instanceType: "mysql.n2.serverless.1c"\n }\n}\n')),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"dev/platform.k")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},"import catalog.models.schema.v1 as ac\n\n# platform.k declares customized configurations\nwordpress: ac.AppConfiguration {\n database: {\n privateRouting = False\n\n # SubnetID defines the virtual subnet ID associated with the VPC that the rds\n # instance will be created in. The rds instance won't be created in user's own VPC\n # but in default VPC of cloud vendor, if this field is not provided.\n subnetID = [your-subnet-id]\n\n category = \"serverless_basic\"\n }\n}\n")),(0,r.kt)("p",null,"The configuration code files you need to pay attention are mainly ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/main.k")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/platform.k"),". Specifically: "),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"dev/main.k")," contains configurations for the ",(0,r.kt)("strong",{parentName:"li"},"Development team")," to fill out on how the application should run in the dev environment. In addition to declaring its application container attributes such as image, environment variables, resource requirements, its network attributes such as opening the port 80 to provide service, it also declares that it needs an RDS instance."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"dev/platform.k")," contains config codes for ",(0,r.kt)("strong",{parentName:"li"},"Platform team")," to fill out for the WordPress application deployment in the dev environment on AliCloud. Here, the main purpose is to specify the details on the cloud database (such as how network access is managed, what category of service to get from the cloud vendor) for it to be connected from the WordPress application container.")),(0,r.kt)("p",null,"As shown above, benefiting from the advanced features of KCL concerning variable, function, and schema definition, we can abstract and encapsulate the RDS resources, which shields many properties that the Developer does not need to be aware of. The developer only needs to fill in a few necessary fields in the AppConfiguration instance to complete the declaration of RDS resources, so that the application configuration can be organized more flexibly and efficiently. "),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about Catalog models can be found in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"Catalog"))),(0,r.kt)("h2",{id:"deliver-wordpress-application"},"Deliver WordPress Application"),(0,r.kt)("p",null,"You can complete the delivery of the WordPress application using the following command line: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"cd wordpress-cloud-rds && kusion apply --yes\n")),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply the wordpress application with aws rds",src:a(87103).Z,width:"2276",height:"766"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply the wordpress application with alicloud rds",src:a(30263).Z,width:"2504",height:"1996"})))),(0,r.kt)("p",null,"After all the resources reconciled, we can port-forward our local port (e.g. 12345) to the WordPress frontend service port (80) in the cluster:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kubectl port-forward -n wordpress svc/wordpress-dev-wordpress-private 12345:80\n")),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kubectl port-forward for wordpress",src:a(86535).Z,width:"2384",height:"234"})),(0,r.kt)("h2",{id:"verify-wordpress-application"},"Verify WordPress Application"),(0,r.kt)("p",null,"Next, we will verify the WordPress site service we just delivered, along with the creation of the RDS instance it depends on. We can start using the WordPress site by accessing the link of local-forwarded port ",(0,r.kt)("a",{parentName:"p",href:"http://localhost:12345"},"(http://localhost:12345)")," we just configured in the browser. "),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"wordpress site page",src:a(85773).Z,width:"1500",height:"803"})),(0,r.kt)("p",null,"In addition, we can also log in to the cloud service console page to view the RDS instance we just created."),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"aws rds instance",src:a(68678).Z,width:"2876",height:"964"}),"\n",(0,r.kt)("img",{alt:"aws rds instance detailed information",src:a(86915).Z,width:"1224",height:"274"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"alicloud rds instance",src:a(34811).Z,width:"1500",height:"748"})))),(0,r.kt)("h2",{id:"delete-wordpress-application"},"Delete WordPress Application"),(0,r.kt)("p",null,"You can delete the WordPress application and related RDS resources using the following command line. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion destroy --yes\n")),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kusion destroy wordpress with aws rds",src:a(37589).Z,width:"2184",height:"730"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kusion destroy wordpress with alicloud rds",src:a(75775).Z,width:"1462",height:"776"})))))}m.isMDXComponent=!0},34811:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/alicloud-rds-instance-88d560e7fdab77f7d83592ae1ded6866.png"},87103:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/apply-wordpress-application-with-aws-rds-580915491e85e04d050cf19bbf0f96cd.png"},30263:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/apply-wordpress-application-b757aedd0d5513207e0bd65019d7a4c2.png"},24838:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/aws-iam-account-2216105e7fa18fb2f7bf4be7e19f98bd.png"},86915:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/aws-rds-instance-detail-e0f1e737f54491f738769b152de96806.png"},68678:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/aws-rds-instance-12f87b94fbc4a76319d8d9d39fd465d2.png"},82605:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/init-wordpress-with-rds-d6c58387ae3d8ce26394e6e2f7402efd.gif"},37589:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/kusion-destroy-wordpress-with-aws-rds-304a7051e2646ad78490fb641fe5a776.png"},75775:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/kusion-destroy-wordpress-917a4bf29dfb33b39f8b306df03d9f6a.png"},73725:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/set-rds-access-9347ae09377aeb94d9f6d1e5d8688ab5.png"},86535:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/wordpress-port-forward-2a83514580f7cf81d890841495f9441e.png"},85773:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/wordpress-site-page-ef650e640399209d1eec5e6dfe88c454.png"}}]); \ No newline at end of file diff --git a/assets/js/6dc132fb.85de332e.js b/assets/js/6dc132fb.85de332e.js deleted file mode 100644 index ba59eefa740..00000000000 --- a/assets/js/6dc132fb.85de332e.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[120],{3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function s(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),c=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):s(s({},t),e)),a},d=function(e){var t=c(e.components);return n.createElement(l.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=c(a),m=r,h=u["".concat(l,".").concat(m)]||u[m]||p[m]||o;return a?n.createElement(h,s(s({ref:t},d),{},{components:a})):n.createElement(h,s({ref:t},d))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,s=new Array(o);s[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var c=2;c{a.d(t,{Z:()=>s});var n=a(67294),r=a(86010);const o="tabItem_Ymn6";function s(e){let{children:t,hidden:a,className:s}=e;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(o,s),hidden:a},t)}},74866:(e,t,a)=>{a.d(t,{Z:()=>S});var n=a(87462),r=a(67294),o=a(86010),s=a(12466),i=a(76775),l=a(91980),c=a(67392),d=a(50012);function p(e){return function(e){var t;return(null==(t=r.Children.map(e,(e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})))?void 0:t.filter(Boolean))??[]}(e).map((e=>{let{props:{value:t,label:a,attributes:n,default:r}}=e;return{value:t,label:a,attributes:n,default:r}}))}function u(e){const{values:t,children:a}=e;return(0,r.useMemo)((()=>{const e=t??p(a);return function(e){const t=(0,c.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,a])}function m(e){let{value:t,tabValues:a}=e;return a.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:a}=e;const n=(0,i.k6)(),o=function(e){let{queryString:t=!1,groupId:a}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!a)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return a??null}({queryString:t,groupId:a});return[(0,l._X)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(n.location.search);t.set(o,e),n.replace({...n.location,search:t.toString()})}),[o,n])]}function f(e){const{defaultValue:t,queryString:a=!1,groupId:n}=e,o=u(e),[s,i]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:a}=e;if(0===a.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:a}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${a.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const n=a.find((e=>e.default))??a[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:o}))),[l,c]=h({queryString:a,groupId:n}),[p,f]=function(e){let{groupId:t}=e;const a=function(e){return e?`docusaurus.tab.${e}`:null}(t),[n,o]=(0,d.Nk)(a);return[n,(0,r.useCallback)((e=>{a&&o.set(e)}),[a,o])]}({groupId:n}),g=(()=>{const e=l??p;return m({value:e,tabValues:o})?e:null})();(0,r.useLayoutEffect)((()=>{g&&i(g)}),[g]);return{selectedValue:s,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);i(e),c(e),f(e)}),[c,f,o]),tabValues:o}}var g=a(72389);const k="tabList__CuJ",v="tabItem_LNqP";function w(e){let{className:t,block:a,selectedValue:i,selectValue:l,tabValues:c}=e;const d=[],{blockElementScrollPositionUntilNextRender:p}=(0,s.o5)(),u=e=>{const t=e.currentTarget,a=d.indexOf(t),n=c[a].value;n!==i&&(p(t),l(n))},m=e=>{var t;let a=null;switch(e.key){case"Enter":u(e);break;case"ArrowRight":{const t=d.indexOf(e.currentTarget)+1;a=d[t]??d[0];break}case"ArrowLeft":{const t=d.indexOf(e.currentTarget)-1;a=d[t]??d[d.length-1];break}}null==(t=a)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":a},t)},c.map((e=>{let{value:t,label:a,attributes:s}=e;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:i===t?0:-1,"aria-selected":i===t,key:t,ref:e=>d.push(e),onKeyDown:m,onClick:u},s,{className:(0,o.Z)("tabs__item",v,null==s?void 0:s.className,{"tabs__item--active":i===t})}),a??t)})))}function b(e){let{lazy:t,children:a,selectedValue:n}=e;const o=(Array.isArray(a)?a:[a]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===n));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==n}))))}function y(e){const t=f(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",k)},r.createElement(w,(0,n.Z)({},e,t)),r.createElement(b,(0,n.Z)({},e,t)))}function S(e){const t=(0,g.Z)();return r.createElement(y,(0,n.Z)({key:String(t)},e))}},45395:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>c,toc:()=>p});var n=a(87462),r=(a(67294),a(3905)),o=a(74866),s=a(85162);const i={},l="Deliver the WordPress Application with Cloud RDS",c={unversionedId:"guides/cloud-resources/database",id:"version-v0.9/guides/cloud-resources/database",title:"Deliver the WordPress Application with Cloud RDS",description:"This tutorial will demonstrate how to deploy a WordPress application with Kusion, which relies on both Kubernetes and IaaS resources provided by cloud vendors. We can learn how to declare the Relational Database Service (RDS) to provide a cloud-based database solution for our application from this article.",source:"@site/docs_versioned_docs/version-v0.9/guides/cloud-resources/database.md",sourceDirName:"guides/cloud-resources",slug:"/guides/cloud-resources/database",permalink:"/docs/v0.9/guides/cloud-resources/database",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/guides/cloud-resources/database.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"User Guide",permalink:"/docs/v0.9/guides/"},next:{title:"Expose Application Service Deployed on CSP Kubernetes",permalink:"/docs/v0.9/guides/cloud-resources/expose-service"}},d={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Init Project",id:"init-project",level:2},{value:"Review Config Files",id:"review-config-files",level:3},{value:"Deliver WordPress Application",id:"deliver-wordpress-application",level:2},{value:"Verify WordPress Application",id:"verify-wordpress-application",level:2},{value:"Delete WordPress Application",id:"delete-wordpress-application",level:2}],u={toc:p};function m(e){let{components:t,...i}=e;return(0,r.kt)("wrapper",(0,n.Z)({},u,i,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"deliver-the-wordpress-application-with-cloud-rds"},"Deliver the WordPress Application with Cloud RDS"),(0,r.kt)("p",null,"This tutorial will demonstrate how to deploy a WordPress application with Kusion, which relies on both Kubernetes and IaaS resources provided by cloud vendors. We can learn how to declare the Relational Database Service (RDS) to provide a cloud-based database solution for our application from this article. "),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"../../getting-started/install-kusion"},"Install Kusion")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://kubernetes.io/"},"Deploy Kubernetes")," or ",(0,r.kt)("a",{parentName:"li",href:"https://kind.sigs.k8s.io/"},"Kind")," or ",(0,r.kt)("a",{parentName:"li",href:"https://minikube.sigs.k8s.io/docs/tutorials/multi_node/"},"Minikube")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.terraform.io/"},"Install Terraform")),(0,r.kt)("li",{parentName:"ul"},"Prepare a cloud service account and create a user with ",(0,r.kt)("inlineCode",{parentName:"li"},"VPCFullAccess")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"RDSFullAccess")," permissions to use the Relational Database Service (RDS). This kind of user can be created and managed in the Identity and Access Management (IAM) console"),(0,r.kt)("li",{parentName:"ul"},"The environment that executes ",(0,r.kt)("inlineCode",{parentName:"li"},"kusion")," need to have connectivity to terraform registry to download the terraform providers")),(0,r.kt)("p",null,"Additionally, we also need to configure the obtained AccessKey and SecretKey as environment variables, along with the region if you are using certain cloud provider: "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'export AWS_ACCESS_KEY_ID="AKIAQZDxxxx" # replace it with your AccessKey\nexport AWS_SECRET_ACCESS_KEY="oE/xxxx" # replace it with your SecretKey\nexport AWS_PROVIDER_REGION="xx-xxxx-x" # replace it with your AWS Region\n')),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"aws iam account",src:a(24838).Z,width:"2874",height:"1398"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'export ALICLOUD_ACCESS_KEY="LTAI5txxx" # replace it with your AccessKey\nexport ALICLOUD_SECRET_KEY="nxuowIxxx" # replace it with your SecretKey\nexport ALICLOUD_PROVIDER_REGION="xx-xxxxxxx" # replace it with your AliCloud Region\n')),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"alicloud iam account",src:a(73725).Z,width:"1500",height:"629"})))),(0,r.kt)("h2",{id:"init-project"},"Init Project"),(0,r.kt)("p",null,"We can start by initializing this tutorial project with online templates: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion init --online\n")),(0,r.kt)("p",null,"All init templates are listed as follows:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"\u279c kusion_playground kusion init --online\n? Please choose a template: wordpress-cloud-rds A sample wordpress project with cloud rds\nThis command will walk you through creating a new kusion project.\n\nEnter a value or leave blank to accept the (default), and press .\nPress ^C at any time to quit.\n\nProject Config:\n? Project Name: wordpress-cloud-rds\n? AppName: wordpress\n? ProjectName: wordpress\nStack Config: dev\n? Image: wordpress:6.3\nCreated project 'wordpress-cloud-rds'\n")),(0,r.kt)("p",null,"Select ",(0,r.kt)("inlineCode",{parentName:"p"},"wordpress-cloud-rds")," and press ",(0,r.kt)("inlineCode",{parentName:"p"},"Enter"),". After that, we will see hints below and use the default value to config this project and stack."),(0,r.kt)("p",null,(0,r.kt)("img",{src:a(82605).Z,width:"2560",height:"1440"})),(0,r.kt)("p",null,"The directory structure looks like the following:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"\u279c kusion_playground tree wordpress-cloud-rds\nwordpress-cloud-rds\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod.lock\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u251c\u2500\u2500 platform.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n\n1 directory, 6 files\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about the directory structure can be found in\n",(0,r.kt)("a",{parentName:"p",href:"../../concepts/glossary"},"Concepts"),".")),(0,r.kt)("h3",{id:"review-config-files"},"Review Config Files"),(0,r.kt)("p",null,"Let's take a look at the configuration files located in ",(0,r.kt)("inlineCode",{parentName:"p"},"wordpress-cloud-rds/dev"),"."),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"dev/main.k")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.trait as t\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.secret as sec\nimport catalog.models.schema.v1.workload.network as n\nimport catalog.models.schema.v1.monitoring as m\nimport catalog.models.schema.v1.accessories.database as db\n\n# main.k declares reusable configurations for dev stacks.\nwordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n wordpress: c.Container {\n image = "wordpress:6.3"\n env: {\n "WORDPRESS_DB_HOST": "$(KUSION_DB_HOST)"\n "WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME)"\n "WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD)"\n "WORDPRESS_DB_NAME": "mysql"\n }\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n database: db.Database {\n type: "aws"\n engine: "MySQL"\n version: "8.0"\n size: 20\n instanceType: "db.t3.micro"\n }\n}\n')),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"dev/platform.k")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},"import catalog.models.schema.v1 as ac\n\n# platform.k declares customized configurations\nwordpress: ac.AppConfiguration {\n database: {\n privateRouting = False\n\n # SubnetID defines the virtual subnet ID associated with the VPC that the rds\n # instance will be created in. The rds instance won't be created in user's own VPC\n # but in default VPC of cloud vendor, if this field is not provided.\n # subnetID = [your-subnet-id]\n\n # category = \"serverless_basic\"\n }\n}\n")),(0,r.kt)("p",null,"The template project defaults to use ",(0,r.kt)("inlineCode",{parentName:"p"},"AWS")," RDS instance for the WordPress application. If you would like to try creating the ",(0,r.kt)("inlineCode",{parentName:"p"},"Alicloud")," RDS instance, you could modify the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/main.k")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/platform.k")," to the following and replace the ",(0,r.kt)("inlineCode",{parentName:"p"},"[your-subnet-id]")," in ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/platform.k")," with the ",(0,r.kt)("inlineCode",{parentName:"p"},"vSwitchID")," to provision the database in. "),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"dev/main.k")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.trait as t\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.secret as sec\nimport catalog.models.schema.v1.workload.network as n\nimport catalog.models.schema.v1.monitoring as m\nimport catalog.models.schema.v1.accessories.database as db\n\n# main.k declares reusable configurations for dev stacks.\nwordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n wordpress: c.Container {\n image = "wordpress:6.3"\n env: {\n "WORDPRESS_DB_HOST": "$(KUSION_DB_HOST)"\n "WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME)"\n "WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD)"\n "WORDPRESS_DB_NAME": "mysql"\n }\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n database: db.Database {\n type: "alicloud"\n engine: "MySQL"\n version: "8.0"\n size: 20\n instanceType: "mysql.n2.serverless.1c"\n }\n}\n')),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"dev/platform.k")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},"import catalog.models.schema.v1 as ac\n\n# platform.k declares customized configurations\nwordpress: ac.AppConfiguration {\n database: {\n privateRouting = False\n\n # SubnetID defines the virtual subnet ID associated with the VPC that the rds\n # instance will be created in. The rds instance won't be created in user's own VPC\n # but in default VPC of cloud vendor, if this field is not provided.\n subnetID = [your-subnet-id]\n\n category = \"serverless_basic\"\n }\n}\n")),(0,r.kt)("p",null,"The configuration code files you need to pay attention are mainly ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/main.k")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/platform.k"),". Specifically: "),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"dev/main.k")," contains configurations for the ",(0,r.kt)("strong",{parentName:"li"},"Development team")," to fill out on how the application should run in the dev environment. In addition to declaring its application container attributes such as image, environment variables, resource requirements, its network attributes such as opening the port 80 to provide service, it also declares that it needs an RDS instance."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"dev/platform.k")," contains config codes for ",(0,r.kt)("strong",{parentName:"li"},"Platform team")," to fill out for the WordPress application deployment in the dev environment on AliCloud. Here, the main purpose is to specify the details on the cloud database (such as how network access is managed, what category of service to get from the cloud vendor) for it to be connected from the WordPress application container.")),(0,r.kt)("p",null,"As shown above, benefiting from the advanced features of KCL concerning variable, function, and schema definition, we can abstract and encapsulate the RDS resources, which shields many properties that the Developer does not need to be aware of. The developer only needs to fill in a few necessary fields in the AppConfiguration instance to complete the declaration of RDS resources, so that the application configuration can be organized more flexibly and efficiently. "),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about Catalog models can be found in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"Catalog"))),(0,r.kt)("h2",{id:"deliver-wordpress-application"},"Deliver WordPress Application"),(0,r.kt)("p",null,"You can complete the delivery of the WordPress application using the following command line: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"cd wordpress-cloud-rds && kusion apply --yes\n")),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply the wordpress application with aws rds",src:a(87103).Z,width:"2276",height:"766"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply the wordpress application with alicloud rds",src:a(30263).Z,width:"2504",height:"1996"})))),(0,r.kt)("p",null,"After all the resources reconciled, we can port-forward our local port (e.g. 12345) to the WordPress frontend service port (80) in the cluster:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kubectl port-forward -n wordpress svc/wordpress-dev-wordpress-private 12345:80\n")),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kubectl port-forward for wordpress",src:a(86535).Z,width:"2384",height:"234"})),(0,r.kt)("h2",{id:"verify-wordpress-application"},"Verify WordPress Application"),(0,r.kt)("p",null,"Next, we will verify the WordPress site service we just delivered, along with the creation of the RDS instance it depends on. We can start using the WordPress site by accessing the link of local-forwarded port ",(0,r.kt)("a",{parentName:"p",href:"http://localhost:12345"},"(http://localhost:12345)")," we just configured in the browser. "),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"wordpress site page",src:a(85773).Z,width:"1500",height:"803"})),(0,r.kt)("p",null,"In addition, we can also log in to the cloud service console page to view the RDS instance we just created."),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"aws rds instance",src:a(68678).Z,width:"2876",height:"964"}),"\n",(0,r.kt)("img",{alt:"aws rds instance detailed information",src:a(86915).Z,width:"1224",height:"274"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"alicloud rds instance",src:a(34811).Z,width:"1500",height:"748"})))),(0,r.kt)("h2",{id:"delete-wordpress-application"},"Delete WordPress Application"),(0,r.kt)("p",null,"You can delete the WordPress application and related RDS resources using the following command line. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion destroy --yes\n")),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(s.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kusion destroy wordpress with aws rds",src:a(37589).Z,width:"2184",height:"730"}))),(0,r.kt)(s.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kusion destroy wordpress with alicloud rds",src:a(75775).Z,width:"1462",height:"776"})))))}m.isMDXComponent=!0},34811:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/alicloud-rds-instance-88d560e7fdab77f7d83592ae1ded6866.png"},87103:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/apply-wordpress-application-with-aws-rds-580915491e85e04d050cf19bbf0f96cd.png"},30263:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/apply-wordpress-application-b757aedd0d5513207e0bd65019d7a4c2.png"},24838:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/aws-iam-account-2216105e7fa18fb2f7bf4be7e19f98bd.png"},86915:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/aws-rds-instance-detail-e0f1e737f54491f738769b152de96806.png"},68678:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/aws-rds-instance-12f87b94fbc4a76319d8d9d39fd465d2.png"},82605:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/init-wordpress-with-rds-d6c58387ae3d8ce26394e6e2f7402efd.gif"},37589:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/kusion-destroy-wordpress-with-aws-rds-304a7051e2646ad78490fb641fe5a776.png"},75775:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/kusion-destroy-wordpress-917a4bf29dfb33b39f8b306df03d9f6a.png"},73725:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/set-rds-access-9347ae09377aeb94d9f6d1e5d8688ab5.png"},86535:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/wordpress-port-forward-2a83514580f7cf81d890841495f9441e.png"},85773:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/wordpress-site-page-ef650e640399209d1eec5e6dfe88c454.png"}}]); \ No newline at end of file diff --git a/assets/js/6fb6dfc9.70fe88bd.js b/assets/js/6fb6dfc9.70fe88bd.js deleted file mode 100644 index 8fcaaf7b06b..00000000000 --- a/assets/js/6fb6dfc9.70fe88bd.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9440],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),l=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=l(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),d=l(n),f=o,m=d["".concat(s,".").concat(f)]||d[f]||u[f]||a;return n?r.createElement(m,i(i({ref:t},c),{},{components:n})):r.createElement(m,i({ref:t},c))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=d;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p.mdxType="string"==typeof e?e:o,i[1]=p;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>p,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={},i="kusion apply",p={unversionedId:"reference/commands/kusion-apply",id:"reference/commands/kusion-apply",title:"kusion apply",description:"Apply the operational intent of various resources to multiple runtimes",source:"@site/docs/kusion/6-reference/1-commands/kusion-apply.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-apply",permalink:"/docs/next/reference/commands/kusion-apply",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-apply.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Kusion Commands",permalink:"/docs/next/reference/commands/"},next:{title:"kusion config get",permalink:"/docs/next/reference/commands/kusion-config-get"}},s={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],c={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-apply"},"kusion apply"),(0,o.kt)("p",null,"Apply the operational intent of various resources to multiple runtimes"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Apply a series of resource changes within the stack."),(0,o.kt)("p",null," Create, update or delete resources according to the operational intent within a stack. By default, Kusion will generate an execution preview and prompt for your approval before performing any actions. You can review the preview details and make a decision to proceed with the actions or abort them."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion apply [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Apply with specified work directory\n kusion apply -w /path/to/workdir\n \n # Apply with specified arguments\n kusion apply -D name=test -D age=18\n \n # Skip interactive approval of preview details before applying\n kusion apply --yes\n \n # Apply without output style and color\n kusion apply --no-style=true\n \n # Apply with localhost port forwarding\n kusion apply --port-forward=8080\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -a, --all --detail Automatically show all preview details, combined use with flag --detail\n --backend string The backend to use, supports 'local', 'oss' and 's3'.\n -d, --detail Automatically show preview details with interactive options (default true)\n --dry-run Preview the execution effect (always successful) without actually applying the changes\n -h, --help help for apply\n --ignore-fields strings Ignore differences of target fields\n --no-style no-style sets to RawOutput mode and disables all of styling\n --operator string Specify the operator\n -o, --output string Specify the output format\n --port-forward int Forward the specified port from local to service\n --watch After creating/updating/deleting the requested object, watch for changes\n -w, --workdir string The work directory to run Kusion CLI.\n --workspace string The name of target workspace to operate in.\n -y, --yes Automatically approve and perform the update after previewing it\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6fb6dfc9.b1266252.js b/assets/js/6fb6dfc9.b1266252.js new file mode 100644 index 00000000000..f7e933b00b7 --- /dev/null +++ b/assets/js/6fb6dfc9.b1266252.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9440],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),l=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=l(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),d=l(n),f=o,m=d["".concat(s,".").concat(f)]||d[f]||u[f]||a;return n?r.createElement(m,i(i({ref:t},c),{},{components:n})):r.createElement(m,i({ref:t},c))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=d;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p.mdxType="string"==typeof e?e:o,i[1]=p;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>p,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={},i="kusion apply",p={unversionedId:"reference/commands/kusion-apply",id:"reference/commands/kusion-apply",title:"kusion apply",description:"Apply the operational intent of various resources to multiple runtimes",source:"@site/docs/kusion/6-reference/1-commands/kusion-apply.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-apply",permalink:"/docs/next/reference/commands/kusion-apply",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-apply.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Kusion Commands",permalink:"/docs/next/reference/commands/"},next:{title:"kusion config get",permalink:"/docs/next/reference/commands/kusion-config-get"}},s={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],c={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-apply"},"kusion apply"),(0,o.kt)("p",null,"Apply the operational intent of various resources to multiple runtimes"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Apply a series of resource changes within the stack."),(0,o.kt)("p",null," Create, update or delete resources according to the operational intent within a stack. By default, Kusion will generate an execution preview and prompt for your approval before performing any actions. You can review the preview details and make a decision to proceed with the actions or abort them."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion apply [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Apply with specified work directory\n kusion apply -w /path/to/workdir\n \n # Apply with specified arguments\n kusion apply -D name=test -D age=18\n \n # Skip interactive approval of preview details before applying\n kusion apply --yes\n \n # Apply without output style and color\n kusion apply --no-style=true\n \n # Apply with localhost port forwarding\n kusion apply --port-forward=8080\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -a, --all --detail Automatically show all preview details, combined use with flag --detail\n --backend string The backend to use, supports 'local', 'oss' and 's3'.\n -d, --detail Automatically show preview details with interactive options (default true)\n --dry-run Preview the execution effect (always successful) without actually applying the changes\n -h, --help help for apply\n --ignore-fields strings Ignore differences of target fields\n --no-style no-style sets to RawOutput mode and disables all of styling\n --operator string Specify the operator\n -o, --output string Specify the output format\n --port-forward int Forward the specified port from local to service\n --watch After creating/updating/deleting the requested object, watch for changes\n -w, --workdir string The work directory to run Kusion CLI.\n --workspace string The name of target workspace to operate in.\n -y, --yes Automatically approve and perform the update after previewing it\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/70fd01e9.2e4d3f4c.js b/assets/js/70fd01e9.2e4d3f4c.js deleted file mode 100644 index b52ef93f366..00000000000 --- a/assets/js/70fd01e9.2e4d3f4c.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2291],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},l=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),f=p(n),m=a,u=f["".concat(c,".").concat(m)]||f[m]||d[m]||i;return n?r.createElement(u,o(o({ref:t},l),{},{components:n})):r.createElement(u,o({ref:t},l))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=f;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const i={sidebar_label:"Overview",id:"overview"},o="Overview",s={unversionedId:"concepts/stack/overview",id:"concepts/stack/overview",title:"Overview",description:"A stack in Kusion is defined as a folder within the project directory that contains a stack.yaml file. Stacks provide a mechanism to isolate multiple sets of different configurations in the same project. It is also the smallest unit of operation that can be configured and deployed independently.",source:"@site/docs/kusion/3-concepts/2-stack/1-overview.md",sourceDirName:"3-concepts/2-stack",slug:"/concepts/stack/overview",permalink:"/docs/next/concepts/stack/overview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/3-concepts/2-stack/1-overview.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_label:"Overview",id:"overview"},sidebar:"kusion",previous:{title:"Project file reference",permalink:"/docs/next/concepts/project/configuration"},next:{title:"Stack file reference",permalink:"/docs/next/concepts/stack/configuration"}},c={},p=[{value:"High Level Schema",id:"high-level-schema",level:2}],l={toc:p};function d(e){let{components:t,...i}=e;return(0,a.kt)("wrapper",(0,r.Z)({},l,i,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"overview"},"Overview"),(0,a.kt)("p",null,"A stack in Kusion is defined as a folder within the project directory that contains a ",(0,a.kt)("inlineCode",{parentName:"p"},"stack.yaml")," file. Stacks provide a mechanism to isolate multiple sets of different configurations in the same project. It is also the smallest unit of operation that can be configured and deployed independently. "),(0,a.kt)("p",null,"The most common way to leverage stacks is to denote different phases of the software development lifecycle, such as ",(0,a.kt)("inlineCode",{parentName:"p"},"development"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"staging"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"production"),", etc. For instance, in the case where the image and resource requirements for an application workload might be different across different phases in the SDLC, they can be represented by different stacks in the same project, namely ",(0,a.kt)("inlineCode",{parentName:"p"},"dev"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"stage")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"prod"),"."),(0,a.kt)("p",null,'To distinguish this from the deploy-time concept of a "target environment" - which Kusion defines as ',(0,a.kt)("inlineCode",{parentName:"p"},"workspaces"),", ",(0,a.kt)("strong",{parentName:"p"},"stack")," is a development-time concept for application developers to manage different configurations. One way to illustrate the difference is that you can easily be deploying the ",(0,a.kt)("inlineCode",{parentName:"p"},"prod")," stack to multiple target environments, for example, ",(0,a.kt)("inlineCode",{parentName:"p"},"aws-prod-us-east"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"aws-prod-us-east-2")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"azure-prod-westus"),"."),(0,a.kt)("h2",{id:"high-level-schema"},"High Level Schema"),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"High_Level_Schema",src:n(4994).Z,width:"2390",height:"1487"})))}d.isMDXComponent=!0},4994:(e,t,n)=>{n.d(t,{Z:()=>r});const r=n.p+"assets/images/high-level-schema-ba34668ea6879003a582f15496c3ab6e.png"}}]); \ No newline at end of file diff --git a/assets/js/70fd01e9.5c5bd58c.js b/assets/js/70fd01e9.5c5bd58c.js new file mode 100644 index 00000000000..a990a3a1908 --- /dev/null +++ b/assets/js/70fd01e9.5c5bd58c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2291],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>u});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},l=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),f=p(n),u=a,m=f["".concat(c,".").concat(u)]||f[u]||d[u]||i;return n?r.createElement(m,o(o({ref:t},l),{},{components:n})):r.createElement(m,o({ref:t},l))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=f;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const i={sidebar_label:"Overview",id:"overview"},o="Overview",s={unversionedId:"concepts/stack/overview",id:"concepts/stack/overview",title:"Overview",description:"A stack in Kusion is defined as a folder within the project directory that contains a stack.yaml file. Stacks provide a mechanism to isolate multiple sets of different configurations in the same project. It is also the smallest unit of operation that can be configured and deployed independently.",source:"@site/docs/kusion/3-concepts/2-stack/1-overview.md",sourceDirName:"3-concepts/2-stack",slug:"/concepts/stack/overview",permalink:"/docs/next/concepts/stack/overview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/3-concepts/2-stack/1-overview.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_label:"Overview",id:"overview"},sidebar:"kusion",previous:{title:"Project file reference",permalink:"/docs/next/concepts/project/configuration"},next:{title:"Stack file reference",permalink:"/docs/next/concepts/stack/configuration"}},c={},p=[{value:"High Level Schema",id:"high-level-schema",level:2}],l={toc:p};function d(e){let{components:t,...i}=e;return(0,a.kt)("wrapper",(0,r.Z)({},l,i,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"overview"},"Overview"),(0,a.kt)("p",null,"A stack in Kusion is defined as a folder within the project directory that contains a ",(0,a.kt)("inlineCode",{parentName:"p"},"stack.yaml")," file. Stacks provide a mechanism to isolate multiple sets of different configurations in the same project. It is also the smallest unit of operation that can be configured and deployed independently. "),(0,a.kt)("p",null,"The most common way to leverage stacks is to denote different phases of the software development lifecycle, such as ",(0,a.kt)("inlineCode",{parentName:"p"},"development"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"staging"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"production"),", etc. For instance, in the case where the image and resource requirements for an application workload might be different across different phases in the SDLC, they can be represented by different stacks in the same project, namely ",(0,a.kt)("inlineCode",{parentName:"p"},"dev"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"stage")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"prod"),"."),(0,a.kt)("p",null,'To distinguish this from the deploy-time concept of a "target environment" - which Kusion defines as ',(0,a.kt)("inlineCode",{parentName:"p"},"workspaces"),", ",(0,a.kt)("strong",{parentName:"p"},"stack")," is a development-time concept for application developers to manage different configurations. One way to illustrate the difference is that you can easily be deploying the ",(0,a.kt)("inlineCode",{parentName:"p"},"prod")," stack to multiple target environments, for example, ",(0,a.kt)("inlineCode",{parentName:"p"},"aws-prod-us-east"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"aws-prod-us-east-2")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"azure-prod-westus"),"."),(0,a.kt)("h2",{id:"high-level-schema"},"High Level Schema"),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"High_Level_Schema",src:n(4994).Z,width:"2390",height:"1487"})))}d.isMDXComponent=!0},4994:(e,t,n)=>{n.d(t,{Z:()=>r});const r=n.p+"assets/images/high-level-schema-ba34668ea6879003a582f15496c3ab6e.png"}}]); \ No newline at end of file diff --git a/assets/js/725d07b1.5197ba8f.js b/assets/js/725d07b1.f484fcea.js similarity index 51% rename from assets/js/725d07b1.5197ba8f.js rename to assets/js/725d07b1.f484fcea.js index 0d46733cff5..f3b178f231a 100644 --- a/assets/js/725d07b1.5197ba8f.js +++ b/assets/js/725d07b1.f484fcea.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8675],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},l=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,s=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),f=p(n),m=o,d=f["".concat(s,".").concat(m)]||f[m]||u[m]||i;return n?r.createElement(d,a(a({ref:t},l),{},{components:n})):r.createElement(d,a({ref:t},l))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=f;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>c,toc:()=>p});var r=n(87462),o=(n(67294),n(3905));const i={},a="kusion config get",c={unversionedId:"reference/commands/kusion-config-get",id:"version-v0.11/reference/commands/kusion-config-get",title:"kusion config get",description:"Get a config item",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-config-get.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-config-get",permalink:"/docs/reference/commands/kusion-config-get",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-config-get.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion apply",permalink:"/docs/reference/commands/kusion-apply"},next:{title:"kusion config list",permalink:"/docs/reference/commands/kusion-config-list"}},s={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-config-get"},"kusion config get"),(0,o.kt)("p",null,"Get a config item"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command gets the value of a specified kusion config item, where the config item must be registered."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion config get\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Get a config item\n kusion config get backends.current\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for get\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-config"},"kusion config"),"\t - Interact with the Kusion config")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8675],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},l=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,s=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),f=p(n),d=o,m=f["".concat(s,".").concat(d)]||f[d]||u[d]||i;return n?r.createElement(m,a(a({ref:t},l),{},{components:n})):r.createElement(m,a({ref:t},l))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=f;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>c,toc:()=>p});var r=n(87462),o=(n(67294),n(3905));const i={},a="kusion config get",c={unversionedId:"reference/commands/kusion-config-get",id:"version-v0.11/reference/commands/kusion-config-get",title:"kusion config get",description:"Get a config item",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-config-get.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-config-get",permalink:"/docs/reference/commands/kusion-config-get",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-config-get.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion apply",permalink:"/docs/reference/commands/kusion-apply"},next:{title:"kusion config list",permalink:"/docs/reference/commands/kusion-config-list"}},s={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-config-get"},"kusion config get"),(0,o.kt)("p",null,"Get a config item"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command gets the value of a specified kusion config item, where the config item must be registered."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion config get\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Get a config item\n kusion config get backends.current\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for get\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-config"},"kusion config"),"\t - Interact with the Kusion config")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/72b4a38a.9c82468f.js b/assets/js/72b4a38a.9c82468f.js deleted file mode 100644 index 1b9e0222a2e..00000000000 --- a/assets/js/72b4a38a.9c82468f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8537],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),u=p(r),m=o,k=u["".concat(c,".").concat(m)]||u[m]||d[m]||a;return r?n.createElement(k,s(s({ref:t},l),{},{components:r})):n.createElement(k,s({ref:t},l))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>d,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion workspace delete",i={unversionedId:"reference/commands/kusion-workspace-delete",id:"version-v0.11/reference/commands/kusion-workspace-delete",title:"kusion workspace delete",description:"Delete a workspace",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-delete.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-delete",permalink:"/docs/reference/commands/kusion-workspace-delete",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-delete.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace create",permalink:"/docs/reference/commands/kusion-workspace-create"},next:{title:"kusion workspace list",permalink:"/docs/reference/commands/kusion-workspace-list"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-delete"},"kusion workspace delete"),(0,o.kt)("p",null,"Delete a workspace"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command deletes the current or a specified workspace."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace delete\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Delete the current workspace\n kusion workspace delete\n \n # Delete a specified workspace\n kusion workspace delete dev\n \n # Delete a specified workspace in a specified backend\n kusion workspace delete prod --backend oss-prod\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string the backend name\n -h, --help help for delete\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/72b4a38a.f5e5db44.js b/assets/js/72b4a38a.f5e5db44.js new file mode 100644 index 00000000000..acf05fcc4c2 --- /dev/null +++ b/assets/js/72b4a38a.f5e5db44.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8537],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>k});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),u=p(r),k=o,m=u["".concat(c,".").concat(k)]||u[k]||d[k]||a;return r?n.createElement(m,s(s({ref:t},l),{},{components:r})):n.createElement(m,s({ref:t},l))}));function k(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>d,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion workspace delete",i={unversionedId:"reference/commands/kusion-workspace-delete",id:"version-v0.11/reference/commands/kusion-workspace-delete",title:"kusion workspace delete",description:"Delete a workspace",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-delete.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-delete",permalink:"/docs/reference/commands/kusion-workspace-delete",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-delete.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace create",permalink:"/docs/reference/commands/kusion-workspace-create"},next:{title:"kusion workspace list",permalink:"/docs/reference/commands/kusion-workspace-list"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-delete"},"kusion workspace delete"),(0,o.kt)("p",null,"Delete a workspace"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command deletes the current or a specified workspace."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace delete\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Delete the current workspace\n kusion workspace delete\n \n # Delete a specified workspace\n kusion workspace delete dev\n \n # Delete a specified workspace in a specified backend\n kusion workspace delete prod --backend oss-prod\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string the backend name\n -h, --help help for delete\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/73743333.881b46c2.js b/assets/js/73743333.881b46c2.js deleted file mode 100644 index 6c9274d0d44..00000000000 --- a/assets/js/73743333.881b46c2.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9160],{3905:(e,n,r)=>{r.d(n,{Zo:()=>u,kt:()=>d});var t=r(67294);function o(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function i(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,t)}return r}function s(e){for(var n=1;n=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=t.createContext({}),l=function(e){var n=t.useContext(c),r=n;return e&&(r="function"==typeof e?e(n):s(s({},n),e)),r},u=function(e){var n=l(e.components);return t.createElement(c.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},f=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,u=a(e,["components","mdxType","originalType","parentName"]),f=l(r),d=o,v=f["".concat(c,".").concat(d)]||f[d]||p[d]||i;return r?t.createElement(v,s(s({ref:n},u),{},{components:r})):t.createElement(v,s({ref:n},u))}));function d(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=r.length,s=new Array(i);s[0]=f;var a={};for(var c in n)hasOwnProperty.call(n,c)&&(a[c]=n[c]);a.originalType=e,a.mdxType="string"==typeof e?e:o,s[1]=a;for(var l=2;l{r.r(n),r.d(n,{assets:()=>c,contentTitle:()=>s,default:()=>p,frontMatter:()=>i,metadata:()=>a,toc:()=>l});var t=r(87462),o=(r(67294),r(3905));const i={},s="kusion version",a={unversionedId:"reference/cli/kusion/kusion_version",id:"version-v0.9/reference/cli/kusion/kusion_version",title:"kusion version",description:"Print the Kusion version information for the current context",source:"@site/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_version.md",sourceDirName:"reference/cli/kusion",slug:"/reference/cli/kusion/kusion_version",permalink:"/docs/v0.9/reference/cli/kusion/kusion_version",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_version.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion preview",permalink:"/docs/v0.9/reference/cli/kusion/kusion_preview"},next:{title:"Backend Configuration",permalink:"/docs/v0.9/reference/cli/backend/backend-configuration"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 28-Sep-2023",id:"auto-generated-by-spf13cobra-on-28-sep-2023",level:6}],u={toc:l};function p(e){let{components:n,...r}=e;return(0,o.kt)("wrapper",(0,t.Z)({},u,r,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-version"},"kusion version"),(0,o.kt)("p",null,"Print the Kusion version information for the current context"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Print the Kusion version information for the current context"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion version [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Print the Kusion version\n kusion version\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for version\n -o, --output string Output format. Only json format is supported for now\n")),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.9/reference/cli/kusion/"},"kusion"),"\t - Kusion is the platform engineering engine of KusionStack")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-28-sep-2023"},"Auto generated by spf13/cobra on 28-Sep-2023"))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/73743333.a6cb08b1.js b/assets/js/73743333.a6cb08b1.js new file mode 100644 index 00000000000..0292289ea2f --- /dev/null +++ b/assets/js/73743333.a6cb08b1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9160],{3905:(e,n,r)=>{r.d(n,{Zo:()=>l,kt:()=>d});var t=r(67294);function o(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function i(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,t)}return r}function s(e){for(var n=1;n=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=t.createContext({}),u=function(e){var n=t.useContext(c),r=n;return e&&(r="function"==typeof e?e(n):s(s({},n),e)),r},l=function(e){var n=u(e.components);return t.createElement(c.Provider,{value:n},e.children)},p={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},f=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,l=a(e,["components","mdxType","originalType","parentName"]),f=u(r),d=o,v=f["".concat(c,".").concat(d)]||f[d]||p[d]||i;return r?t.createElement(v,s(s({ref:n},l),{},{components:r})):t.createElement(v,s({ref:n},l))}));function d(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=r.length,s=new Array(i);s[0]=f;var a={};for(var c in n)hasOwnProperty.call(n,c)&&(a[c]=n[c]);a.originalType=e,a.mdxType="string"==typeof e?e:o,s[1]=a;for(var u=2;u{r.r(n),r.d(n,{assets:()=>c,contentTitle:()=>s,default:()=>p,frontMatter:()=>i,metadata:()=>a,toc:()=>u});var t=r(87462),o=(r(67294),r(3905));const i={},s="kusion version",a={unversionedId:"reference/cli/kusion/kusion_version",id:"version-v0.9/reference/cli/kusion/kusion_version",title:"kusion version",description:"Print the Kusion version information for the current context",source:"@site/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_version.md",sourceDirName:"reference/cli/kusion",slug:"/reference/cli/kusion/kusion_version",permalink:"/docs/v0.9/reference/cli/kusion/kusion_version",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_version.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion preview",permalink:"/docs/v0.9/reference/cli/kusion/kusion_preview"},next:{title:"Backend Configuration",permalink:"/docs/v0.9/reference/cli/backend/backend-configuration"}},c={},u=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 28-Sep-2023",id:"auto-generated-by-spf13cobra-on-28-sep-2023",level:6}],l={toc:u};function p(e){let{components:n,...r}=e;return(0,o.kt)("wrapper",(0,t.Z)({},l,r,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-version"},"kusion version"),(0,o.kt)("p",null,"Print the Kusion version information for the current context"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Print the Kusion version information for the current context"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion version [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Print the Kusion version\n kusion version\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for version\n -o, --output string Output format. Only json format is supported for now\n")),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.9/reference/cli/kusion/"},"kusion"),"\t - Kusion is the platform engineering engine of KusionStack")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-28-sep-2023"},"Auto generated by spf13/cobra on 28-Sep-2023"))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/74aaa9a4.0c340cc6.js b/assets/js/74aaa9a4.0c340cc6.js new file mode 100644 index 00000000000..89cd8b47cba --- /dev/null +++ b/assets/js/74aaa9a4.0c340cc6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9042],{3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),p=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},u=function(e){var n=p(e.components);return r.createElement(c.Provider,{value:n},e.children)},l={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),f=p(t),m=o,d=f["".concat(c,".").concat(m)]||f[m]||l[m]||i;return t?r.createElement(d,a(a({ref:n},u),{},{components:t})):r.createElement(d,a({ref:n},u))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=f;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var p=2;p{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>a,default:()=>l,frontMatter:()=>i,metadata:()=>s,toc:()=>p});var r=t(87462),o=(t(67294),t(3905));const i={},a="kusion config unset",s={unversionedId:"reference/commands/kusion-config-unset",id:"reference/commands/kusion-config-unset",title:"kusion config unset",description:"Unset a config item",source:"@site/docs/kusion/6-reference/1-commands/kusion-config-unset.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-config-unset",permalink:"/docs/next/reference/commands/kusion-config-unset",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-config-unset.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion config set",permalink:"/docs/next/reference/commands/kusion-config-set"},next:{title:"kusion config",permalink:"/docs/next/reference/commands/kusion-config"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],u={toc:p};function l(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-config-unset"},"kusion config unset"),(0,o.kt)("p",null,"Unset a config item"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command unsets a specified kusion config item, where the config item must be registered."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion config unset\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Unset a config item\n kusion config unset backends.mysql-pre.configs.port\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for unset\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-config"},"kusion config"),"\t - Interact with the Kusion config")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}l.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/74aaa9a4.48e191b2.js b/assets/js/74aaa9a4.48e191b2.js deleted file mode 100644 index 84ed4c7644c..00000000000 --- a/assets/js/74aaa9a4.48e191b2.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9042],{3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function s(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),p=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},u=function(e){var n=p(e.components);return r.createElement(c.Provider,{value:n},e.children)},l={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,u=a(e,["components","mdxType","originalType","parentName"]),f=p(t),m=o,d=f["".concat(c,".").concat(m)]||f[m]||l[m]||i;return t?r.createElement(d,s(s({ref:n},u),{},{components:t})):r.createElement(d,s({ref:n},u))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,s=new Array(i);s[0]=f;var a={};for(var c in n)hasOwnProperty.call(n,c)&&(a[c]=n[c]);a.originalType=e,a.mdxType="string"==typeof e?e:o,s[1]=a;for(var p=2;p{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>s,default:()=>l,frontMatter:()=>i,metadata:()=>a,toc:()=>p});var r=t(87462),o=(t(67294),t(3905));const i={},s="kusion config unset",a={unversionedId:"reference/commands/kusion-config-unset",id:"reference/commands/kusion-config-unset",title:"kusion config unset",description:"Unset a config item",source:"@site/docs/kusion/6-reference/1-commands/kusion-config-unset.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-config-unset",permalink:"/docs/next/reference/commands/kusion-config-unset",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-config-unset.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion config set",permalink:"/docs/next/reference/commands/kusion-config-set"},next:{title:"kusion config",permalink:"/docs/next/reference/commands/kusion-config"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],u={toc:p};function l(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-config-unset"},"kusion config unset"),(0,o.kt)("p",null,"Unset a config item"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command unsets a specified kusion config item, where the config item must be registered."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion config unset\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Unset a config item\n kusion config unset backends.mysql-pre.configs.port\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for unset\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-config"},"kusion config"),"\t - Interact with the Kusion config")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}l.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/74fcf2e7.404d89f0.js b/assets/js/74fcf2e7.10d4c088.js similarity index 51% rename from assets/js/74fcf2e7.404d89f0.js rename to assets/js/74fcf2e7.10d4c088.js index 7cbe934d454..a679b05b852 100644 --- a/assets/js/74fcf2e7.404d89f0.js +++ b/assets/js/74fcf2e7.10d4c088.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2137],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},u=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,u=a(e,["components","mdxType","originalType","parentName"]),d=l(n),f=o,y=d["".concat(c,".").concat(f)]||d[f]||p[f]||i;return n?r.createElement(y,s(s({ref:t},u),{},{components:n})):r.createElement(y,s({ref:t},u))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,s=new Array(i);s[0]=d;var a={};for(var c in t)hasOwnProperty.call(t,c)&&(a[c]=t[c]);a.originalType=e,a.mdxType="string"==typeof e?e:o,s[1]=a;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>p,frontMatter:()=>i,metadata:()=>a,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const i={},s="kusion destroy",a={unversionedId:"reference/cli/kusion/kusion_destroy",id:"version-v0.9/reference/cli/kusion/kusion_destroy",title:"kusion destroy",description:"Delete the specified resources in runtime",source:"@site/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_destroy.md",sourceDirName:"reference/cli/kusion",slug:"/reference/cli/kusion/kusion_destroy",permalink:"/docs/v0.9/reference/cli/kusion/kusion_destroy",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_destroy.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion compile",permalink:"/docs/v0.9/reference/cli/kusion/kusion_compile"},next:{title:"kusion init",permalink:"/docs/v0.9/reference/cli/kusion/kusion_init"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 28-Sep-2023",id:"auto-generated-by-spf13cobra-on-28-sep-2023",level:6}],u={toc:l};function p(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-destroy"},"kusion destroy"),(0,o.kt)("p",null,"Delete the specified resources in runtime"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Delete resources by resource spec."),(0,o.kt)("p",null," Only KCL files are accepted. Only one type of arguments may be specified: filenames, resources and names, or resources and label selector."),(0,o.kt)("p",null," Note that the destroy command does NOT do resource version checks, so if someone submits an update to a resource right when you submit a destroy, their update will be lost along with the rest of the resource."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion destroy [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Delete the configuration of current stack\n kusion destroy\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -D, --argument stringToString Specify the top-level argument (default [])\n -C, --backend-config strings backend-config config state storage backend\n --backend-type string backend-type specify state storage backend\n -d, --detail Automatically show plan details after previewing it\n -h, --help help for destroy\n --operator string Specify the operator\n -O, --overrides strings Specify the configuration override path and value\n -Y, --setting strings Specify the command line setting files\n -w, --workdir string Specify the work directory\n -y, --yes Automatically approve and perform the update after previewing it\n")),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.9/reference/cli/kusion/"},"kusion"),"\t - Kusion is the platform engineering engine of KusionStack")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-28-sep-2023"},"Auto generated by spf13/cobra on 28-Sep-2023"))}p.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2137],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},u=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,u=a(e,["components","mdxType","originalType","parentName"]),d=l(n),f=o,y=d["".concat(c,".").concat(f)]||d[f]||p[f]||i;return n?r.createElement(y,s(s({ref:t},u),{},{components:n})):r.createElement(y,s({ref:t},u))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,s=new Array(i);s[0]=d;var a={};for(var c in t)hasOwnProperty.call(t,c)&&(a[c]=t[c]);a.originalType=e,a.mdxType="string"==typeof e?e:o,s[1]=a;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>p,frontMatter:()=>i,metadata:()=>a,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const i={},s="kusion destroy",a={unversionedId:"reference/cli/kusion/kusion_destroy",id:"version-v0.9/reference/cli/kusion/kusion_destroy",title:"kusion destroy",description:"Delete the specified resources in runtime",source:"@site/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_destroy.md",sourceDirName:"reference/cli/kusion",slug:"/reference/cli/kusion/kusion_destroy",permalink:"/docs/v0.9/reference/cli/kusion/kusion_destroy",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_destroy.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion compile",permalink:"/docs/v0.9/reference/cli/kusion/kusion_compile"},next:{title:"kusion init",permalink:"/docs/v0.9/reference/cli/kusion/kusion_init"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 28-Sep-2023",id:"auto-generated-by-spf13cobra-on-28-sep-2023",level:6}],u={toc:l};function p(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-destroy"},"kusion destroy"),(0,o.kt)("p",null,"Delete the specified resources in runtime"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Delete resources by resource spec."),(0,o.kt)("p",null," Only KCL files are accepted. Only one type of arguments may be specified: filenames, resources and names, or resources and label selector."),(0,o.kt)("p",null," Note that the destroy command does NOT do resource version checks, so if someone submits an update to a resource right when you submit a destroy, their update will be lost along with the rest of the resource."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion destroy [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Delete the configuration of current stack\n kusion destroy\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -D, --argument stringToString Specify the top-level argument (default [])\n -C, --backend-config strings backend-config config state storage backend\n --backend-type string backend-type specify state storage backend\n -d, --detail Automatically show plan details after previewing it\n -h, --help help for destroy\n --operator string Specify the operator\n -O, --overrides strings Specify the configuration override path and value\n -Y, --setting strings Specify the command line setting files\n -w, --workdir string Specify the work directory\n -y, --yes Automatically approve and perform the update after previewing it\n")),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.9/reference/cli/kusion/"},"kusion"),"\t - Kusion is the platform engineering engine of KusionStack")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-28-sep-2023"},"Auto generated by spf13/cobra on 28-Sep-2023"))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/75071e09.4cbcf657.js b/assets/js/75071e09.4cbcf657.js new file mode 100644 index 00000000000..d119d7cec80 --- /dev/null +++ b/assets/js/75071e09.4cbcf657.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3485],{3905:(e,n,t)=>{t.d(n,{Zo:()=>s,kt:()=>k});var o=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function a(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var l=o.createContext({}),c=function(e){var n=o.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},s=function(e){var n=c(e.components);return o.createElement(l.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},d=o.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),d=c(t),k=r,g=d["".concat(l,".").concat(k)]||d[k]||u[k]||i;return t?o.createElement(g,a(a({ref:n},s),{},{components:t})):o.createElement(g,a({ref:n},s))}));function k(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,a=new Array(i);a[0]=d;var p={};for(var l in n)hasOwnProperty.call(n,l)&&(p[l]=n[l]);p.originalType=e,p.mdxType="string"==typeof e?e:r,a[1]=p;for(var c=2;c{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>p,toc:()=>c});var o=t(87462),r=(t(67294),t(3905));const i={id:"networking"},a="Application Networking",p={unversionedId:"configuration-walkthrough/networking",id:"configuration-walkthrough/networking",title:"Application Networking",description:"In addition to configuring application's container specifications, you can also configure its networking behaviors, including how to expose the application and how it can be accessed. You can specify a network module in the accessories field in AppConfiguration to achieve that.",source:"@site/docs/kusion/4-configuration-walkthrough/5-networking.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/networking",permalink:"/docs/next/configuration-walkthrough/networking",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/4-configuration-walkthrough/5-networking.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:5,frontMatter:{id:"networking"},sidebar:"kusion",previous:{title:"Workload",permalink:"/docs/next/configuration-walkthrough/workload"},next:{title:"Managed Databases",permalink:"/docs/next/configuration-walkthrough/databse"}},l={},c=[{value:"Import",id:"import",level:2},{value:"Private vs Public Access",id:"private-vs-public-access",level:2},{value:"Mapping ports",id:"mapping-ports",level:2},{value:"Exposing multiple ports",id:"exposing-multiple-ports",level:2},{value:"Choosing protocol",id:"choosing-protocol",level:2}],s={toc:c};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,o.Z)({},s,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"application-networking"},"Application Networking"),(0,r.kt)("p",null,"In addition to configuring application's ",(0,r.kt)("a",{parentName:"p",href:"workload#configure-containers"},"container specifications"),", you can also configure its networking behaviors, including how to expose the application and how it can be accessed. You can specify a ",(0,r.kt)("inlineCode",{parentName:"p"},"network")," module in the ",(0,r.kt)("inlineCode",{parentName:"p"},"accessories")," field in ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," to achieve that."),(0,r.kt)("p",null,"In future versions, this will also include ingress-based routing strategy and DNS configurations."),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"kam")," package and the ",(0,r.kt)("inlineCode",{parentName:"p"},"network")," Kusion Module. For more details on KCL package and module import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport network.network as n\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"kcl.mod")," must contain reference to the network module:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'#...\n\n[dependencies]\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\n\n#...\n')),(0,r.kt)("h2",{id:"private-vs-public-access"},"Private vs Public Access"),(0,r.kt)("p",null,"Private network access means the service can only be access from within the target cluster."),(0,r.kt)("p",null,"Public access is implemented using public load balancers on the cloud. This generally requires a Kubernetes cluster that is running on the cloud with a vendor-specific service controller."),(0,r.kt)("p",null,"Any ports defined default to private access unless explicitly specified."),(0,r.kt)("p",null,"To expose port 80 to be accessed privately:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n }\n}\n')),(0,r.kt)("p",null,"To expose port 80 to be accessed publicly:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n public: True\n }\n ]\n }\n }\n}\n')),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"The CSP (Cloud Service Provider) used to provide load balancers is defined by platform engineers in workspace.")),(0,r.kt)("h2",{id:"mapping-ports"},"Mapping ports"),(0,r.kt)("p",null,"To expose a port ",(0,r.kt)("inlineCode",{parentName:"p"},"80")," that maps to a different port ",(0,r.kt)("inlineCode",{parentName:"p"},"8088")," on the container:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n targetPort: 8088\n }\n ]\n }\n }\n}\n')),(0,r.kt)("h2",{id:"exposing-multiple-ports"},"Exposing multiple ports"),(0,r.kt)("p",null,"You can also expose multiple ports and configure them separately. "),(0,r.kt)("p",null,"To expose port 80 to be accessed publicly, and port 9099 for private access (to be scraped by Prometheus, for example):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n public: True\n }\n n.Port {\n port: 9099\n }\n ]\n }\n }\n}\n')),(0,r.kt)("h2",{id:"choosing-protocol"},"Choosing protocol"),(0,r.kt)("p",null,"To expose a port using the ",(0,r.kt)("inlineCode",{parentName:"p"},"UDP")," protocol:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n targetPort: 8088\n protocol: "UDP"\n }\n ]\n }\n }\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/75071e09.b3920acf.js b/assets/js/75071e09.b3920acf.js deleted file mode 100644 index abe1f3fc2bf..00000000000 --- a/assets/js/75071e09.b3920acf.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3485],{3905:(e,n,t)=>{t.d(n,{Zo:()=>s,kt:()=>k});var o=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function a(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var l=o.createContext({}),c=function(e){var n=o.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},s=function(e){var n=c(e.components);return o.createElement(l.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},d=o.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),d=c(t),k=r,m=d["".concat(l,".").concat(k)]||d[k]||u[k]||i;return t?o.createElement(m,a(a({ref:n},s),{},{components:t})):o.createElement(m,a({ref:n},s))}));function k(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,a=new Array(i);a[0]=d;var p={};for(var l in n)hasOwnProperty.call(n,l)&&(p[l]=n[l]);p.originalType=e,p.mdxType="string"==typeof e?e:r,a[1]=p;for(var c=2;c{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>p,toc:()=>c});var o=t(87462),r=(t(67294),t(3905));const i={id:"networking"},a="Application Networking",p={unversionedId:"configuration-walkthrough/networking",id:"configuration-walkthrough/networking",title:"Application Networking",description:"In addition to configuring application's container specifications, you can also configure its networking behaviors, including how to expose the application and how it can be accessed. You can specify a network module in the accessories field in AppConfiguration to achieve that.",source:"@site/docs/kusion/4-configuration-walkthrough/5-networking.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/networking",permalink:"/docs/next/configuration-walkthrough/networking",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/4-configuration-walkthrough/5-networking.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:5,frontMatter:{id:"networking"},sidebar:"kusion",previous:{title:"Workload",permalink:"/docs/next/configuration-walkthrough/workload"},next:{title:"Managed Databases",permalink:"/docs/next/configuration-walkthrough/databse"}},l={},c=[{value:"Import",id:"import",level:2},{value:"Private vs Public Access",id:"private-vs-public-access",level:2},{value:"Mapping ports",id:"mapping-ports",level:2},{value:"Exposing multiple ports",id:"exposing-multiple-ports",level:2},{value:"Choosing protocol",id:"choosing-protocol",level:2}],s={toc:c};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,o.Z)({},s,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"application-networking"},"Application Networking"),(0,r.kt)("p",null,"In addition to configuring application's ",(0,r.kt)("a",{parentName:"p",href:"workload#configure-containers"},"container specifications"),", you can also configure its networking behaviors, including how to expose the application and how it can be accessed. You can specify a ",(0,r.kt)("inlineCode",{parentName:"p"},"network")," module in the ",(0,r.kt)("inlineCode",{parentName:"p"},"accessories")," field in ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," to achieve that."),(0,r.kt)("p",null,"In future versions, this will also include ingress-based routing strategy and DNS configurations."),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"kam")," package and the ",(0,r.kt)("inlineCode",{parentName:"p"},"network")," Kusion Module. For more details on KCL package and module import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport network.network as n\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"kcl.mod")," must contain reference to the network module:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'#...\n\n[dependencies]\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\n\n#...\n')),(0,r.kt)("h2",{id:"private-vs-public-access"},"Private vs Public Access"),(0,r.kt)("p",null,"Private network access means the service can only be access from within the target cluster."),(0,r.kt)("p",null,"Public access is implemented using public load balancers on the cloud. This generally requires a Kubernetes cluster that is running on the cloud with a vendor-specific service controller."),(0,r.kt)("p",null,"Any ports defined default to private access unless explicitly specified."),(0,r.kt)("p",null,"To expose port 80 to be accessed privately:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n }\n}\n')),(0,r.kt)("p",null,"To expose port 80 to be accessed publicly:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n public: True\n }\n ]\n }\n }\n}\n')),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"The CSP (Cloud Service Provider) used to provide load balancers is defined by platform engineers in workspace.")),(0,r.kt)("h2",{id:"mapping-ports"},"Mapping ports"),(0,r.kt)("p",null,"To expose a port ",(0,r.kt)("inlineCode",{parentName:"p"},"80")," that maps to a different port ",(0,r.kt)("inlineCode",{parentName:"p"},"8088")," on the container:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n targetPort: 8088\n }\n ]\n }\n }\n}\n')),(0,r.kt)("h2",{id:"exposing-multiple-ports"},"Exposing multiple ports"),(0,r.kt)("p",null,"You can also expose multiple ports and configure them separately. "),(0,r.kt)("p",null,"To expose port 80 to be accessed publicly, and port 9099 for private access (to be scraped by Prometheus, for example):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n public: True\n }\n n.Port {\n port: 9099\n }\n ]\n }\n }\n}\n')),(0,r.kt)("h2",{id:"choosing-protocol"},"Choosing protocol"),(0,r.kt)("p",null,"To expose a port using the ",(0,r.kt)("inlineCode",{parentName:"p"},"UDP")," protocol:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n targetPort: 8088\n protocol: "UDP"\n }\n ]\n }\n }\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/75b6673c.69b623ea.js b/assets/js/75b6673c.69b623ea.js deleted file mode 100644 index 9f1081f3862..00000000000 --- a/assets/js/75b6673c.69b623ea.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1550],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=o.createContext({}),c=function(e){var t=o.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=c(e.components);return o.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=c(n),m=r,f=d["".concat(l,".").concat(m)]||d[m]||u[m]||a;return n?o.createElement(f,i(i({ref:t},p),{},{components:n})):o.createElement(f,i({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,i=new Array(a);i[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>c});var o=n(87462),r=(n(67294),n(3905));const a={},i="Overview",s={unversionedId:"concepts/kusion-module/overview",id:"concepts/kusion-module/overview",title:"Overview",description:"A Kusion module is a reusable building block designed by platform engineers to standardize application deployments and enable app developers to self-service. It consists of two parts:",source:"@site/docs/kusion/3-concepts/3-kusion-module/1-overview.md",sourceDirName:"3-concepts/3-kusion-module",slug:"/concepts/kusion-module/overview",permalink:"/docs/next/concepts/kusion-module/overview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/3-concepts/3-kusion-module/1-overview.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{},sidebar:"kusion",previous:{title:"Stack file reference",permalink:"/docs/next/concepts/stack/configuration"},next:{title:"Platform Engineer Develop Guide",permalink:"/docs/next/concepts/kusion-module/develop-guide"}},l={},c=[],p={toc:c};function u(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,o.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"overview"},"Overview"),(0,r.kt)("p",null,"A Kusion module is a reusable building block designed by platform engineers to standardize application deployments and enable app developers to self-service. It consists of two parts:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"App developer-oriented schema: It is a ",(0,r.kt)("a",{parentName:"li",href:"https://kcl-lang.io/docs/user_docs/guides/schema-definition/"},"KCL schema"),". Fields in this schema are recommended to be understandable to application developers and workspace-agnostic. For example, a database Kusion module schema only contains fields like database engine type and database version."),(0,r.kt)("li",{parentName:"ul"},"Kusion module generator: It is a piece of logic that generates the Intent with an instantiated schema mentioned above, along with platform configurations (",(0,r.kt)("a",{parentName:"li",href:"../workspace"},"workspace"),"). As a building block, Kusion module hides the complexity of infrastructures. A database Kusion module not only represents a cloud RDS, but it also contains logic to configure other resources such as security groups and IAM policies. Additionally, it seamlessly injects the database host address, username, and password into the workload's environment variables. The generator logic can be very complex in some situations so we recommend implementing it in a GPL like ",(0,r.kt)("a",{parentName:"li",href:"https://go.dev/"},"go"),".")),(0,r.kt)("p",null,"Here are some explanations of Kusion Module:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"It represents an independent unit that provides a specific capability to the application with clear business semantics."),(0,r.kt)("li",{parentName:"ol"},"It consists of one or multiple infrastructure resources (K8s/Terraform resources), but it is not merely a collection of unrelated resources. For instance, a database, monitoring capabilities, and network access are typical Kusion Modules."),(0,r.kt)("li",{parentName:"ol"},"Modules should not have dependencies or be nested within each other."),(0,r.kt)("li",{parentName:"ol"},"AppConfig is not a Module.")),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kusion-module",src:n(63623).Z,width:"1443",height:"429"})))}u.isMDXComponent=!0},63623:(e,t,n)=>{n.d(t,{Z:()=>o});const o=n.p+"assets/images/kusion-module-635aee19e95fcd57ebebeaa106fa04ee.png"}}]); \ No newline at end of file diff --git a/assets/js/75b6673c.af8ec448.js b/assets/js/75b6673c.af8ec448.js new file mode 100644 index 00000000000..997aae18a3e --- /dev/null +++ b/assets/js/75b6673c.af8ec448.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1550],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=o.createContext({}),c=function(e){var t=o.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=c(e.components);return o.createElement(l.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,l=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=c(n),m=r,f=d["".concat(l,".").concat(m)]||d[m]||p[m]||a;return n?o.createElement(f,i(i({ref:t},u),{},{components:n})):o.createElement(f,i({ref:t},u))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,i=new Array(a);i[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>p,frontMatter:()=>a,metadata:()=>s,toc:()=>c});var o=n(87462),r=(n(67294),n(3905));const a={},i="Overview",s={unversionedId:"concepts/kusion-module/overview",id:"concepts/kusion-module/overview",title:"Overview",description:"A Kusion module is a reusable building block designed by platform engineers to standardize application deployments and enable app developers to self-service. It consists of two parts:",source:"@site/docs/kusion/3-concepts/3-kusion-module/1-overview.md",sourceDirName:"3-concepts/3-kusion-module",slug:"/concepts/kusion-module/overview",permalink:"/docs/next/concepts/kusion-module/overview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/3-concepts/3-kusion-module/1-overview.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{},sidebar:"kusion",previous:{title:"Stack file reference",permalink:"/docs/next/concepts/stack/configuration"},next:{title:"Platform Engineer Develop Guide",permalink:"/docs/next/concepts/kusion-module/develop-guide"}},l={},c=[],u={toc:c};function p(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,o.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"overview"},"Overview"),(0,r.kt)("p",null,"A Kusion module is a reusable building block designed by platform engineers to standardize application deployments and enable app developers to self-service. It consists of two parts:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"App developer-oriented schema: It is a ",(0,r.kt)("a",{parentName:"li",href:"https://kcl-lang.io/docs/user_docs/guides/schema-definition/"},"KCL schema"),". Fields in this schema are recommended to be understandable to application developers and workspace-agnostic. For example, a database Kusion module schema only contains fields like database engine type and database version."),(0,r.kt)("li",{parentName:"ul"},"Kusion module generator: It is a piece of logic that generates the Intent with an instantiated schema mentioned above, along with platform configurations (",(0,r.kt)("a",{parentName:"li",href:"../workspace"},"workspace"),"). As a building block, Kusion module hides the complexity of infrastructures. A database Kusion module not only represents a cloud RDS, but it also contains logic to configure other resources such as security groups and IAM policies. Additionally, it seamlessly injects the database host address, username, and password into the workload's environment variables. The generator logic can be very complex in some situations so we recommend implementing it in a GPL like ",(0,r.kt)("a",{parentName:"li",href:"https://go.dev/"},"go"),".")),(0,r.kt)("p",null,"Here are some explanations of the Kusion Module:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"It represents an independent unit that provides a specific capability to the application with clear business semantics."),(0,r.kt)("li",{parentName:"ol"},"It consists of one or multiple infrastructure resources (K8s/Terraform resources), but it is not merely a collection of unrelated resources. For instance, a database, monitoring capabilities, and network access are typical Kusion Modules."),(0,r.kt)("li",{parentName:"ol"},"Modules should not have dependencies or be nested within each other."),(0,r.kt)("li",{parentName:"ol"},"AppConfig is not a Module."),(0,r.kt)("li",{parentName:"ol"},"Kusion Module is a superset of ",(0,r.kt)("a",{parentName:"li",href:"https://www.kcl-lang.io/docs/user_docs/guides/package-management/quick-start"},"KPM"),". It leverages the KPM to manage KCL schemas in the Kusion module.")),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kusion-module",src:n(63623).Z,width:"1443",height:"429"})))}p.isMDXComponent=!0},63623:(e,t,n)=>{n.d(t,{Z:()=>o});const o=n.p+"assets/images/kusion-module-635aee19e95fcd57ebebeaa106fa04ee.png"}}]); \ No newline at end of file diff --git a/assets/js/75ecccc2.9515e54d.js b/assets/js/75ecccc2.f8d9a328.js similarity index 53% rename from assets/js/75ecccc2.9515e54d.js rename to assets/js/75ecccc2.f8d9a328.js index ce446096137..abf67b2e140 100644 --- a/assets/js/75ecccc2.9515e54d.js +++ b/assets/js/75ecccc2.f8d9a328.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9475],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),d=p(r),f=o,m=d["".concat(s,".").concat(f)]||d[f]||u[f]||a;return r?n.createElement(m,i(i({ref:t},l),{},{components:r})):n.createElement(m,i({ref:t},l))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=d;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:o,i[1]=c;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},i="kusion project",c={unversionedId:"reference/commands/kusion-project",id:"reference/commands/kusion-project",title:"kusion project",description:"Project is a folder that contains a project.yaml file and is linked to a Git repository",source:"@site/docs/kusion/6-reference/1-commands/kusion-project.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-project",permalink:"/docs/next/reference/commands/kusion-project",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-project.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion project create",permalink:"/docs/next/reference/commands/kusion-project-create"},next:{title:"kusion stack create",permalink:"/docs/next/reference/commands/kusion-stack-create"}},s={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-project"},"kusion project"),(0,o.kt)("p",null,"Project is a folder that contains a project.yaml file and is linked to a Git repository"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Project in Kusion is defined as any folder that contains a project.yaml file and is linked to a Git repository."),(0,o.kt)("p",null," Project organizes logical configurations for internal components to orchestrate the application and assembles them to suit different roles, such as developers and platform engineers."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion project [flags]\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for project\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-project-create"},"kusion project create"),"\t - Create a new project")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9475],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),d=p(r),f=o,m=d["".concat(s,".").concat(f)]||d[f]||u[f]||a;return r?n.createElement(m,i(i({ref:t},l),{},{components:r})):n.createElement(m,i({ref:t},l))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=d;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:o,i[1]=c;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},i="kusion project",c={unversionedId:"reference/commands/kusion-project",id:"reference/commands/kusion-project",title:"kusion project",description:"Project is a folder that contains a project.yaml file and is linked to a Git repository",source:"@site/docs/kusion/6-reference/1-commands/kusion-project.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-project",permalink:"/docs/next/reference/commands/kusion-project",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-project.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion project create",permalink:"/docs/next/reference/commands/kusion-project-create"},next:{title:"kusion stack create",permalink:"/docs/next/reference/commands/kusion-stack-create"}},s={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-project"},"kusion project"),(0,o.kt)("p",null,"Project is a folder that contains a project.yaml file and is linked to a Git repository"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Project in Kusion is defined as any folder that contains a project.yaml file and is linked to a Git repository."),(0,o.kt)("p",null," Project organizes logical configurations for internal components to orchestrate the application and assembles them to suit different roles, such as developers and platform engineers."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion project [flags]\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for project\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-project-create"},"kusion project create"),"\t - Create a new project")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/76129d61.0fbc5b39.js b/assets/js/76129d61.0fbc5b39.js deleted file mode 100644 index 2b1a6a1423e..00000000000 --- a/assets/js/76129d61.0fbc5b39.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5359],{3905:(e,a,t)=>{t.d(a,{Zo:()=>c,kt:()=>m});var n=t(67294);function r(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}function o(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);a&&(n=n.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,n)}return t}function i(e){for(var a=1;a=0||(r[t]=e[t]);return r}(e,a);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var l=n.createContext({}),u=function(e){var a=n.useContext(l),t=a;return e&&(t="function"==typeof e?e(a):i(i({},a),e)),t},c=function(e){var a=u(e.components);return n.createElement(l.Provider,{value:a},e.children)},p={inlineCode:"code",wrapper:function(e){var a=e.children;return n.createElement(n.Fragment,{},a)}},d=n.forwardRef((function(e,a){var t=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=u(t),m=r,h=d["".concat(l,".").concat(m)]||d[m]||p[m]||o;return t?n.createElement(h,i(i({ref:a},c),{},{components:t})):n.createElement(h,i({ref:a},c))}));function m(e,a){var t=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var o=t.length,i=new Array(o);i[0]=d;var s={};for(var l in a)hasOwnProperty.call(a,l)&&(s[l]=a[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var u=2;u{t.d(a,{Z:()=>i});var n=t(67294),r=t(86010);const o="tabItem_Ymn6";function i(e){let{children:a,hidden:t,className:i}=e;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(o,i),hidden:t},a)}},74866:(e,a,t)=>{t.d(a,{Z:()=>S});var n=t(87462),r=t(67294),o=t(86010),i=t(12466),s=t(76775),l=t(91980),u=t(67392),c=t(50012);function p(e){return function(e){var a;return(null==(a=r.Children.map(e,(e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:a}=e;return!!a&&"object"==typeof a&&"value"in a}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})))?void 0:a.filter(Boolean))??[]}(e).map((e=>{let{props:{value:a,label:t,attributes:n,default:r}}=e;return{value:a,label:t,attributes:n,default:r}}))}function d(e){const{values:a,children:t}=e;return(0,r.useMemo)((()=>{const e=a??p(t);return function(e){const a=(0,u.l)(e,((e,a)=>e.value===a.value));if(a.length>0)throw new Error(`Docusaurus error: Duplicate values "${a.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[a,t])}function m(e){let{value:a,tabValues:t}=e;return t.some((e=>e.value===a))}function h(e){let{queryString:a=!1,groupId:t}=e;const n=(0,s.k6)(),o=function(e){let{queryString:a=!1,groupId:t}=e;if("string"==typeof a)return a;if(!1===a)return null;if(!0===a&&!t)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:a,groupId:t});return[(0,l._X)(o),(0,r.useCallback)((e=>{if(!o)return;const a=new URLSearchParams(n.location.search);a.set(o,e),n.replace({...n.location,search:a.toString()})}),[o,n])]}function f(e){const{defaultValue:a,queryString:t=!1,groupId:n}=e,o=d(e),[i,s]=(0,r.useState)((()=>function(e){let{defaultValue:a,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the component requires at least one children component");if(a){if(!m({value:a,tabValues:t}))throw new Error(`Docusaurus error: The has a defaultValue "${a}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return a}const n=t.find((e=>e.default))??t[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:a,tabValues:o}))),[l,u]=h({queryString:t,groupId:n}),[p,f]=function(e){let{groupId:a}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(a),[n,o]=(0,c.Nk)(t);return[n,(0,r.useCallback)((e=>{t&&o.set(e)}),[t,o])]}({groupId:n}),g=(()=>{const e=l??p;return m({value:e,tabValues:o})?e:null})();(0,r.useLayoutEffect)((()=>{g&&s(g)}),[g]);return{selectedValue:i,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);s(e),u(e),f(e)}),[u,f,o]),tabValues:o}}var g=t(72389);const k="tabList__CuJ",b="tabItem_LNqP";function y(e){let{className:a,block:t,selectedValue:s,selectValue:l,tabValues:u}=e;const c=[],{blockElementScrollPositionUntilNextRender:p}=(0,i.o5)(),d=e=>{const a=e.currentTarget,t=c.indexOf(a),n=u[t].value;n!==s&&(p(a),l(n))},m=e=>{var a;let t=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const a=c.indexOf(e.currentTarget)+1;t=c[a]??c[0];break}case"ArrowLeft":{const a=c.indexOf(e.currentTarget)-1;t=c[a]??c[c.length-1];break}}null==(a=t)||a.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":t},a)},u.map((e=>{let{value:a,label:t,attributes:i}=e;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:s===a?0:-1,"aria-selected":s===a,key:a,ref:e=>c.push(e),onKeyDown:m,onClick:d},i,{className:(0,o.Z)("tabs__item",b,null==i?void 0:i.className,{"tabs__item--active":s===a})}),t??a)})))}function v(e){let{lazy:a,children:t,selectedValue:n}=e;const o=(Array.isArray(t)?t:[t]).filter(Boolean);if(a){const e=o.find((e=>e.props.value===n));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map(((e,a)=>(0,r.cloneElement)(e,{key:a,hidden:e.props.value!==n}))))}function w(e){const a=f(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",k)},r.createElement(y,(0,n.Z)({},e,a)),r.createElement(v,(0,n.Z)({},e,a)))}function S(e){const a=(0,g.Z)();return r.createElement(w,(0,n.Z)({key:String(a)},e))}},62761:(e,a,t)=>{t.r(a),t.d(a,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>s,metadata:()=>u,toc:()=>p});var n=t(87462),r=(t(67294),t(3905)),o=t(74866),i=t(85162);const s={id:"databse"},l="Managed Databases",u={unversionedId:"configuration-walkthrough/databse",id:"version-v0.10/configuration-walkthrough/databse",title:"Managed Databases",description:"The database attribute in the AppConfiguration instance is used to describe the specification for any databases needed for the application.",source:"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/6-database.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/databse",permalink:"/docs/v0.10/configuration-walkthrough/databse",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/6-database.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:6,frontMatter:{id:"databse"},sidebar:"kusion",previous:{title:"Application Networking",permalink:"/docs/v0.10/configuration-walkthrough/networking"},next:{title:"Secrets",permalink:"/docs/v0.10/configuration-walkthrough/secret"}},c={},p=[{value:"Import",id:"import",level:2},{value:"Types of Database offerings",id:"types-of-database-offerings",level:2},{value:"Cloud Credentials and Permissions",id:"cloud-credentials-and-permissions",level:2},{value:"Configure Database",id:"configure-database",level:2},{value:"Provision a Cloud Database",id:"provision-a-cloud-database",level:3},{value:"AWS RDS Instance",id:"aws-rds-instance",level:4},{value:"AliCloud RDS Instance",id:"alicloud-rds-instance",level:4},{value:"Local Database",id:"local-database",level:3},{value:"Database Credentials",id:"database-credentials",level:2},{value:"Configure Network Access",id:"configure-network-access",level:2},{value:"Subnet ID",id:"subnet-id",level:3},{value:"Private Routing",id:"private-routing",level:3}],d={toc:p};function m(e){let{components:a,...t}=e;return(0,r.kt)("wrapper",(0,n.Z)({},d,t,{components:a,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"managed-databases"},"Managed Databases"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"database")," attribute in the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance is used to describe the specification for any databases needed for the application."),(0,r.kt)("p",null,"You can currently have several databases with ",(0,r.kt)("strong",{parentName:"p"},"different database names")," for an application at the same time."),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"catalog")," package. For more details on KCL package import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"/docs/v0.10/configuration-walkthrough/overview#configuration-file-overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.accessories.mysql\nimport catalog.models.schema.v1.accessories.postgres\n")),(0,r.kt)("h2",{id:"types-of-database-offerings"},"Types of Database offerings"),(0,r.kt)("p",null,"As of version 0.10.0, Kusion supports the following database offerings on the cloud:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"MySQL and PostgreSQL Relational Database Service (RDS) on ",(0,r.kt)("a",{parentName:"li",href:"https://aws.amazon.com/rds/"},"AWS")),(0,r.kt)("li",{parentName:"ul"},"MySQL and PostgreSQL Relational Database Service (RDS) on ",(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/product/databases"},"AliCloud"))),(0,r.kt)("p",null,"More database types on more cloud vendors will be added in the future."),(0,r.kt)("p",null,"Alternatively, Kusion also supports creating a database at ",(0,r.kt)("inlineCode",{parentName:"p"},"localhost")," for local testing needs. A local database is quicker to stand up and easier to manage. It also eliminates the need for an account and any relevant costs with the cloud providers in the case that a local testing environment is sufficient."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"You do need a local Kubernetes cluster to run the local database workloads. You can refer to ",(0,r.kt)("a",{parentName:"p",href:"https://minikube.sigs.k8s.io/docs/start/"},"Minikube")," or ",(0,r.kt)("a",{parentName:"p",href:"https://kind.sigs.k8s.io/docs/user/quick-start/"},"Kind")," to get started.\nTo see an end-to-end use case for standing up a local testing environment including a local database, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"/docs/v0.10/getting-started/deliver-wordpress"},"Kusion Quickstart"),".")),(0,r.kt)("h2",{id:"cloud-credentials-and-permissions"},"Cloud Credentials and Permissions"),(0,r.kt)("p",null,"Kusion provisions databases on the cloud via ",(0,r.kt)("a",{parentName:"p",href:"https://www.terraform.io/"},"terraform")," providers. For it to create ",(0,r.kt)("em",{parentName:"p"},"any")," cloud resources, it requires a set of credentials that belongs to an account that has the appropriate write access so the terraform provider can be initialized properly."),(0,r.kt)("p",null,"For AWS, the environment variables needed:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'export AWS_ACCESS_KEY_ID="xxxxxxxxxxx" # replace it with your AccessKey\nexport AWS_SECRET_ACCESS_KEY="xxxxxxx" # replace it with your SecretKey\n')),(0,r.kt)("p",null,"For AliCloud, the environment variables needed:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'export ALICLOUD_ACCESS_KEY="xxxxxxxxx" # replace it with your AccessKey\nexport ALICLOUD_SECRET_KEY="xxxxxxxxx" # replace it with your SecretKey\n')),(0,r.kt)("p",null,"The user account that owns these credentials would need to have the proper permission policies attached to create databases and security groups. If you are using the cloud-managed policies, the policies needed to provision a database and configure firewall rules are listed below."),(0,r.kt)("p",null,"For AWS:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AmazonVPCFullAccess")," for creating and managing database firewall rules via security group"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AmazonRDSFullAccess")," for creating and managing RDS instances")),(0,r.kt)("p",null,"For AliCloud:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AliyunVPCFullAccess")," for creating and managing database firewall rules via security group"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AliyunRDSFullAccess")," for creating and managing RDS instances")),(0,r.kt)("p",null,"Alternatively, you can use customer managed policies if the cloud provider built-in policies don't meet your needs. The list of permissions needed are in the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonRDSFullAccess.html#AmazonRDSFullAccess-json"},"AmazonRDSFullAccess Policy Document")," and ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonVPCFullAccess.html"},"AmazonVPCFullAccess Policy Document"),". It will most likely be a subset of the permissions in the policy documents."),(0,r.kt)("h2",{id:"configure-database"},"Configure Database"),(0,r.kt)("h3",{id:"provision-a-cloud-database"},"Provision a Cloud Database"),(0,r.kt)("p",null,"Assuming the steps in the ",(0,r.kt)("a",{parentName:"p",href:"#cloud-credentials-and-permissions"},"Cloud Credentials and Permissions")," section is setup properly, you can now provision cloud databases via Kusion."),(0,r.kt)("h4",{id:"aws-rds-instance"},"AWS RDS Instance"),(0,r.kt)("p",null,"To provision an AWS RDS instance with MySQL v8.0 or PostgreSQL v14.0, you can append the following YAML file to your own workspace configurations and update the corresponding workspace with command ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace update"),". "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n aws: \n version: 5.0.1\n source: hashicorp/aws\n region: us-east-1 # Please replace with your own aws provider region\n\n# MySQL configurations for AWS RDS\nmodules: \n mysql: \n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n securityIPs: \n - 0.0.0.0/0\n suffix: "-mysql"\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n aws: \n version: 5.0.1\n source: hashicorp/aws\n region: us-east-1 # Please replace with your own aws provider region\n\n# PostgreSQL configurations for AWS RDS\nmodules: \n postgres: \n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n securityIPs: \n - 0.0.0.0/0\n suffix: "-postgres"\n')))),(0,r.kt)("p",null,"For KCL configuration file declarations: "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'wordpress: ac.AppConfiguration {\n # ...\n database: {\n wordpress: mysql.MySQL {\n type: "cloud"\n version: "8.0"\n }\n }\n}\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'pgadmin: ac.AppConfiguration {\n # ...\n database: {\n pgadmin: postgres.PostgreSQL {\n type: "cloud"\n version: "14.0"\n }\n }\n}\n')))),(0,r.kt)("p",null,"It's highly recommended to replace ",(0,r.kt)("inlineCode",{parentName:"p"},"0.0.0.0/0")," and closely manage the whitelist of IPs that can access the database for security purposes. The ",(0,r.kt)("inlineCode",{parentName:"p"},"0.0.0.0/0")," in the example above or if ",(0,r.kt)("inlineCode",{parentName:"p"},"securityIPs")," is omitted altogether will allow connections from anywhere which would typically be a security bad practice."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"instanceType")," field determines the computation and memory capacity of the RDS instance. The ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.micro")," instance type in the example above represents the ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3")," instance class with a size of ",(0,r.kt)("inlineCode",{parentName:"p"},"micro"),". In the same ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3")," instance family there are also ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.small"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.medium"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.2xlarge"),", etc."),(0,r.kt)("p",null,"The full list of supported ",(0,r.kt)("inlineCode",{parentName:"p"},"instanceType")," values can be found ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html#Concepts.DBInstanceClass.Support"},"here"),"."),(0,r.kt)("p",null,"You can also adjust the storage capacity for the database instance by changing the ",(0,r.kt)("inlineCode",{parentName:"p"},"size")," field which is storage size measured in gigabytes. The minimum is 20. More details can be found ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#Concepts.Storage.GeneralSSD"},"here"),"."),(0,r.kt)("h4",{id:"alicloud-rds-instance"},"AliCloud RDS Instance"),(0,r.kt)("p",null,"To provision an Alicloud RDS instance with MySQL or PostgreSQL, you can append the following YAML file to your own workspace configurations and update the corresponding workspace with command ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace update"),". Note that AliCloud RDS has several additional fields such as ",(0,r.kt)("inlineCode",{parentName:"p"},"category"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting"),":"),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n alicloud:\n version: 1.209.1\n source: aliyun/alicloud\n region: cn-beijing # Please replace with your own alicloud provider region\n\n# MySQL configurations for Alicloud RDS\nmodules: \n mysql: \n default: \n cloud: alicloud\n size: 20\n instanceType: mysql.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n securityIPs: \n - 0.0.0.0/0\n suffix: "-mysql"\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n alicloud:\n version: 1.209.1\n source: aliyun/alicloud\n region: cn-beijing # Please replace with your own alicloud provider region\n\n# PostgreSQL configurations for Alicloud RDS\nmodules: \n postgres:\n default:\n cloud: alicloud\n size: 20\n instanceType: pg.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n securityIPs: \n - 0.0.0.0/0\n suffix: "-postgres"\n')))),(0,r.kt)("p",null,"For KCL configuration file declarations: "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'wordpress: ac.AppConfiguration {\n # ...\n database: {\n wordpress: mysql.MySQL {\n type: "cloud"\n version: "8.0"\n }\n }\n}\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'pgadmin: ac.AppConfiguration {\n # ...\n database: {\n pgadmin: postgres.PostgreSQL {\n type: "cloud"\n version: "14.0"\n }\n }\n}\n')))),(0,r.kt)("p",null,"We will walkthrough ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting")," in the ",(0,r.kt)("a",{parentName:"p",href:"#configure-network-access"},"Configure Network Access")," section."),(0,r.kt)("p",null,"The full list of supported ",(0,r.kt)("inlineCode",{parentName:"p"},"instanceType")," values can be found in:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/apsaradb-rds-for-mysql/primary-apsaradb-rds-for-mysql-instance-types#concept-2096487"},"MySQL instance types(x86)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/apsaradb-rds-for-postgresql/primary-apsaradb-rds-for-postgresql-instance-types#concept-2096578"},"PostgreSQL instance types"))),(0,r.kt)("h3",{id:"local-database"},"Local Database"),(0,r.kt)("p",null,"To deploy a local database with MySQL v8.0 or PostgreSQL v14.0:"),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'wordpress: ac.AppConfiguration {\n # ...\n database: {\n wordpress: mysql.MySQL {\n type: "local"\n version: "8.0"\n }\n }\n}\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'pgadmin: ac.AppConfiguration {\n # ...\n database: {\n pgadmin: postgres.PostgreSQL {\n type: "local"\n version: "14.0"\n }\n }\n}\n')))),(0,r.kt)("h2",{id:"database-credentials"},"Database Credentials"),(0,r.kt)("p",null,"There is no need to manage the database credentials manually. Kusion will automatically generate a random password, set it as the credential when creating the database, and then inject the hostname, username and password into the application runtime."),(0,r.kt)("p",null,"You have the option to BYO (Bring Your Own) username for the database credential by specifying the ",(0,r.kt)("inlineCode",{parentName:"p"},"username")," attribute in the ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n mysql:\n default:\n # ...\n username: "my_username"\n')),(0,r.kt)("p",null,"You ",(0,r.kt)("strong",{parentName:"p"},"cannot")," bring your own password. The password will always be managed by Kusion automatically."),(0,r.kt)("p",null,"The database credentials are injected into the environment variables of the application container. You can access them via the following env vars:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"# env | grep KUSION_DB\nKUSION_DB_HOST_WORDPRESS_MYSQL=wordpress.xxxxxxxx.us-east-1.rds.amazonaws.com\nKUSION_DB_USERNAME_WORDPRESS_MYSQL=xxxxxxxxx\nKUSION_DB_PASSWORD_WORDPRESS_MYSQL=xxxxxxxxx\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about the environment of database credentials injected by Kusion can be found at ",(0,r.kt)("a",{parentName:"p",href:"/docs/v0.10/reference/modules/catalog-models/database/mysql#credentials-and-connectivity"},"mysql credentials and connectivity")," and ",(0,r.kt)("a",{parentName:"p",href:"/docs/v0.10/reference/modules/catalog-models/database/postgres#credentials-and-connectivity"},"postgres credentials and connectivity"))),(0,r.kt)("p",null,"You can use these environment variables out of the box. Or most likely, your application might retrieve the connection details from a different set of environment variables. In that case, you can map the kusion environment variables to the ones expected by your application using the ",(0,r.kt)("inlineCode",{parentName:"p"},"$()")," expression. "),(0,r.kt)("p",null,"This example below will assign the value of ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_HOST_WORDPRESS_MYSQL")," into ",(0,r.kt)("inlineCode",{parentName:"p"},"WORDPRESS_DB_HOST"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_USERNAME_WORDPRESS_MYSQL")," into ",(0,r.kt)("inlineCode",{parentName:"p"},"WORDPRESS_DB_USER"),", likewise for ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_PASSWORD_WORDPRESS_MYSQL")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"WORDPRESS_DB_PASSWORD"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'wordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n wordpress: c.Container {\n image = "wordpress:6.3-apache"\n env: {\n "WORDPRESS_DB_HOST": "$(KUSION_DB_HOST_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD_WORDPRESS_MYSQL)"\n }\n # ...\n }\n }\n # ...\n }\n database: {\n # ...\n }\n}\n')),(0,r.kt)("h2",{id:"configure-network-access"},"Configure Network Access"),(0,r.kt)("p",null,"You can also optionally configure the network access to the database as part of the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),". This is highly recommended because it dramatically increases the security posture of your cloud environment in the means of least privilege principle."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"securityIPs")," field in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Database")," schema declares the list of network addresses that are allowed to access the database. The network addresses are in the ",(0,r.kt)("a",{parentName:"p",href:"https://aws.amazon.com/what-is/cidr/"},"CIDR notation")," and can be either a private IP range (",(0,r.kt)("a",{parentName:"p",href:"https://datatracker.ietf.org/doc/html/rfc1918"},"RFC-1918")," and ",(0,r.kt)("a",{parentName:"p",href:"https://datatracker.ietf.org/doc/html/rfc6598"},"RFC-6598")," address) or a public one."),(0,r.kt)("p",null,"If the database need to be accessed from a public location (which should most likely not be the case in a production environment), ",(0,r.kt)("inlineCode",{parentName:"p"},"securityIPs")," need to include the public IP address of the traffic source (For instance, if the RDS database needs to be accessed from your computer)."),(0,r.kt)("p",null,"To configure AWS RDS to restrict network access from a VPC with a CIDR of ",(0,r.kt)("inlineCode",{parentName:"p"},"10.0.1.0/24")," and a public IP of ",(0,r.kt)("inlineCode",{parentName:"p"},"103.192.227.125"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'modules: \n mysql: \n default: \n cloud: aws\n # ...\n securityIPs: \n - "10.0.1.0/24"\n - "103.192.227.125/32"\n')),(0,r.kt)("p",null,"Depending on the cloud provider, the default behavior of the database firewall settings may differ if omitted."),(0,r.kt)("h3",{id:"subnet-id"},"Subnet ID"),(0,r.kt)("p",null,"On AWS, you have the option to launch the RDS instance inside a specific VPC if a ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," is present in the application configuration. By default, if ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," is not provided, the RDS will be created in the default VPC for that account. However, the recommendation is to self-manage your VPCs to provider better isolation from a network security perspective."),(0,r.kt)("p",null,"On AliCloud, the ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," is required. The concept of subnet maps to VSwitch in AliCloud."),(0,r.kt)("p",null,"To place the RDS instance into a specific VPC on Alicloud:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'modules: \n mysql: \n default: \n cloud: alicloud\n # ...\n subnetID: "subnet-xxxxxxxxxxxxxxxx"\n')),(0,r.kt)("h3",{id:"private-routing"},"Private Routing"),(0,r.kt)("p",null,"There is an option to enforce private routing on certain cloud providers if both the workload and the database are running on the cloud."),(0,r.kt)("p",null,"On AliCloud, you can set the ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting")," flag to ",(0,r.kt)("inlineCode",{parentName:"p"},"True"),". The database host generated will be a private FQDN that is only resolvable and accessible from within the AliCloud VPCs. Setting ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting")," flag to ",(0,r.kt)("inlineCode",{parentName:"p"},"True")," when ",(0,r.kt)("inlineCode",{parentName:"p"},"type")," is ",(0,r.kt)("inlineCode",{parentName:"p"},"aws")," is a no-op."),(0,r.kt)("p",null,"To enforce private routing on AliCloud:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules: \n mysql: \n default: \n cloud: alicloud\n # ...\n privateRouting: true\n")),(0,r.kt)("p",null,"Kusion will then generate a private FQDN and inject it into the application runtime as the environment variable ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_HOST_")," for the application to use. A complete list of Kusion-managed environment variables for mysql database can be found ",(0,r.kt)("a",{parentName:"p",href:"/docs/v0.10/reference/modules/catalog-models/database/mysql#credentials-and-connectivity"},"here"),"."),(0,r.kt)("p",null,"Otherwise when using the public FQDN to connect to a database from the workload, the route will depend on cloud provider's routing preference. The options are generally either:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Travel as far as possible on the cloud provider's global backbone network, or also referred to as cold potato routing, or"),(0,r.kt)("li",{parentName:"ul"},"Egress as early as possible to the public Internet and re-enter the cloud provider's datacenter later, or also referred to as hot potato routing")),(0,r.kt)("p",null,"The prior generally has better performance but is also more expensive."),(0,r.kt)("p",null,"You can find a good read on the ",(0,r.kt)("a",{parentName:"p",href:"https://aws.amazon.com/blogs/architecture/internet-routing-and-traffic-engineering/"},"AWS Blog")," or the ",(0,r.kt)("a",{parentName:"p",href:"https://learn.microsoft.com/en-us/azure/virtual-network/ip-services/routing-preference-overview"},"Microsoft Learn"),"."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/76129d61.55da8d5b.js b/assets/js/76129d61.55da8d5b.js new file mode 100644 index 00000000000..3b1a369c8bf --- /dev/null +++ b/assets/js/76129d61.55da8d5b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5359],{3905:(e,a,t)=>{t.d(a,{Zo:()=>c,kt:()=>m});var n=t(67294);function r(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}function o(e,a){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);a&&(n=n.filter((function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable}))),t.push.apply(t,n)}return t}function i(e){for(var a=1;a=0||(r[t]=e[t]);return r}(e,a);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var l=n.createContext({}),u=function(e){var a=n.useContext(l),t=a;return e&&(t="function"==typeof e?e(a):i(i({},a),e)),t},c=function(e){var a=u(e.components);return n.createElement(l.Provider,{value:a},e.children)},p={inlineCode:"code",wrapper:function(e){var a=e.children;return n.createElement(n.Fragment,{},a)}},d=n.forwardRef((function(e,a){var t=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=u(t),m=r,h=d["".concat(l,".").concat(m)]||d[m]||p[m]||o;return t?n.createElement(h,i(i({ref:a},c),{},{components:t})):n.createElement(h,i({ref:a},c))}));function m(e,a){var t=arguments,r=a&&a.mdxType;if("string"==typeof e||r){var o=t.length,i=new Array(o);i[0]=d;var s={};for(var l in a)hasOwnProperty.call(a,l)&&(s[l]=a[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var u=2;u{t.d(a,{Z:()=>i});var n=t(67294),r=t(86010);const o="tabItem_Ymn6";function i(e){let{children:a,hidden:t,className:i}=e;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(o,i),hidden:t},a)}},74866:(e,a,t)=>{t.d(a,{Z:()=>S});var n=t(87462),r=t(67294),o=t(86010),i=t(12466),s=t(76775),l=t(91980),u=t(67392),c=t(50012);function p(e){return function(e){var a;return(null==(a=r.Children.map(e,(e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:a}=e;return!!a&&"object"==typeof a&&"value"in a}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})))?void 0:a.filter(Boolean))??[]}(e).map((e=>{let{props:{value:a,label:t,attributes:n,default:r}}=e;return{value:a,label:t,attributes:n,default:r}}))}function d(e){const{values:a,children:t}=e;return(0,r.useMemo)((()=>{const e=a??p(t);return function(e){const a=(0,u.l)(e,((e,a)=>e.value===a.value));if(a.length>0)throw new Error(`Docusaurus error: Duplicate values "${a.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[a,t])}function m(e){let{value:a,tabValues:t}=e;return t.some((e=>e.value===a))}function h(e){let{queryString:a=!1,groupId:t}=e;const n=(0,s.k6)(),o=function(e){let{queryString:a=!1,groupId:t}=e;if("string"==typeof a)return a;if(!1===a)return null;if(!0===a&&!t)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return t??null}({queryString:a,groupId:t});return[(0,l._X)(o),(0,r.useCallback)((e=>{if(!o)return;const a=new URLSearchParams(n.location.search);a.set(o,e),n.replace({...n.location,search:a.toString()})}),[o,n])]}function f(e){const{defaultValue:a,queryString:t=!1,groupId:n}=e,o=d(e),[i,s]=(0,r.useState)((()=>function(e){let{defaultValue:a,tabValues:t}=e;if(0===t.length)throw new Error("Docusaurus error: the component requires at least one children component");if(a){if(!m({value:a,tabValues:t}))throw new Error(`Docusaurus error: The has a defaultValue "${a}" but none of its children has the corresponding value. Available values are: ${t.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return a}const n=t.find((e=>e.default))??t[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:a,tabValues:o}))),[l,u]=h({queryString:t,groupId:n}),[p,f]=function(e){let{groupId:a}=e;const t=function(e){return e?`docusaurus.tab.${e}`:null}(a),[n,o]=(0,c.Nk)(t);return[n,(0,r.useCallback)((e=>{t&&o.set(e)}),[t,o])]}({groupId:n}),g=(()=>{const e=l??p;return m({value:e,tabValues:o})?e:null})();(0,r.useLayoutEffect)((()=>{g&&s(g)}),[g]);return{selectedValue:i,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);s(e),u(e),f(e)}),[u,f,o]),tabValues:o}}var g=t(72389);const k="tabList__CuJ",b="tabItem_LNqP";function y(e){let{className:a,block:t,selectedValue:s,selectValue:l,tabValues:u}=e;const c=[],{blockElementScrollPositionUntilNextRender:p}=(0,i.o5)(),d=e=>{const a=e.currentTarget,t=c.indexOf(a),n=u[t].value;n!==s&&(p(a),l(n))},m=e=>{var a;let t=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const a=c.indexOf(e.currentTarget)+1;t=c[a]??c[0];break}case"ArrowLeft":{const a=c.indexOf(e.currentTarget)-1;t=c[a]??c[c.length-1];break}}null==(a=t)||a.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":t},a)},u.map((e=>{let{value:a,label:t,attributes:i}=e;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:s===a?0:-1,"aria-selected":s===a,key:a,ref:e=>c.push(e),onKeyDown:m,onClick:d},i,{className:(0,o.Z)("tabs__item",b,null==i?void 0:i.className,{"tabs__item--active":s===a})}),t??a)})))}function v(e){let{lazy:a,children:t,selectedValue:n}=e;const o=(Array.isArray(t)?t:[t]).filter(Boolean);if(a){const e=o.find((e=>e.props.value===n));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map(((e,a)=>(0,r.cloneElement)(e,{key:a,hidden:e.props.value!==n}))))}function w(e){const a=f(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",k)},r.createElement(y,(0,n.Z)({},e,a)),r.createElement(v,(0,n.Z)({},e,a)))}function S(e){const a=(0,g.Z)();return r.createElement(w,(0,n.Z)({key:String(a)},e))}},62761:(e,a,t)=>{t.r(a),t.d(a,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>s,metadata:()=>u,toc:()=>p});var n=t(87462),r=(t(67294),t(3905)),o=t(74866),i=t(85162);const s={id:"databse"},l="Managed Databases",u={unversionedId:"configuration-walkthrough/databse",id:"version-v0.10/configuration-walkthrough/databse",title:"Managed Databases",description:"The database attribute in the AppConfiguration instance is used to describe the specification for any databases needed for the application.",source:"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/6-database.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/databse",permalink:"/docs/v0.10/configuration-walkthrough/databse",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/6-database.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:6,frontMatter:{id:"databse"},sidebar:"kusion",previous:{title:"Application Networking",permalink:"/docs/v0.10/configuration-walkthrough/networking"},next:{title:"Secrets",permalink:"/docs/v0.10/configuration-walkthrough/secret"}},c={},p=[{value:"Import",id:"import",level:2},{value:"Types of Database offerings",id:"types-of-database-offerings",level:2},{value:"Cloud Credentials and Permissions",id:"cloud-credentials-and-permissions",level:2},{value:"Configure Database",id:"configure-database",level:2},{value:"Provision a Cloud Database",id:"provision-a-cloud-database",level:3},{value:"AWS RDS Instance",id:"aws-rds-instance",level:4},{value:"AliCloud RDS Instance",id:"alicloud-rds-instance",level:4},{value:"Local Database",id:"local-database",level:3},{value:"Database Credentials",id:"database-credentials",level:2},{value:"Configure Network Access",id:"configure-network-access",level:2},{value:"Subnet ID",id:"subnet-id",level:3},{value:"Private Routing",id:"private-routing",level:3}],d={toc:p};function m(e){let{components:a,...t}=e;return(0,r.kt)("wrapper",(0,n.Z)({},d,t,{components:a,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"managed-databases"},"Managed Databases"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"database")," attribute in the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance is used to describe the specification for any databases needed for the application."),(0,r.kt)("p",null,"You can currently have several databases with ",(0,r.kt)("strong",{parentName:"p"},"different database names")," for an application at the same time."),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"catalog")," package. For more details on KCL package import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"/docs/v0.10/configuration-walkthrough/overview#configuration-file-overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.accessories.mysql\nimport catalog.models.schema.v1.accessories.postgres\n")),(0,r.kt)("h2",{id:"types-of-database-offerings"},"Types of Database offerings"),(0,r.kt)("p",null,"As of version 0.10.0, Kusion supports the following database offerings on the cloud:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"MySQL and PostgreSQL Relational Database Service (RDS) on ",(0,r.kt)("a",{parentName:"li",href:"https://aws.amazon.com/rds/"},"AWS")),(0,r.kt)("li",{parentName:"ul"},"MySQL and PostgreSQL Relational Database Service (RDS) on ",(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/product/databases"},"AliCloud"))),(0,r.kt)("p",null,"More database types on more cloud vendors will be added in the future."),(0,r.kt)("p",null,"Alternatively, Kusion also supports creating a database at ",(0,r.kt)("inlineCode",{parentName:"p"},"localhost")," for local testing needs. A local database is quicker to stand up and easier to manage. It also eliminates the need for an account and any relevant costs with the cloud providers in the case that a local testing environment is sufficient."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"You do need a local Kubernetes cluster to run the local database workloads. You can refer to ",(0,r.kt)("a",{parentName:"p",href:"https://minikube.sigs.k8s.io/docs/start/"},"Minikube")," or ",(0,r.kt)("a",{parentName:"p",href:"https://kind.sigs.k8s.io/docs/user/quick-start/"},"Kind")," to get started.\nTo see an end-to-end use case for standing up a local testing environment including a local database, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"/docs/v0.10/getting-started/deliver-wordpress"},"Kusion Quickstart"),".")),(0,r.kt)("h2",{id:"cloud-credentials-and-permissions"},"Cloud Credentials and Permissions"),(0,r.kt)("p",null,"Kusion provisions databases on the cloud via ",(0,r.kt)("a",{parentName:"p",href:"https://www.terraform.io/"},"terraform")," providers. For it to create ",(0,r.kt)("em",{parentName:"p"},"any")," cloud resources, it requires a set of credentials that belongs to an account that has the appropriate write access so the terraform provider can be initialized properly."),(0,r.kt)("p",null,"For AWS, the environment variables needed:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'export AWS_ACCESS_KEY_ID="xxxxxxxxxxx" # replace it with your AccessKey\nexport AWS_SECRET_ACCESS_KEY="xxxxxxx" # replace it with your SecretKey\n')),(0,r.kt)("p",null,"For AliCloud, the environment variables needed:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'export ALICLOUD_ACCESS_KEY="xxxxxxxxx" # replace it with your AccessKey\nexport ALICLOUD_SECRET_KEY="xxxxxxxxx" # replace it with your SecretKey\n')),(0,r.kt)("p",null,"The user account that owns these credentials would need to have the proper permission policies attached to create databases and security groups. If you are using the cloud-managed policies, the policies needed to provision a database and configure firewall rules are listed below."),(0,r.kt)("p",null,"For AWS:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AmazonVPCFullAccess")," for creating and managing database firewall rules via security group"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AmazonRDSFullAccess")," for creating and managing RDS instances")),(0,r.kt)("p",null,"For AliCloud:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AliyunVPCFullAccess")," for creating and managing database firewall rules via security group"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AliyunRDSFullAccess")," for creating and managing RDS instances")),(0,r.kt)("p",null,"Alternatively, you can use customer managed policies if the cloud provider built-in policies don't meet your needs. The list of permissions needed are in the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonRDSFullAccess.html#AmazonRDSFullAccess-json"},"AmazonRDSFullAccess Policy Document")," and ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonVPCFullAccess.html"},"AmazonVPCFullAccess Policy Document"),". It will most likely be a subset of the permissions in the policy documents."),(0,r.kt)("h2",{id:"configure-database"},"Configure Database"),(0,r.kt)("h3",{id:"provision-a-cloud-database"},"Provision a Cloud Database"),(0,r.kt)("p",null,"Assuming the steps in the ",(0,r.kt)("a",{parentName:"p",href:"#cloud-credentials-and-permissions"},"Cloud Credentials and Permissions")," section is setup properly, you can now provision cloud databases via Kusion."),(0,r.kt)("h4",{id:"aws-rds-instance"},"AWS RDS Instance"),(0,r.kt)("p",null,"To provision an AWS RDS instance with MySQL v8.0 or PostgreSQL v14.0, you can append the following YAML file to your own workspace configurations and update the corresponding workspace with command ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace update"),". "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n aws: \n version: 5.0.1\n source: hashicorp/aws\n region: us-east-1 # Please replace with your own aws provider region\n\n# MySQL configurations for AWS RDS\nmodules: \n mysql: \n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n securityIPs: \n - 0.0.0.0/0\n suffix: "-mysql"\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n aws: \n version: 5.0.1\n source: hashicorp/aws\n region: us-east-1 # Please replace with your own aws provider region\n\n# PostgreSQL configurations for AWS RDS\nmodules: \n postgres: \n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n securityIPs: \n - 0.0.0.0/0\n suffix: "-postgres"\n')))),(0,r.kt)("p",null,"For KCL configuration file declarations: "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'wordpress: ac.AppConfiguration {\n # ...\n database: {\n wordpress: mysql.MySQL {\n type: "cloud"\n version: "8.0"\n }\n }\n}\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'pgadmin: ac.AppConfiguration {\n # ...\n database: {\n pgadmin: postgres.PostgreSQL {\n type: "cloud"\n version: "14.0"\n }\n }\n}\n')))),(0,r.kt)("p",null,"It's highly recommended to replace ",(0,r.kt)("inlineCode",{parentName:"p"},"0.0.0.0/0")," and closely manage the whitelist of IPs that can access the database for security purposes. The ",(0,r.kt)("inlineCode",{parentName:"p"},"0.0.0.0/0")," in the example above or if ",(0,r.kt)("inlineCode",{parentName:"p"},"securityIPs")," is omitted altogether will allow connections from anywhere which would typically be a security bad practice."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"instanceType")," field determines the computation and memory capacity of the RDS instance. The ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.micro")," instance type in the example above represents the ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3")," instance class with a size of ",(0,r.kt)("inlineCode",{parentName:"p"},"micro"),". In the same ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3")," instance family there are also ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.small"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.medium"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.2xlarge"),", etc."),(0,r.kt)("p",null,"The full list of supported ",(0,r.kt)("inlineCode",{parentName:"p"},"instanceType")," values can be found ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html#Concepts.DBInstanceClass.Support"},"here"),"."),(0,r.kt)("p",null,"You can also adjust the storage capacity for the database instance by changing the ",(0,r.kt)("inlineCode",{parentName:"p"},"size")," field which is storage size measured in gigabytes. The minimum is 20. More details can be found ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#Concepts.Storage.GeneralSSD"},"here"),"."),(0,r.kt)("h4",{id:"alicloud-rds-instance"},"AliCloud RDS Instance"),(0,r.kt)("p",null,"To provision an Alicloud RDS instance with MySQL or PostgreSQL, you can append the following YAML file to your own workspace configurations and update the corresponding workspace with command ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace update"),". Note that AliCloud RDS has several additional fields such as ",(0,r.kt)("inlineCode",{parentName:"p"},"category"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting"),":"),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n alicloud:\n version: 1.209.1\n source: aliyun/alicloud\n region: cn-beijing # Please replace with your own alicloud provider region\n\n# MySQL configurations for Alicloud RDS\nmodules: \n mysql: \n default: \n cloud: alicloud\n size: 20\n instanceType: mysql.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n securityIPs: \n - 0.0.0.0/0\n suffix: "-mysql"\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n alicloud:\n version: 1.209.1\n source: aliyun/alicloud\n region: cn-beijing # Please replace with your own alicloud provider region\n\n# PostgreSQL configurations for Alicloud RDS\nmodules: \n postgres:\n default:\n cloud: alicloud\n size: 20\n instanceType: pg.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n securityIPs: \n - 0.0.0.0/0\n suffix: "-postgres"\n')))),(0,r.kt)("p",null,"For KCL configuration file declarations: "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'wordpress: ac.AppConfiguration {\n # ...\n database: {\n wordpress: mysql.MySQL {\n type: "cloud"\n version: "8.0"\n }\n }\n}\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'pgadmin: ac.AppConfiguration {\n # ...\n database: {\n pgadmin: postgres.PostgreSQL {\n type: "cloud"\n version: "14.0"\n }\n }\n}\n')))),(0,r.kt)("p",null,"We will walkthrough ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting")," in the ",(0,r.kt)("a",{parentName:"p",href:"#configure-network-access"},"Configure Network Access")," section."),(0,r.kt)("p",null,"The full list of supported ",(0,r.kt)("inlineCode",{parentName:"p"},"instanceType")," values can be found in:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/apsaradb-rds-for-mysql/primary-apsaradb-rds-for-mysql-instance-types#concept-2096487"},"MySQL instance types(x86)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/apsaradb-rds-for-postgresql/primary-apsaradb-rds-for-postgresql-instance-types#concept-2096578"},"PostgreSQL instance types"))),(0,r.kt)("h3",{id:"local-database"},"Local Database"),(0,r.kt)("p",null,"To deploy a local database with MySQL v8.0 or PostgreSQL v14.0:"),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'wordpress: ac.AppConfiguration {\n # ...\n database: {\n wordpress: mysql.MySQL {\n type: "local"\n version: "8.0"\n }\n }\n}\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'pgadmin: ac.AppConfiguration {\n # ...\n database: {\n pgadmin: postgres.PostgreSQL {\n type: "local"\n version: "14.0"\n }\n }\n}\n')))),(0,r.kt)("h2",{id:"database-credentials"},"Database Credentials"),(0,r.kt)("p",null,"There is no need to manage the database credentials manually. Kusion will automatically generate a random password, set it as the credential when creating the database, and then inject the hostname, username and password into the application runtime."),(0,r.kt)("p",null,"You have the option to BYO (Bring Your Own) username for the database credential by specifying the ",(0,r.kt)("inlineCode",{parentName:"p"},"username")," attribute in the ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n mysql:\n default:\n # ...\n username: "my_username"\n')),(0,r.kt)("p",null,"You ",(0,r.kt)("strong",{parentName:"p"},"cannot")," bring your own password. The password will always be managed by Kusion automatically."),(0,r.kt)("p",null,"The database credentials are injected into the environment variables of the application container. You can access them via the following env vars:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"# env | grep KUSION_DB\nKUSION_DB_HOST_WORDPRESS_MYSQL=wordpress.xxxxxxxx.us-east-1.rds.amazonaws.com\nKUSION_DB_USERNAME_WORDPRESS_MYSQL=xxxxxxxxx\nKUSION_DB_PASSWORD_WORDPRESS_MYSQL=xxxxxxxxx\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about the environment of database credentials injected by Kusion can be found at ",(0,r.kt)("a",{parentName:"p",href:"/docs/v0.10/reference/modules/catalog-models/database/mysql#credentials-and-connectivity"},"mysql credentials and connectivity")," and ",(0,r.kt)("a",{parentName:"p",href:"/docs/v0.10/reference/modules/catalog-models/database/postgres#credentials-and-connectivity"},"postgres credentials and connectivity"))),(0,r.kt)("p",null,"You can use these environment variables out of the box. Or most likely, your application might retrieve the connection details from a different set of environment variables. In that case, you can map the kusion environment variables to the ones expected by your application using the ",(0,r.kt)("inlineCode",{parentName:"p"},"$()")," expression. "),(0,r.kt)("p",null,"This example below will assign the value of ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_HOST_WORDPRESS_MYSQL")," into ",(0,r.kt)("inlineCode",{parentName:"p"},"WORDPRESS_DB_HOST"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_USERNAME_WORDPRESS_MYSQL")," into ",(0,r.kt)("inlineCode",{parentName:"p"},"WORDPRESS_DB_USER"),", likewise for ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_PASSWORD_WORDPRESS_MYSQL")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"WORDPRESS_DB_PASSWORD"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'wordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n wordpress: c.Container {\n image = "wordpress:6.3-apache"\n env: {\n "WORDPRESS_DB_HOST": "$(KUSION_DB_HOST_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD_WORDPRESS_MYSQL)"\n }\n # ...\n }\n }\n # ...\n }\n database: {\n # ...\n }\n}\n')),(0,r.kt)("h2",{id:"configure-network-access"},"Configure Network Access"),(0,r.kt)("p",null,"You can also optionally configure the network access to the database as part of the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),". This is highly recommended because it dramatically increases the security posture of your cloud environment in the means of least privilege principle."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"securityIPs")," field in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Database")," schema declares the list of network addresses that are allowed to access the database. The network addresses are in the ",(0,r.kt)("a",{parentName:"p",href:"https://aws.amazon.com/what-is/cidr/"},"CIDR notation")," and can be either a private IP range (",(0,r.kt)("a",{parentName:"p",href:"https://datatracker.ietf.org/doc/html/rfc1918"},"RFC-1918")," and ",(0,r.kt)("a",{parentName:"p",href:"https://datatracker.ietf.org/doc/html/rfc6598"},"RFC-6598")," address) or a public one."),(0,r.kt)("p",null,"If the database need to be accessed from a public location (which should most likely not be the case in a production environment), ",(0,r.kt)("inlineCode",{parentName:"p"},"securityIPs")," need to include the public IP address of the traffic source (For instance, if the RDS database needs to be accessed from your computer)."),(0,r.kt)("p",null,"To configure AWS RDS to restrict network access from a VPC with a CIDR of ",(0,r.kt)("inlineCode",{parentName:"p"},"10.0.1.0/24")," and a public IP of ",(0,r.kt)("inlineCode",{parentName:"p"},"103.192.227.125"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'modules: \n mysql: \n default: \n cloud: aws\n # ...\n securityIPs: \n - "10.0.1.0/24"\n - "103.192.227.125/32"\n')),(0,r.kt)("p",null,"Depending on the cloud provider, the default behavior of the database firewall settings may differ if omitted."),(0,r.kt)("h3",{id:"subnet-id"},"Subnet ID"),(0,r.kt)("p",null,"On AWS, you have the option to launch the RDS instance inside a specific VPC if a ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," is present in the application configuration. By default, if ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," is not provided, the RDS will be created in the default VPC for that account. However, the recommendation is to self-manage your VPCs to provider better isolation from a network security perspective."),(0,r.kt)("p",null,"On AliCloud, the ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," is required. The concept of subnet maps to VSwitch in AliCloud."),(0,r.kt)("p",null,"To place the RDS instance into a specific VPC on Alicloud:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'modules: \n mysql: \n default: \n cloud: alicloud\n # ...\n subnetID: "subnet-xxxxxxxxxxxxxxxx"\n')),(0,r.kt)("h3",{id:"private-routing"},"Private Routing"),(0,r.kt)("p",null,"There is an option to enforce private routing on certain cloud providers if both the workload and the database are running on the cloud."),(0,r.kt)("p",null,"On AliCloud, you can set the ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting")," flag to ",(0,r.kt)("inlineCode",{parentName:"p"},"True"),". The database host generated will be a private FQDN that is only resolvable and accessible from within the AliCloud VPCs. Setting ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting")," flag to ",(0,r.kt)("inlineCode",{parentName:"p"},"True")," when ",(0,r.kt)("inlineCode",{parentName:"p"},"type")," is ",(0,r.kt)("inlineCode",{parentName:"p"},"aws")," is a no-op."),(0,r.kt)("p",null,"To enforce private routing on AliCloud:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules: \n mysql: \n default: \n cloud: alicloud\n # ...\n privateRouting: true\n")),(0,r.kt)("p",null,"Kusion will then generate a private FQDN and inject it into the application runtime as the environment variable ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_HOST_")," for the application to use. A complete list of Kusion-managed environment variables for mysql database can be found ",(0,r.kt)("a",{parentName:"p",href:"/docs/v0.10/reference/modules/catalog-models/database/mysql#credentials-and-connectivity"},"here"),"."),(0,r.kt)("p",null,"Otherwise when using the public FQDN to connect to a database from the workload, the route will depend on cloud provider's routing preference. The options are generally either:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Travel as far as possible on the cloud provider's global backbone network, or also referred to as cold potato routing, or"),(0,r.kt)("li",{parentName:"ul"},"Egress as early as possible to the public Internet and re-enter the cloud provider's datacenter later, or also referred to as hot potato routing")),(0,r.kt)("p",null,"The prior generally has better performance but is also more expensive."),(0,r.kt)("p",null,"You can find a good read on the ",(0,r.kt)("a",{parentName:"p",href:"https://aws.amazon.com/blogs/architecture/internet-routing-and-traffic-engineering/"},"AWS Blog")," or the ",(0,r.kt)("a",{parentName:"p",href:"https://learn.microsoft.com/en-us/azure/virtual-network/ip-services/routing-preference-overview"},"Microsoft Learn"),"."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/772d0280.19b7c1dd.js b/assets/js/772d0280.19b7c1dd.js new file mode 100644 index 00000000000..9ecd8cf598e --- /dev/null +++ b/assets/js/772d0280.19b7c1dd.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7908],{3905:(e,t,a)=>{a.d(t,{Zo:()=>m,kt:()=>c});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},m=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),u=s(a),c=r,k=u["".concat(p,".").concat(c)]||u[c]||d[c]||l;return a?n.createElement(k,i(i({ref:t},m),{},{components:a})):n.createElement(k,i({ref:t},m))}));function c(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,i=new Array(l);i[0]=u;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var s=2;s{a.r(t),a.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>d,frontMatter:()=>l,metadata:()=>o,toc:()=>s});var n=a(87462),r=(a(67294),a(3905));const l={},i="job",o={unversionedId:"reference/modules/developer-schemas/workload/job",id:"version-v0.11/reference/modules/developer-schemas/workload/job",title:"job",description:"Schemas",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/workload/job.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/workload",slug:"/reference/modules/developer-schemas/workload/job",permalink:"/docs/reference/modules/developer-schemas/workload/job",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/workload/job.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"opsrule",permalink:"/docs/reference/modules/developer-schemas/opsrule/"},next:{title:"service",permalink:"/docs/reference/modules/developer-schemas/workload/service"}},p={},s=[{value:"Schemas",id:"schemas",level:2},{value:"Schema Job",id:"schema-job",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Base Schema",id:"base-schema",level:3},{value:"Schema Container",id:"schema-container",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3},{value:"Schema FileSpec",id:"schema-filespec",level:2},{value:"Attributes",id:"attributes-2",level:3},{value:"Examples",id:"examples-2",level:3},{value:"Schema Lifecycle",id:"schema-lifecycle",level:3},{value:"Attributes",id:"attributes-3",level:4},{value:"Examples",id:"examples-3",level:4},{value:"Schema Exec",id:"schema-exec",level:3},{value:"Attributes",id:"attributes-4",level:4},{value:"Examples",id:"examples-4",level:4},{value:"Schema Http",id:"schema-http",level:3},{value:"Attributes",id:"attributes-5",level:4},{value:"Examples",id:"examples-5",level:4},{value:"Schema Probe",id:"schema-probe",level:3},{value:"Attributes",id:"attributes-6",level:4},{value:"Examples",id:"examples-6",level:4},{value:"Schema Tcp",id:"schema-tcp",level:3},{value:"Attributes",id:"attributes-7",level:4},{value:"Examples",id:"examples-7",level:4},{value:"Schema Secret",id:"schema-secret",level:2},{value:"Attributes",id:"attributes-8",level:3},{value:"Examples",id:"examples-8",level:3}],m={toc:s};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},m,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"job"},"job"),(0,r.kt)("h2",{id:"schemas"},"Schemas"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-job"},"Job"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-container"},"Container"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-filespec"},"Filespec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-lifecycle"},"LifeCycle")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-probe"},"Probe"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-exec"},"Exec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-http"},"Http")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-tcp"},"Tcp")))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-secret"},"Secret"))))),(0,r.kt)("h2",{id:"schema-job"},"Schema Job"),(0,r.kt)("p",null,"Job is a kind of workload profile that describes how to run your application code. This",(0,r.kt)("br",null),"is typically used for tasks that take from a few seconds to a few days to complete."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"annotations")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"containers")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:",(0,r.kt)("a",{parentName:"td",href:"../internal/container#schema-container"},"Container"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Containers defines the templates of containers to be ran.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers"},"https://kubernetes.io/docs/concepts/containers")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"labels")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Labels are key/value pairs that are attached to the workload."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"replicas")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Number of container replicas based on this configuration that should be ran."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"schedule")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The scheduling strategy in Cron format. More info: ",(0,r.kt)("a",{parentName:"td",href:"https://en.wikipedia.org/wiki/Cron"},"https://en.wikipedia.org/wiki/Cron"),"."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"secrets")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:",(0,r.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/secret/#schema-secret"},"Secret"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Secrets can be used to store small amount of sensitive data e.g. password, token."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'# Instantiate a job with busybox image and runs every hour\n\nimport kam.workload as wl\nimport kam.workload.container as c\n\nechoJob : wl.Job {\n containers: {\n "busybox": c.Container{\n image: "busybox:1.28"\n command: ["/bin/sh", "-c", "echo hello"]\n }\n }\n schedule: "0 * * * *"\n}\n')),(0,r.kt)("h3",{id:"base-schema"},"Base Schema"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../internal/common#schema-workloadbase"},"WorkloadBase")),(0,r.kt)("h2",{id:"schema-container"},"Schema Container"),(0,r.kt)("p",null,"Container describes how the Application's tasks are expected to be run. Depending on",(0,r.kt)("br",null),"the replicas parameter 1 or more containers can be created from each template."),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"args")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Arguments to the entrypoint.",(0,r.kt)("br",null),"Args will overwrite the CMD value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's CMD is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Entrypoint array. Not executed within a shell.",(0,r.kt)("br",null),"Command will overwrite the ENTRYPOINT value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's ENTRYPOINT is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"dirs")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of volumes mount into the container's filesystem.",(0,r.kt)("br",null),"The dirs parameter is a dict with the key being the folder name in the container and the value",(0,r.kt)("br",null),"being the referenced volume."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"env")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"List of environment variables to set in the container.",(0,r.kt)("br",null),"The value of the environment variable may be static text or a value from a secret."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"files")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:",(0,r.kt)("a",{parentName:"td",href:"#filespec"},"FileSpec"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"List of files to create in the container.",(0,r.kt)("br",null),"The files parameter is a dict with the key being the file name in the container and the value",(0,r.kt)("br",null),"being the target file specification."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"image")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Image refers to the Docker image name to run for this container.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/images"},"https://kubernetes.io/docs/concepts/containers/images")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/container/lifecycle/#schema-lifecycle"},"lc.Lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},"Lifecycle refers to actions that the management system should take in response to container lifecycle events."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"livenessProbe")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"LivenessProbe indicates if a running process is healthy.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"readinessProbe")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"ReadinessProbe indicates whether an application is available to handle requests."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"resources")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Map of resource requirements the container should run with.",(0,r.kt)("br",null),"The resources parameter is a dict with the key being the resource name and the value being",(0,r.kt)("br",null),"the resource value."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"startupProbe")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"StartupProbe indicates that the container has started for the first time.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"workingDir")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The working directory of the running process defined in entrypoint.",(0,r.kt)("br",null),"Default container runtime will be used if this is not specified."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container as c\n\nweb = c.Container {\n image: "nginx:latest"\n command: ["/bin/sh", "-c", "echo hi"]\n env: {\n "name": "value"\n }\n resources: {\n "cpu": "2"\n "memory": "4Gi"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-filespec"},"Schema FileSpec"),(0,r.kt)("p",null,"FileSpec defines the target file in a Container."),(0,r.kt)("h3",{id:"attributes-2"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"content")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"File content in plain text."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"contentFrom")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Source for the file content, reference to a secret of configmap value."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"mode")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Mode bits used to set permissions on this file, must be an octal value",(0,r.kt)("br",null),"between 0000 and 0777 or a decimal value between 0 and 511"),(0,r.kt)("td",{parentName:"tr",align:null},'"0644"')))),(0,r.kt)("h3",{id:"examples-2"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container as c\n\ntmpFile = c.FileSpec {\n content: "some file contents"\n mode: "0777"\n}\n')),(0,r.kt)("h3",{id:"schema-lifecycle"},"Schema Lifecycle"),(0,r.kt)("p",null,"Lifecycle describes actions that the management system should take in response to container lifecycle events."),(0,r.kt)("h4",{id:"attributes-3"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"postStart")),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null},"The action to be taken after a container is created.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"preStop")),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null},"The action to be taken before a container is terminated due to an API request or",(0,r.kt)("br",null),"management event such as liveness/startup probe failure, preemption, resource contention, etc.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"))))),(0,r.kt)("h4",{id:"examples-3"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\nimport kam.workload.container.lifecycle as lc\n\nlifecycleHook = lc.Lifecycle {\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n postStart: p.Http {\n url: "http://localhost:80"\n }\n}\n')),(0,r.kt)("h3",{id:"schema-exec"},"Schema Exec"),(0,r.kt)("p",null,'Exec describes a "run in container" action.'),(0,r.kt)("h4",{id:"attributes-4"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"The command line to execute inside the container."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-4"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\nexecProbe = p.Exec {\n command: ["probe.sh"]\n}\n')),(0,r.kt)("h3",{id:"schema-http"},"Schema Http"),(0,r.kt)("p",null,"Http describes an action based on HTTP Get requests."),(0,r.kt)("h4",{id:"attributes-5"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"headers")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of custom headers to set in the request"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The full qualified url to send HTTP requests."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-5"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\nhttpProbe = p.Http {\n url: "http://localhost:80"\n headers: {\n "X-HEADER": "VALUE"\n }\n}\n')),(0,r.kt)("h3",{id:"schema-probe"},"Schema Probe"),(0,r.kt)("p",null,"Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic. There are three probe types: readiness, liveness, and startup."),(0,r.kt)("h4",{id:"attributes-6"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"failureThreshold")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimum consecutive failures for the probe to be considered failed after having succeeded."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"initialDelaySeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"The number of seconds before health checking is activated.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"periodSeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"How often (in seconds) to perform the probe."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"probeHandler")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#exec"},"Exec")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#http"},"Http")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#tcp"},"Tcp"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"successThreshold")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimum consecutive successes for the probe to be considered successful after having failed."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"terminationGracePeriod")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Duration in seconds before terminate gracefully upon probe failure."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"timeoutSeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"The number of seconds after which the probe times out.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-6"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\nprobe = p.Probe {\n probeHandler: p.Http {\n path: "/healthz"\n }\n initialDelaySeconds: 10\n}\n')),(0,r.kt)("h3",{id:"schema-tcp"},"Schema Tcp"),(0,r.kt)("p",null,"Tcp describes an action based on opening a socket."),(0,r.kt)("h4",{id:"attributes-7"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The full qualified url to open a socket."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-7"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\ntcpProbe = p.Tcp {\n url: "tcp://localhost:1234"\n}\n')),(0,r.kt)("h2",{id:"schema-secret"},"Schema Secret"),(0,r.kt)("p",null,"Secret can be used to store sensitive data."),(0,r.kt)("h3",{id:"attributes-8"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"data")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Data contains the non-binary secret data in string form."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"immutable")),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"Immutable, if set to true, ensures that data stored in the Secret cannot be updated."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"params")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of parameters used to facilitate programmatic handling of secret data."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},'"basic"'),(0,r.kt)("td",{parentName:"tr",align:null},'"token"'),(0,r.kt)("td",{parentName:"tr",align:null},'"opaque"')))),(0,r.kt)("h3",{id:"examples-8"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.secret as sec\n\nbasicAuth = sec.Secret {\n type: "basic"\n data: {\n "username": ""\n "password": ""\n }\n}\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/772d0280.64b9a2f7.js b/assets/js/772d0280.64b9a2f7.js deleted file mode 100644 index 3d4e9e81079..00000000000 --- a/assets/js/772d0280.64b9a2f7.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7908],{3905:(e,t,a)=>{a.d(t,{Zo:()=>m,kt:()=>c});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},m=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),u=s(a),c=r,k=u["".concat(p,".").concat(c)]||u[c]||d[c]||l;return a?n.createElement(k,i(i({ref:t},m),{},{components:a})):n.createElement(k,i({ref:t},m))}));function c(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,i=new Array(l);i[0]=u;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var s=2;s{a.r(t),a.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>d,frontMatter:()=>l,metadata:()=>o,toc:()=>s});var n=a(87462),r=(a(67294),a(3905));const l={},i="job",o={unversionedId:"reference/modules/developer-schemas/workload/job",id:"version-v0.11/reference/modules/developer-schemas/workload/job",title:"job",description:"Schemas",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/workload/job.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/workload",slug:"/reference/modules/developer-schemas/workload/job",permalink:"/docs/reference/modules/developer-schemas/workload/job",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/workload/job.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"opsrule",permalink:"/docs/reference/modules/developer-schemas/opsrule/"},next:{title:"service",permalink:"/docs/reference/modules/developer-schemas/workload/service"}},p={},s=[{value:"Schemas",id:"schemas",level:2},{value:"Schema Job",id:"schema-job",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Base Schema",id:"base-schema",level:3},{value:"Schema Container",id:"schema-container",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3},{value:"Schema FileSpec",id:"schema-filespec",level:2},{value:"Attributes",id:"attributes-2",level:3},{value:"Examples",id:"examples-2",level:3},{value:"Schema Lifecycle",id:"schema-lifecycle",level:3},{value:"Attributes",id:"attributes-3",level:4},{value:"Examples",id:"examples-3",level:4},{value:"Schema Exec",id:"schema-exec",level:3},{value:"Attributes",id:"attributes-4",level:4},{value:"Examples",id:"examples-4",level:4},{value:"Schema Http",id:"schema-http",level:3},{value:"Attributes",id:"attributes-5",level:4},{value:"Examples",id:"examples-5",level:4},{value:"Schema Probe",id:"schema-probe",level:3},{value:"Attributes",id:"attributes-6",level:4},{value:"Examples",id:"examples-6",level:4},{value:"Schema Tcp",id:"schema-tcp",level:3},{value:"Attributes",id:"attributes-7",level:4},{value:"Examples",id:"examples-7",level:4},{value:"Schema Secret",id:"schema-secret",level:2},{value:"Attributes",id:"attributes-8",level:3},{value:"Examples",id:"examples-8",level:3}],m={toc:s};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},m,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"job"},"job"),(0,r.kt)("h2",{id:"schemas"},"Schemas"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-job"},"Job"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-container"},"Container"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-filespec"},"Filespec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-lifecycle"},"LifeCycle")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-probe"},"Probe"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-exec"},"Exec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-http"},"Http")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-tcp"},"Tcp")))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-secret"},"Secret"))))),(0,r.kt)("h2",{id:"schema-job"},"Schema Job"),(0,r.kt)("p",null,"Job is a kind of workload profile that describes how to run your application code. This",(0,r.kt)("br",null),"is typically used for tasks that take from a few seconds to a few days to complete."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"annotations")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"containers")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:",(0,r.kt)("a",{parentName:"td",href:"../internal/container#schema-container"},"Container"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Containers defines the templates of containers to be ran.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers"},"https://kubernetes.io/docs/concepts/containers")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"labels")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Labels are key/value pairs that are attached to the workload."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"replicas")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Number of container replicas based on this configuration that should be ran."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"schedule")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The scheduling strategy in Cron format. More info: ",(0,r.kt)("a",{parentName:"td",href:"https://en.wikipedia.org/wiki/Cron"},"https://en.wikipedia.org/wiki/Cron"),"."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"secrets")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:",(0,r.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/secret/#schema-secret"},"Secret"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Secrets can be used to store small amount of sensitive data e.g. password, token."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'# Instantiate a job with busybox image and runs every hour\n\nimport kam.workload as wl\nimport kam.workload.container as c\n\nechoJob : wl.Job {\n containers: {\n "busybox": c.Container{\n image: "busybox:1.28"\n command: ["/bin/sh", "-c", "echo hello"]\n }\n }\n schedule: "0 * * * *"\n}\n')),(0,r.kt)("h3",{id:"base-schema"},"Base Schema"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../internal/common#schema-workloadbase"},"WorkloadBase")),(0,r.kt)("h2",{id:"schema-container"},"Schema Container"),(0,r.kt)("p",null,"Container describes how the Application's tasks are expected to be run. Depending on",(0,r.kt)("br",null),"the replicas parameter 1 or more containers can be created from each template."),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"args")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Arguments to the entrypoint.",(0,r.kt)("br",null),"Args will overwrite the CMD value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's CMD is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Entrypoint array. Not executed within a shell.",(0,r.kt)("br",null),"Command will overwrite the ENTRYPOINT value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's ENTRYPOINT is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"dirs")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of volumes mount into the container's filesystem.",(0,r.kt)("br",null),"The dirs parameter is a dict with the key being the folder name in the container and the value",(0,r.kt)("br",null),"being the referenced volume."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"env")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"List of environment variables to set in the container.",(0,r.kt)("br",null),"The value of the environment variable may be static text or a value from a secret."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"files")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:",(0,r.kt)("a",{parentName:"td",href:"#filespec"},"FileSpec"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"List of files to create in the container.",(0,r.kt)("br",null),"The files parameter is a dict with the key being the file name in the container and the value",(0,r.kt)("br",null),"being the target file specification."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"image")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Image refers to the Docker image name to run for this container.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/images"},"https://kubernetes.io/docs/concepts/containers/images")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/container/lifecycle/#schema-lifecycle"},"lc.Lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},"Lifecycle refers to actions that the management system should take in response to container lifecycle events."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"livenessProbe")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"LivenessProbe indicates if a running process is healthy.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"readinessProbe")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"ReadinessProbe indicates whether an application is available to handle requests."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"resources")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Map of resource requirements the container should run with.",(0,r.kt)("br",null),"The resources parameter is a dict with the key being the resource name and the value being",(0,r.kt)("br",null),"the resource value."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"startupProbe")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"StartupProbe indicates that the container has started for the first time.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"workingDir")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The working directory of the running process defined in entrypoint.",(0,r.kt)("br",null),"Default container runtime will be used if this is not specified."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container as c\n\nweb = c.Container {\n image: "nginx:latest"\n command: ["/bin/sh", "-c", "echo hi"]\n env: {\n "name": "value"\n }\n resources: {\n "cpu": "2"\n "memory": "4Gi"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-filespec"},"Schema FileSpec"),(0,r.kt)("p",null,"FileSpec defines the target file in a Container."),(0,r.kt)("h3",{id:"attributes-2"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"content")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"File content in plain text."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"contentFrom")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Source for the file content, reference to a secret of configmap value."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"mode")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Mode bits used to set permissions on this file, must be an octal value",(0,r.kt)("br",null),"between 0000 and 0777 or a decimal value between 0 and 511"),(0,r.kt)("td",{parentName:"tr",align:null},'"0644"')))),(0,r.kt)("h3",{id:"examples-2"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container as c\n\ntmpFile = c.FileSpec {\n content: "some file contents"\n mode: "0777"\n}\n')),(0,r.kt)("h3",{id:"schema-lifecycle"},"Schema Lifecycle"),(0,r.kt)("p",null,"Lifecycle describes actions that the management system should take in response to container lifecycle events."),(0,r.kt)("h4",{id:"attributes-3"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"postStart")),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null},"The action to be taken after a container is created.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"preStop")),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null},"The action to be taken before a container is terminated due to an API request or",(0,r.kt)("br",null),"management event such as liveness/startup probe failure, preemption, resource contention, etc.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"))))),(0,r.kt)("h4",{id:"examples-3"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\nimport kam.workload.container.lifecycle as lc\n\nlifecycleHook = lc.Lifecycle {\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n postStart: p.Http {\n url: "http://localhost:80"\n }\n}\n')),(0,r.kt)("h3",{id:"schema-exec"},"Schema Exec"),(0,r.kt)("p",null,'Exec describes a "run in container" action.'),(0,r.kt)("h4",{id:"attributes-4"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"The command line to execute inside the container."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-4"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\nexecProbe = p.Exec {\n command: ["probe.sh"]\n}\n')),(0,r.kt)("h3",{id:"schema-http"},"Schema Http"),(0,r.kt)("p",null,"Http describes an action based on HTTP Get requests."),(0,r.kt)("h4",{id:"attributes-5"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"headers")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of custom headers to set in the request"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The full qualified url to send HTTP requests."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-5"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\nhttpProbe = p.Http {\n url: "http://localhost:80"\n headers: {\n "X-HEADER": "VALUE"\n }\n}\n')),(0,r.kt)("h3",{id:"schema-probe"},"Schema Probe"),(0,r.kt)("p",null,"Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic. There are three probe types: readiness, liveness, and startup."),(0,r.kt)("h4",{id:"attributes-6"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"failureThreshold")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimum consecutive failures for the probe to be considered failed after having succeeded."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"initialDelaySeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"The number of seconds before health checking is activated.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"periodSeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"How often (in seconds) to perform the probe."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"probeHandler")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#exec"},"Exec")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#http"},"Http")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#tcp"},"Tcp"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"successThreshold")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimum consecutive successes for the probe to be considered successful after having failed."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"terminationGracePeriod")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Duration in seconds before terminate gracefully upon probe failure."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"timeoutSeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"The number of seconds after which the probe times out.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-6"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\nprobe = p.Probe {\n probeHandler: p.Http {\n path: "/healthz"\n }\n initialDelaySeconds: 10\n}\n')),(0,r.kt)("h3",{id:"schema-tcp"},"Schema Tcp"),(0,r.kt)("p",null,"Tcp describes an action based on opening a socket."),(0,r.kt)("h4",{id:"attributes-7"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The full qualified url to open a socket."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-7"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\ntcpProbe = p.Tcp {\n url: "tcp://localhost:1234"\n}\n')),(0,r.kt)("h2",{id:"schema-secret"},"Schema Secret"),(0,r.kt)("p",null,"Secret can be used to store sensitive data."),(0,r.kt)("h3",{id:"attributes-8"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"data")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Data contains the non-binary secret data in string form."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"immutable")),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"Immutable, if set to true, ensures that data stored in the Secret cannot be updated."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"params")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of parameters used to facilitate programmatic handling of secret data."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},'"basic"'),(0,r.kt)("td",{parentName:"tr",align:null},'"token"'),(0,r.kt)("td",{parentName:"tr",align:null},'"opaque"')))),(0,r.kt)("h3",{id:"examples-8"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.secret as sec\n\nbasicAuth = sec.Secret {\n type: "basic"\n data: {\n "username": ""\n "password": ""\n }\n}\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/77c6b439.64e42f0f.js b/assets/js/77c6b439.64e42f0f.js deleted file mode 100644 index 22b53f6d539..00000000000 --- a/assets/js/77c6b439.64e42f0f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8527],{3905:(e,t,o)=>{o.d(t,{Zo:()=>c,kt:()=>h});var n=o(67294);function i(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function a(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function r(e){for(var t=1;t=0||(i[o]=e[o]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(i[o]=e[o])}return i}var l=n.createContext({}),p=function(e){var t=n.useContext(l),o=t;return e&&(o="function"==typeof e?e(t):r(r({},t),e)),o},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var o=e.components,i=e.mdxType,a=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(o),h=i,m=d["".concat(l,".").concat(h)]||d[h]||u[h]||a;return o?n.createElement(m,r(r({ref:t},c),{},{components:o})):n.createElement(m,r({ref:t},c))}));function h(e,t){var o=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=o.length,r=new Array(a);r[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,r[1]=s;for(var p=2;p{o.r(t),o.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=o(87462),i=(o(67294),o(3905));const a={id:"overview",title:"Overview",slug:"/"},r="Overview",s={unversionedId:"what-is-kusion/overview",id:"what-is-kusion/overview",title:"Overview",description:"Welcome to Kusion! This introduction section covers what Kusion is, the problem Kusion aims to solve, and how Kusion compares to other software. If you just want to dive into using Kusion, feel free to skip ahead to the Getting Started section.",source:"@site/docs/kusion/1-what-is-kusion/1-overview.md",sourceDirName:"1-what-is-kusion",slug:"/",permalink:"/docs/next/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/1-what-is-kusion/1-overview.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"overview",title:"Overview",slug:"/"},sidebar:"kusion",next:{title:"Kusion vs Other Software",permalink:"/docs/next/what-is-kusion/kusion-vs-x"}},l={},p=[{value:"What is Kusion?",id:"what-is-kusion",level:2},{value:"Why Kusion?",id:"why-kusion",level:2},{value:"Kusion Highlights",id:"kusion-highlights",level:2}],c={toc:p};function u(e){let{components:t,...o}=e;return(0,i.kt)("wrapper",(0,n.Z)({},c,o,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"overview"},"Overview"),(0,i.kt)("p",null,"Welcome to Kusion! This introduction section covers what Kusion is, the problem Kusion aims to solve, and how Kusion compares to other software. If you just want to dive into using Kusion, feel free to skip ahead to the ",(0,i.kt)("a",{parentName:"p",href:"getting-started/install-kusion"},"Getting Started")," section."),(0,i.kt)("h2",{id:"what-is-kusion"},"What is Kusion?"),(0,i.kt)("p",null,"Kusion is an intent-based Platform Orchestrator that enables developers to specify their desired intent in a declarative way and then using a consistent workflow to drive continuous deployment through application lifecycle. Inspired by the phrase ",(0,i.kt)("strong",{parentName:"p"},"Fusion on Kubernetes"),", Kusion aims to help application and platform developers to develop and deliver in a self-serviceable, fast, reliable, and collaborative way."),(0,i.kt)("p",null,(0,i.kt)("img",{parentName:"p",src:"https://raw.githubusercontent.com/KusionStack/kusion/main/docs/workflow.png",alt:"arch"})),(0,i.kt)("h2",{id:"why-kusion"},"Why Kusion?"),(0,i.kt)("p",null,"Developers should be able to deploy and run their applications and services end to end. ",(0,i.kt)("strong",{parentName:"p"},'"You build it, you run it", the original promise of DevOps.')),(0,i.kt)("p",null,"But the modern day for most software organizations this promise quickly become unrelalistic since the increasingly complex cloud-native toolchains, while cloud native technologies made huge improvements in areas such as scalability, availability and operability, it also brings downside - the growing burden on developers, which leads to the rise of ",(0,i.kt)("a",{parentName:"p",href:"https://platformengineering.org/"},"Platform Engineering"),"."),(0,i.kt)("p",null,"Another challenge we saw is that a series of ",(0,i.kt)("a",{parentName:"p",href:"https://web.devopstopologies.com/#anti-types"},"antipatterns")," emerge when regular software organizations tries to implement true DevOps. Without well proven reference architecture and supporting tools, it's much more difficult to accomplish the original promise."),(0,i.kt)("p",null,"On one hand, ",(0,i.kt)("strong",{parentName:"p"},"Kusion was build to minimize developer's cognitive load"),". With application-centric configuration model, you don't need to deal with tedious infrastructure and configuration management tooling, all you need to be familiar with is ",(0,i.kt)("a",{parentName:"p",href:"configuration-walkthrough/overview"},"AppConfiguration"),". This approach shields developers from the configurational complexity of Kubernetes but still enable standardization by design."),(0,i.kt)("p",null,"On the other hand, ",(0,i.kt)("strong",{parentName:"p"},"Kusion defines a new way for different engineering organizations to collaborate"),'. With the separation of concerns, different roles could focus on their aspects of the configuration based on their knowledge and responsibility, whereas Kusion will dynamically manage and "glue" the opinionated configurations together. Through such a division of labor, the platform team can better manage the differences and complexities of the platform, and app developers could participate in ops work with much less cognitive load.'),(0,i.kt)("h2",{id:"kusion-highlights"},"Kusion Highlights"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Platform as Code")),(0,i.kt)("p",{parentName:"li"},"Specify desired application intent through declarative configuration code, drive continuous deployment with any CI/CD systems or GitOps to match that intent. No ad-hoc scripts, no hard maintain custom workflows, just declarative configuration code.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Dynamic Configuration Management")),(0,i.kt)("p",{parentName:"li"},"Enable platform teams to set baseline-templates, control how and where to deploy application workloads and provision accessory resources. While still enabling application developers freedom via workload-centric specification and deployment. ")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Security & Compliance Built In")),(0,i.kt)("p",{parentName:"li"},"Enforce security and infrastructure best practices with out-of-box ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"base models"),", create security and compliance guardrails for any Kusion deploy with third-party Policy as Code tools. All accessory resource secrets are automatically injected into Workloads.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Lightweight and Open Model Ecosystem")),(0,i.kt)("p",{parentName:"li"},"Pure client-side solution ensures good portability and the rich APIs make it easier to integrate and automate. Large growing model ecosystem covers all stages in application lifecycle, with extensive connections to various infrastructure capabilities. "))),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("strong",{parentName:"p"},"Kusion is an early project.")," The end goal of Kusion is to boost ",(0,i.kt)("a",{parentName:"p",href:"https://internaldeveloperplatform.org/"},"Internal Developer Platform")," revolution, and we are iterating on Kusion quickly to strive towards this goal. For any help or feedback, please contact us in ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/community/discussions/categories/meeting"},"Slack")," or ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/issues"},"issues"),".")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/77c6b439.b917d45b.js b/assets/js/77c6b439.b917d45b.js new file mode 100644 index 00000000000..0572fa8fc1f --- /dev/null +++ b/assets/js/77c6b439.b917d45b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8527],{3905:(e,t,o)=>{o.d(t,{Zo:()=>c,kt:()=>h});var n=o(67294);function i(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function a(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function r(e){for(var t=1;t=0||(i[o]=e[o]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(i[o]=e[o])}return i}var l=n.createContext({}),p=function(e){var t=n.useContext(l),o=t;return e&&(o="function"==typeof e?e(t):r(r({},t),e)),o},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var o=e.components,i=e.mdxType,a=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(o),h=i,m=d["".concat(l,".").concat(h)]||d[h]||u[h]||a;return o?n.createElement(m,r(r({ref:t},c),{},{components:o})):n.createElement(m,r({ref:t},c))}));function h(e,t){var o=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=o.length,r=new Array(a);r[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,r[1]=s;for(var p=2;p{o.r(t),o.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=o(87462),i=(o(67294),o(3905));const a={id:"overview",title:"Overview",slug:"/"},r="Overview",s={unversionedId:"what-is-kusion/overview",id:"what-is-kusion/overview",title:"Overview",description:"Welcome to Kusion! This introduction section covers what Kusion is, the problem Kusion aims to solve, and how Kusion compares to other software. If you just want to dive into using Kusion, feel free to skip ahead to the Getting Started section.",source:"@site/docs/kusion/1-what-is-kusion/1-overview.md",sourceDirName:"1-what-is-kusion",slug:"/",permalink:"/docs/next/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/1-what-is-kusion/1-overview.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"overview",title:"Overview",slug:"/"},sidebar:"kusion",next:{title:"Kusion vs Other Software",permalink:"/docs/next/what-is-kusion/kusion-vs-x"}},l={},p=[{value:"What is Kusion?",id:"what-is-kusion",level:2},{value:"Why Kusion?",id:"why-kusion",level:2},{value:"Kusion Highlights",id:"kusion-highlights",level:2}],c={toc:p};function u(e){let{components:t,...o}=e;return(0,i.kt)("wrapper",(0,n.Z)({},c,o,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"overview"},"Overview"),(0,i.kt)("p",null,"Welcome to Kusion! This introduction section covers what Kusion is, the problem Kusion aims to solve, and how Kusion compares to other software. If you just want to dive into using Kusion, feel free to skip ahead to the ",(0,i.kt)("a",{parentName:"p",href:"getting-started/install-kusion"},"Getting Started")," section."),(0,i.kt)("h2",{id:"what-is-kusion"},"What is Kusion?"),(0,i.kt)("p",null,"Kusion is an intent-based Platform Orchestrator that enables developers to specify their desired intent in a declarative way and then using a consistent workflow to drive continuous deployment through application lifecycle. Inspired by the phrase ",(0,i.kt)("strong",{parentName:"p"},"Fusion on Kubernetes"),", Kusion aims to help application and platform developers to develop and deliver in a self-serviceable, fast, reliable, and collaborative way."),(0,i.kt)("p",null,(0,i.kt)("img",{parentName:"p",src:"https://raw.githubusercontent.com/KusionStack/kusion/main/docs/workflow.png",alt:"arch"})),(0,i.kt)("h2",{id:"why-kusion"},"Why Kusion?"),(0,i.kt)("p",null,"Developers should be able to deploy and run their applications and services end to end. ",(0,i.kt)("strong",{parentName:"p"},'"You build it, you run it", the original promise of DevOps.')),(0,i.kt)("p",null,"But the modern day for most software organizations this promise quickly become unrelalistic since the increasingly complex cloud-native toolchains, while cloud native technologies made huge improvements in areas such as scalability, availability and operability, it also brings downside - the growing burden on developers, which leads to the rise of ",(0,i.kt)("a",{parentName:"p",href:"https://platformengineering.org/"},"Platform Engineering"),"."),(0,i.kt)("p",null,"Another challenge we saw is that a series of ",(0,i.kt)("a",{parentName:"p",href:"https://web.devopstopologies.com/#anti-types"},"antipatterns")," emerge when regular software organizations tries to implement true DevOps. Without well proven reference architecture and supporting tools, it's much more difficult to accomplish the original promise."),(0,i.kt)("p",null,"On one hand, ",(0,i.kt)("strong",{parentName:"p"},"Kusion was build to minimize developer's cognitive load"),". With application-centric configuration model, you don't need to deal with tedious infrastructure and configuration management tooling, all you need to be familiar with is ",(0,i.kt)("a",{parentName:"p",href:"configuration-walkthrough/overview"},"AppConfiguration"),". This approach shields developers from the configurational complexity of Kubernetes but still enable standardization by design."),(0,i.kt)("p",null,"On the other hand, ",(0,i.kt)("strong",{parentName:"p"},"Kusion defines a new way for different engineering organizations to collaborate"),'. With the separation of concerns, different roles could focus on their aspects of the configuration based on their knowledge and responsibility, whereas Kusion will dynamically manage and "glue" the opinionated configurations together. Through such a division of labor, the platform team can better manage the differences and complexities of the platform, and app developers could participate in ops work with much less cognitive load.'),(0,i.kt)("h2",{id:"kusion-highlights"},"Kusion Highlights"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Platform as Code")),(0,i.kt)("p",{parentName:"li"},"Specify desired application intent through declarative configuration code, drive continuous deployment with any CI/CD systems or GitOps to match that intent. No ad-hoc scripts, no hard maintain custom workflows, just declarative configuration code.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Dynamic Configuration Management")),(0,i.kt)("p",{parentName:"li"},"Enable platform teams to set baseline-templates, control how and where to deploy application workloads and provision accessory resources. While still enabling application developers freedom via workload-centric specification and deployment. ")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Security & Compliance Built In")),(0,i.kt)("p",{parentName:"li"},"Enforce security and infrastructure best practices with out-of-box ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"base models"),", create security and compliance guardrails for any Kusion deploy with third-party Policy as Code tools. All accessory resource secrets are automatically injected into Workloads.")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("p",{parentName:"li"},(0,i.kt)("strong",{parentName:"p"},"Lightweight and Open Model Ecosystem")),(0,i.kt)("p",{parentName:"li"},"Pure client-side solution ensures good portability and the rich APIs make it easier to integrate and automate. Large growing model ecosystem covers all stages in application lifecycle, with extensive connections to various infrastructure capabilities. "))),(0,i.kt)("admonition",{type:"tip"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("strong",{parentName:"p"},"Kusion is an early project.")," The end goal of Kusion is to boost ",(0,i.kt)("a",{parentName:"p",href:"https://internaldeveloperplatform.org/"},"Internal Developer Platform")," revolution, and we are iterating on Kusion quickly to strive towards this goal. For any help or feedback, please contact us in ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/community/discussions/categories/meeting"},"Slack")," or ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/issues"},"issues"),".")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/77cf6619.682c6b07.js b/assets/js/77cf6619.682c6b07.js deleted file mode 100644 index e19e4a8e2e6..00000000000 --- a/assets/js/77cf6619.682c6b07.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5114],{3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var o=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function i(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var l=o.createContext({}),p=function(e){var n=o.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},u=function(e){var n=p(e.components);return o.createElement(l.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},d=o.forwardRef((function(e,n){var t=e.components,a=e.mdxType,r=e.originalType,l=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=p(t),m=a,f=d["".concat(l,".").concat(m)]||d[m]||c[m]||r;return t?o.createElement(f,i(i({ref:n},u),{},{components:t})):o.createElement(f,i({ref:n},u))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var r=t.length,i=new Array(r);i[0]=d;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var p=2;p{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>i,default:()=>c,frontMatter:()=>r,metadata:()=>s,toc:()=>p});var o=t(87462),a=(t(67294),t(3905));const r={id:"how-kusion-works",sidebar_label:"How Kusion Works?"},i="How Kusion Works?",s={unversionedId:"concepts/how-kusion-works",id:"version-v0.11/concepts/how-kusion-works",title:"How Kusion Works?",description:"Kusion is the platform engineering engine of KusionStack. It delivers intentions described with Kusion Modules defined in Catalog to Kubernetes, Clouds and On-Prem infrastructures.",source:"@site/docs_versioned_docs/version-v0.11/3-concepts/9-how-kusion-works.md",sourceDirName:"3-concepts",slug:"/concepts/how-kusion-works",permalink:"/docs/concepts/how-kusion-works",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/3-concepts/9-how-kusion-works.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:9,frontMatter:{id:"how-kusion-works",sidebar_label:"How Kusion Works?"},sidebar:"kusion",previous:{title:"Configuration",permalink:"/docs/concepts/configuration"},next:{title:"Configuration File Overview",permalink:"/docs/configuration-walkthrough/overview"}},l={},p=[{value:"Overview",id:"overview",level:2},{value:"Platform Developer\u2019s Workflow",id:"platform-developers-workflow",level:2},{value:"Design Kusion Modules",id:"design-kusion-modules",level:3},{value:"Instantiate and Set Up Workspaces",id:"instantiate-and-set-up-workspaces",level:3},{value:"Application Developer\u2019s Workflow",id:"application-developers-workflow",level:2},{value:"Instantiate AppConfiguration and Apply",id:"instantiate-appconfiguration-and-apply",level:3}],u={toc:p};function c(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,o.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"how-kusion-works"},"How Kusion Works?"),(0,a.kt)("p",null,"Kusion is the platform engineering engine of ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack"},"KusionStack"),". It delivers intentions described with Kusion Modules defined in ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"Catalog")," to Kubernetes, Clouds and On-Prem infrastructures."),(0,a.kt)("p",null,(0,a.kt)("img",{parentName:"p",src:"https://raw.githubusercontent.com/KusionStack/kusion/main/docs/workflow.png",alt:"arch"})),(0,a.kt)("h2",{id:"overview"},"Overview"),(0,a.kt)("p",null,"The workflow of KusionStack is illustrated in the diagram above, and it consists of three steps. The first step is ",(0,a.kt)("inlineCode",{parentName:"p"},"Write"),", where platform engineers provide Kusion Modules and application developers write AppConfigurations based on the Kusion Modules to describe their operational intent."),(0,a.kt)("p",null,"The second step is the ",(0,a.kt)("inlineCode",{parentName:"p"},"Generate")," process, which results in the creation of the SSoT (Single Source of Truth), also known as the ",(0,a.kt)("a",{parentName:"p",href:"spec"},"Spec")," of the current operational task. If you need version management of the SSoT, we recommend you manage the Spec with a VCS (Version Control System) tool like git."),(0,a.kt)("p",null,"The third step is ",(0,a.kt)("inlineCode",{parentName:"p"},"Apply")," which makes the Spec effective. Kusion parses the operational intent based on the Spec produced in the previous step. Before applying the intent, Kusion will execute the Preview command (you can also execute this command manually) which will use a three-way diff algorithm to preview changes and prompt users to make sure all changes meet expectations; the Apply command will then actualize the operational intent onto various infrastructure platforms. Currently, it supports three runtimes: Terraform, Kubernetes, and on-prem infrastructures."),(0,a.kt)("p",null,"As a user of Kusion, if you prefer not to be conscious of so many steps, you can simply use ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion apply"),", and Kusion will automatically execute all the aforementioned steps for you."),(0,a.kt)("h2",{id:"platform-developers-workflow"},"Platform Developer\u2019s Workflow"),(0,a.kt)("h3",{id:"design-kusion-modules"},"Design Kusion Modules"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"kusion-module/overview"},"Kusion Module")," is a reusable building block designed by platform engineers and contains two components: an application developer-oriented schema and a Kusion module generator. When platform engineers have developed a Kusion module, they can push it to a ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"catalog")," repository to make it into a KCL package."),(0,a.kt)("p",null,"Given a database Kusion module as an example, the schema definition is shown below and the generator logic can be found ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog/tree/main/modules/mysql/src"},"here"),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'schema MySQL: \n """ MySQL describes the attributes to locally deploy or create a cloud provider\n managed mysql database instance for the workload. \n\n Attributes\n ----------\n type: "local" | "cloud", defaults to Undefined, required. \n Type defines whether the mysql database is deployed locally or provided by \n cloud vendor. \n version: str, defaults to Undefined, required. \n Version defines the mysql version to use. \n\n Examples\n --------\n Instantiate a local mysql database with version of 5.7. \n\n import catalog.models.schema.v1.accessories.mysql\n\n accessories: {\n "mysql": mysql.MySQL {\n type: "local"\n version: "8.0"\n }\n }\n """\n\n # The deployment mode of the mysql database. \n type: "local" | "cloud"\n\n # The mysql database version to use. \n version: str\n \n')),(0,a.kt)("h3",{id:"instantiate-and-set-up-workspaces"},"Instantiate and Set Up Workspaces"),(0,a.kt)("p",null,"Each ",(0,a.kt)("a",{parentName:"p",href:"workspace"},"workspace")," includes a corresponding Platform config file maintained by platform engineers.\nPlatform engineers should instantiate all workspaces and fulfill all fields with platform default values. Kusion will merge the workspace configuration with AppConfiguration in the Stack of the same name. An example is as follows."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'# MySQL configurations for AWS RDS\nmodules: \n kusionstack/mysql@0.1.0:\n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n securityIPs: \n - 0.0.0.0/0\n suffix: "-mysql"\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"mysql")," block represents a Kusion module. The fields inside are parts of the inputs for the Kusion module generator. For more details about the workspace, please refer to the ",(0,a.kt)("a",{parentName:"p",href:"workspace"},"workspace")," section."),(0,a.kt)("h2",{id:"application-developers-workflow"},"Application Developer\u2019s Workflow"),(0,a.kt)("h3",{id:"instantiate-appconfiguration-and-apply"},"Instantiate AppConfiguration and Apply"),(0,a.kt)("p",null,"Application developers choose Kusion modules they need and instantiate them in the AppConfiguration to describe their operation intentions. We have built some built-in Kusion modules in the repository ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"Catalog")," and we warmly welcome you to join us in building this ecosystem together."),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"main.k")," is the ",(0,a.kt)("strong",{parentName:"p"},"only")," configuration maintained by application developers and schemas in this file are defined from the application developer's perspective to reduce their cognitive load. An example is as follows."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-pthyon"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\nimport mysql\n\nwordpress: ac.AppConfiguration {\n \xa0 \xa0workload: wl.Service {\n \xa0 \xa0 \xa0 \xa0containers: {\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0wordpress: c.Container {\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0image: "wordpress:6.3"\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0env: {\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0"WORDPRESS_DB_HOST": "$(KUSION_DB_HOST_WORDPRESS_MYSQL)"\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0"WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME_WORDPRESS_MYSQL)"\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0"WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD_WORDPRESS_MYSQL)"\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0"WORDPRESS_DB_NAME": "mysql"\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0}\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0resources: {\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0"cpu": "500m"\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0"memory": "512Mi"\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0}\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0}\n \xa0 \xa0 \xa0 \xa0}\n \xa0 \xa0 \xa0 \xa0replicas: 1\n \xa0 \xa0}\n \xa0 \xa0accessories: {\n \xa0 \xa0 \xa0 \xa0"network": n.Network {\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0ports: [\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0n.Port {\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0port: 80\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0}\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0]\n \xa0 \xa0 \xa0 \xa0}\n \xa0 \xa0 \xa0 \xa0"mysql": mysql.MySQL {\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0type: "cloud"\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0version: "8.0"\n \xa0 \xa0 \xa0 \xa0}\n \xa0 \xa0}\n}\n')),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"workload")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"database")," are both Kusion modules provided by platform engineers and Kusion will convert them into actual infrastructure API calls eventually."),(0,a.kt)("p",null,"Finally, application developers can deliver their operational intent to infrastructures with one command ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion apply"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/77cf6619.d9ed76ca.js b/assets/js/77cf6619.d9ed76ca.js new file mode 100644 index 00000000000..1d9b6cd7a6f --- /dev/null +++ b/assets/js/77cf6619.d9ed76ca.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5114],{3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var o=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function i(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var l=o.createContext({}),p=function(e){var n=o.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},u=function(e){var n=p(e.components);return o.createElement(l.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},d=o.forwardRef((function(e,n){var t=e.components,a=e.mdxType,r=e.originalType,l=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=p(t),m=a,f=d["".concat(l,".").concat(m)]||d[m]||c[m]||r;return t?o.createElement(f,i(i({ref:n},u),{},{components:t})):o.createElement(f,i({ref:n},u))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var r=t.length,i=new Array(r);i[0]=d;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var p=2;p{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>i,default:()=>c,frontMatter:()=>r,metadata:()=>s,toc:()=>p});var o=t(87462),a=(t(67294),t(3905));const r={id:"how-kusion-works",sidebar_label:"How Kusion Works?"},i="How Kusion Works?",s={unversionedId:"concepts/how-kusion-works",id:"version-v0.11/concepts/how-kusion-works",title:"How Kusion Works?",description:"Kusion is the platform engineering engine of KusionStack. It delivers intentions described with Kusion Modules defined in Catalog to Kubernetes, Clouds and On-Prem infrastructures.",source:"@site/docs_versioned_docs/version-v0.11/3-concepts/9-how-kusion-works.md",sourceDirName:"3-concepts",slug:"/concepts/how-kusion-works",permalink:"/docs/concepts/how-kusion-works",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/3-concepts/9-how-kusion-works.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:9,frontMatter:{id:"how-kusion-works",sidebar_label:"How Kusion Works?"},sidebar:"kusion",previous:{title:"Configuration",permalink:"/docs/concepts/configuration"},next:{title:"Configuration File Overview",permalink:"/docs/configuration-walkthrough/overview"}},l={},p=[{value:"Overview",id:"overview",level:2},{value:"Platform Developer\u2019s Workflow",id:"platform-developers-workflow",level:2},{value:"Design Kusion Modules",id:"design-kusion-modules",level:3},{value:"Instantiate and Set Up Workspaces",id:"instantiate-and-set-up-workspaces",level:3},{value:"Application Developer\u2019s Workflow",id:"application-developers-workflow",level:2},{value:"Instantiate AppConfiguration and Apply",id:"instantiate-appconfiguration-and-apply",level:3}],u={toc:p};function c(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,o.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"how-kusion-works"},"How Kusion Works?"),(0,a.kt)("p",null,"Kusion is the platform engineering engine of ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack"},"KusionStack"),". It delivers intentions described with Kusion Modules defined in ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"Catalog")," to Kubernetes, Clouds and On-Prem infrastructures."),(0,a.kt)("p",null,(0,a.kt)("img",{parentName:"p",src:"https://raw.githubusercontent.com/KusionStack/kusion/main/docs/workflow.png",alt:"arch"})),(0,a.kt)("h2",{id:"overview"},"Overview"),(0,a.kt)("p",null,"The workflow of KusionStack is illustrated in the diagram above, and it consists of three steps. The first step is ",(0,a.kt)("inlineCode",{parentName:"p"},"Write"),", where platform engineers provide Kusion Modules and application developers write AppConfigurations based on the Kusion Modules to describe their operational intent."),(0,a.kt)("p",null,"The second step is the ",(0,a.kt)("inlineCode",{parentName:"p"},"Generate")," process, which results in the creation of the SSoT (Single Source of Truth), also known as the ",(0,a.kt)("a",{parentName:"p",href:"spec"},"Spec")," of the current operational task. If you need version management of the SSoT, we recommend you manage the Spec with a VCS (Version Control System) tool like git."),(0,a.kt)("p",null,"The third step is ",(0,a.kt)("inlineCode",{parentName:"p"},"Apply")," which makes the Spec effective. Kusion parses the operational intent based on the Spec produced in the previous step. Before applying the intent, Kusion will execute the Preview command (you can also execute this command manually) which will use a three-way diff algorithm to preview changes and prompt users to make sure all changes meet expectations; the Apply command will then actualize the operational intent onto various infrastructure platforms. Currently, it supports three runtimes: Terraform, Kubernetes, and on-prem infrastructures."),(0,a.kt)("p",null,"As a user of Kusion, if you prefer not to be conscious of so many steps, you can simply use ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion apply"),", and Kusion will automatically execute all the aforementioned steps for you."),(0,a.kt)("h2",{id:"platform-developers-workflow"},"Platform Developer\u2019s Workflow"),(0,a.kt)("h3",{id:"design-kusion-modules"},"Design Kusion Modules"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"kusion-module/overview"},"Kusion Module")," is a reusable building block designed by platform engineers and contains two components: an application developer-oriented schema and a Kusion module generator. When platform engineers have developed a Kusion module, they can push it to a ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"catalog")," repository to make it into a KCL package."),(0,a.kt)("p",null,"Given a database Kusion module as an example, the schema definition is shown below and the generator logic can be found ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog/tree/main/modules/mysql/src"},"here"),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'schema MySQL: \n """ MySQL describes the attributes to locally deploy or create a cloud provider\n managed mysql database instance for the workload. \n\n Attributes\n ----------\n type: "local" | "cloud", defaults to Undefined, required. \n Type defines whether the mysql database is deployed locally or provided by \n cloud vendor. \n version: str, defaults to Undefined, required. \n Version defines the mysql version to use. \n\n Examples\n --------\n Instantiate a local mysql database with version of 5.7. \n\n import catalog.models.schema.v1.accessories.mysql\n\n accessories: {\n "mysql": mysql.MySQL {\n type: "local"\n version: "8.0"\n }\n }\n """\n\n # The deployment mode of the mysql database. \n type: "local" | "cloud"\n\n # The mysql database version to use. \n version: str\n \n')),(0,a.kt)("h3",{id:"instantiate-and-set-up-workspaces"},"Instantiate and Set Up Workspaces"),(0,a.kt)("p",null,"Each ",(0,a.kt)("a",{parentName:"p",href:"workspace"},"workspace")," includes a corresponding Platform config file maintained by platform engineers.\nPlatform engineers should instantiate all workspaces and fulfill all fields with platform default values. Kusion will merge the workspace configuration with AppConfiguration in the Stack of the same name. An example is as follows."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'# MySQL configurations for AWS RDS\nmodules: \n kusionstack/mysql@0.1.0:\n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n securityIPs: \n - 0.0.0.0/0\n suffix: "-mysql"\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"mysql")," block represents a Kusion module. The fields inside are parts of the inputs for the Kusion module generator. For more details about the workspace, please refer to the ",(0,a.kt)("a",{parentName:"p",href:"workspace"},"workspace")," section."),(0,a.kt)("h2",{id:"application-developers-workflow"},"Application Developer\u2019s Workflow"),(0,a.kt)("h3",{id:"instantiate-appconfiguration-and-apply"},"Instantiate AppConfiguration and Apply"),(0,a.kt)("p",null,"Application developers choose Kusion modules they need and instantiate them in the AppConfiguration to describe their operation intentions. We have built some built-in Kusion modules in the repository ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"Catalog")," and we warmly welcome you to join us in building this ecosystem together."),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"main.k")," is the ",(0,a.kt)("strong",{parentName:"p"},"only")," configuration maintained by application developers and schemas in this file are defined from the application developer's perspective to reduce their cognitive load. An example is as follows."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-pthyon"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\nimport mysql\n\nwordpress: ac.AppConfiguration {\n \xa0 \xa0workload: wl.Service {\n \xa0 \xa0 \xa0 \xa0containers: {\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0wordpress: c.Container {\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0image: "wordpress:6.3"\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0env: {\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0"WORDPRESS_DB_HOST": "$(KUSION_DB_HOST_WORDPRESS_MYSQL)"\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0"WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME_WORDPRESS_MYSQL)"\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0"WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD_WORDPRESS_MYSQL)"\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0"WORDPRESS_DB_NAME": "mysql"\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0}\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0resources: {\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0"cpu": "500m"\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0"memory": "512Mi"\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0}\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0}\n \xa0 \xa0 \xa0 \xa0}\n \xa0 \xa0 \xa0 \xa0replicas: 1\n \xa0 \xa0}\n \xa0 \xa0accessories: {\n \xa0 \xa0 \xa0 \xa0"network": n.Network {\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0ports: [\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0n.Port {\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0port: 80\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0 \xa0}\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0]\n \xa0 \xa0 \xa0 \xa0}\n \xa0 \xa0 \xa0 \xa0"mysql": mysql.MySQL {\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0type: "cloud"\n \xa0 \xa0 \xa0 \xa0 \xa0 \xa0version: "8.0"\n \xa0 \xa0 \xa0 \xa0}\n \xa0 \xa0}\n}\n')),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"workload")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"database")," are both Kusion modules provided by platform engineers and Kusion will convert them into actual infrastructure API calls eventually."),(0,a.kt)("p",null,"Finally, application developers can deliver their operational intent to infrastructures with one command ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion apply"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/79507ce0.00c9bdc8.js b/assets/js/79507ce0.00c9bdc8.js deleted file mode 100644 index a8fbd8a79db..00000000000 --- a/assets/js/79507ce0.00c9bdc8.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5932],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var r=t(67294);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var p=r.createContext({}),l=function(e){var n=r.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=l(e.components);return r.createElement(p.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},d=r.forwardRef((function(e,n){var t=e.components,i=e.mdxType,a=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=l(t),m=i,g=d["".concat(p,".").concat(m)]||d[m]||u[m]||a;return t?r.createElement(g,o(o({ref:n},c),{},{components:t})):r.createElement(g,o({ref:n},c))}));function m(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var a=t.length,o=new Array(a);o[0]=d;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s.mdxType="string"==typeof e?e:i,o[1]=s;for(var l=2;l{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>o,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=t(87462),i=(t(67294),t(3905));const a={},o="Configure Resource Specification",s={unversionedId:"user-guides/working-with-k8s/resource-spec",id:"version-v0.10/user-guides/working-with-k8s/resource-spec",title:"Configure Resource Specification",description:"You can manage container-level resource specification in the AppConfiguration model via the resources field (under the Container schema).",source:"@site/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/5-resource-spec.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/resource-spec",permalink:"/docs/v0.10/user-guides/working-with-k8s/resource-spec",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/5-resource-spec.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:5,frontMatter:{},sidebar:"kusion",previous:{title:"Upgrade Image",permalink:"/docs/v0.10/user-guides/working-with-k8s/image-upgrade"},next:{title:"Set up Operational Rules",permalink:"/docs/v0.10/user-guides/working-with-k8s/set-up-operational-rules"}},p={},l=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],c={toc:l};function u(e){let{components:n,...t}=e;return(0,i.kt)("wrapper",(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"configure-resource-specification"},"Configure Resource Specification"),(0,i.kt)("p",null,"You can manage container-level resource specification in the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model via the ",(0,i.kt)("inlineCode",{parentName:"p"},"resources")," field (under the ",(0,i.kt)("inlineCode",{parentName:"p"},"Container")," schema)."),(0,i.kt)("p",null,"For the full ",(0,i.kt)("inlineCode",{parentName:"p"},"Container")," schema reference, please see ",(0,i.kt)("a",{parentName:"p",href:"../../reference/modules/catalog-models/workload/service#schema-container"},"here")," for more details."),(0,i.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,i.kt)("p",null,"Please refer to the ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,i.kt)("p",null,"The example below also requires you to have ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,i.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,i.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,i.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,i.kt)("h2",{id:"example"},"Example"),(0,i.kt)("p",null,"Update the resources value in ",(0,i.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-py"},'import catalog.models.schema.v1 as ac\n\nhelloworld: ac.AppConfiguration {\n workload.containers.helloworld: {\n ...\n # before:\n # resources: {\n # "cpu": "500m"\n # "memory": "512M"\n # }\n # after: \n resources: {\n "cpu": "250m"\n "memory": "256Mi"\n }\n ...\n }\n}\n')),(0,i.kt)("p",null,"Everything else in ",(0,i.kt)("inlineCode",{parentName:"p"},"main.k")," stay the same."),(0,i.kt)("h2",{id:"applying"},"Applying"),(0,i.kt)("p",null,"Re-run steps in ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", resource scaling is completed."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Intent in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private UnChanged\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Update\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS UnChanged v1:Service:simple-service:simple-service-dev-helloworld-private, skip \n SUCCESS Update apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \nUpdate apps/v1:Deployment:simple-service:simple-service-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,i.kt)("h2",{id:"validation"},"Validation"),(0,i.kt)("p",null,"We can verify the application container (in the deployment template) now has the updated resources attributes (cpu:250m, memory:256Mi) as defined in the container configuration:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"kubectl get deployment -n simple-service -o yaml\n...\n template:\n ...\n spec:\n containers:\n - env:\n ...\n image: gcr.io/google-samples/gb-frontend:v5\n ...\n resources:\n limits:\n cpu: 250m\n memory: 256Mi\n...\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/79507ce0.1fbd4fe6.js b/assets/js/79507ce0.1fbd4fe6.js new file mode 100644 index 00000000000..072c8681370 --- /dev/null +++ b/assets/js/79507ce0.1fbd4fe6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5932],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var r=t(67294);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var p=r.createContext({}),l=function(e){var n=r.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=l(e.components);return r.createElement(p.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},d=r.forwardRef((function(e,n){var t=e.components,i=e.mdxType,a=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=l(t),m=i,g=d["".concat(p,".").concat(m)]||d[m]||u[m]||a;return t?r.createElement(g,o(o({ref:n},c),{},{components:t})):r.createElement(g,o({ref:n},c))}));function m(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var a=t.length,o=new Array(a);o[0]=d;var s={};for(var p in n)hasOwnProperty.call(n,p)&&(s[p]=n[p]);s.originalType=e,s.mdxType="string"==typeof e?e:i,o[1]=s;for(var l=2;l{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>o,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=t(87462),i=(t(67294),t(3905));const a={},o="Configure Resource Specification",s={unversionedId:"user-guides/working-with-k8s/resource-spec",id:"version-v0.10/user-guides/working-with-k8s/resource-spec",title:"Configure Resource Specification",description:"You can manage container-level resource specification in the AppConfiguration model via the resources field (under the Container schema).",source:"@site/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/5-resource-spec.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/resource-spec",permalink:"/docs/v0.10/user-guides/working-with-k8s/resource-spec",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/5-resource-spec.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:5,frontMatter:{},sidebar:"kusion",previous:{title:"Upgrade Image",permalink:"/docs/v0.10/user-guides/working-with-k8s/image-upgrade"},next:{title:"Set up Operational Rules",permalink:"/docs/v0.10/user-guides/working-with-k8s/set-up-operational-rules"}},p={},l=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],c={toc:l};function u(e){let{components:n,...t}=e;return(0,i.kt)("wrapper",(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"configure-resource-specification"},"Configure Resource Specification"),(0,i.kt)("p",null,"You can manage container-level resource specification in the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model via the ",(0,i.kt)("inlineCode",{parentName:"p"},"resources")," field (under the ",(0,i.kt)("inlineCode",{parentName:"p"},"Container")," schema)."),(0,i.kt)("p",null,"For the full ",(0,i.kt)("inlineCode",{parentName:"p"},"Container")," schema reference, please see ",(0,i.kt)("a",{parentName:"p",href:"../../reference/modules/catalog-models/workload/service#schema-container"},"here")," for more details."),(0,i.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,i.kt)("p",null,"Please refer to the ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,i.kt)("p",null,"The example below also requires you to have ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,i.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,i.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,i.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,i.kt)("h2",{id:"example"},"Example"),(0,i.kt)("p",null,"Update the resources value in ",(0,i.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-py"},'import catalog.models.schema.v1 as ac\n\nhelloworld: ac.AppConfiguration {\n workload.containers.helloworld: {\n ...\n # before:\n # resources: {\n # "cpu": "500m"\n # "memory": "512M"\n # }\n # after: \n resources: {\n "cpu": "250m"\n "memory": "256Mi"\n }\n ...\n }\n}\n')),(0,i.kt)("p",null,"Everything else in ",(0,i.kt)("inlineCode",{parentName:"p"},"main.k")," stay the same."),(0,i.kt)("h2",{id:"applying"},"Applying"),(0,i.kt)("p",null,"Re-run steps in ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", resource scaling is completed."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Intent in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private UnChanged\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Update\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS UnChanged v1:Service:simple-service:simple-service-dev-helloworld-private, skip \n SUCCESS Update apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \nUpdate apps/v1:Deployment:simple-service:simple-service-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,i.kt)("h2",{id:"validation"},"Validation"),(0,i.kt)("p",null,"We can verify the application container (in the deployment template) now has the updated resources attributes (cpu:250m, memory:256Mi) as defined in the container configuration:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"kubectl get deployment -n simple-service -o yaml\n...\n template:\n ...\n spec:\n containers:\n - env:\n ...\n image: gcr.io/google-samples/gb-frontend:v5\n ...\n resources:\n limits:\n cpu: 250m\n memory: 256Mi\n...\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7a493ae1.74a76dca.js b/assets/js/7a493ae1.b805c274.js similarity index 52% rename from assets/js/7a493ae1.74a76dca.js rename to assets/js/7a493ae1.b805c274.js index eb1460f55ba..c1d6fe7b956 100644 --- a/assets/js/7a493ae1.74a76dca.js +++ b/assets/js/7a493ae1.b805c274.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5623],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,p=a(e,["components","mdxType","originalType","parentName"]),f=l(n),m=o,d=f["".concat(c,".").concat(m)]||f[m]||u[m]||i;return n?r.createElement(d,s(s({ref:t},p),{},{components:n})):r.createElement(d,s({ref:t},p))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,s=new Array(i);s[0]=f;var a={};for(var c in t)hasOwnProperty.call(t,c)&&(a[c]=t[c]);a.originalType=e,a.mdxType="string"==typeof e?e:o,s[1]=a;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>i,metadata:()=>a,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const i={},s="kusion config list",a={unversionedId:"reference/commands/kusion-config-list",id:"version-v0.11/reference/commands/kusion-config-list",title:"kusion config list",description:"List all config items",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-config-list.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-config-list",permalink:"/docs/reference/commands/kusion-config-list",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-config-list.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion config get",permalink:"/docs/reference/commands/kusion-config-get"},next:{title:"kusion config set",permalink:"/docs/reference/commands/kusion-config-set"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-config-list"},"kusion config list"),(0,o.kt)("p",null,"List all config items"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command lists all the kusion config items and their values."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion config list\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # List config items\n kusion config list\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for list\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-config"},"kusion config"),"\t - Interact with the Kusion config")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5623],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,p=a(e,["components","mdxType","originalType","parentName"]),f=l(n),d=o,m=f["".concat(c,".").concat(d)]||f[d]||u[d]||i;return n?r.createElement(m,s(s({ref:t},p),{},{components:n})):r.createElement(m,s({ref:t},p))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,s=new Array(i);s[0]=f;var a={};for(var c in t)hasOwnProperty.call(t,c)&&(a[c]=t[c]);a.originalType=e,a.mdxType="string"==typeof e?e:o,s[1]=a;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>i,metadata:()=>a,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const i={},s="kusion config list",a={unversionedId:"reference/commands/kusion-config-list",id:"version-v0.11/reference/commands/kusion-config-list",title:"kusion config list",description:"List all config items",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-config-list.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-config-list",permalink:"/docs/reference/commands/kusion-config-list",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-config-list.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion config get",permalink:"/docs/reference/commands/kusion-config-get"},next:{title:"kusion config set",permalink:"/docs/reference/commands/kusion-config-set"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-config-list"},"kusion config list"),(0,o.kt)("p",null,"List all config items"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command lists all the kusion config items and their values."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion config list\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # List config items\n kusion config list\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for list\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-config"},"kusion config"),"\t - Interact with the Kusion config")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7b7347a8.6b8a043b.js b/assets/js/7b7347a8.e9109b80.js similarity index 56% rename from assets/js/7b7347a8.6b8a043b.js rename to assets/js/7b7347a8.e9109b80.js index 1a28fe0d75d..e3c17ad9b09 100644 --- a/assets/js/7b7347a8.6b8a043b.js +++ b/assets/js/7b7347a8.e9109b80.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8607],{3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function s(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),p=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},u=function(e){var n=p(e.components);return r.createElement(c.Provider,{value:n},e.children)},l={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,u=a(e,["components","mdxType","originalType","parentName"]),f=p(t),m=o,d=f["".concat(c,".").concat(m)]||f[m]||l[m]||i;return t?r.createElement(d,s(s({ref:n},u),{},{components:t})):r.createElement(d,s({ref:n},u))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,s=new Array(i);s[0]=f;var a={};for(var c in n)hasOwnProperty.call(n,c)&&(a[c]=n[c]);a.originalType=e,a.mdxType="string"==typeof e?e:o,s[1]=a;for(var p=2;p{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>s,default:()=>l,frontMatter:()=>i,metadata:()=>a,toc:()=>p});var r=t(87462),o=(t(67294),t(3905));const i={},s="kusion config unset",a={unversionedId:"reference/commands/kusion-config-unset",id:"version-v0.11/reference/commands/kusion-config-unset",title:"kusion config unset",description:"Unset a config item",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-config-unset.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-config-unset",permalink:"/docs/reference/commands/kusion-config-unset",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-config-unset.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion config set",permalink:"/docs/reference/commands/kusion-config-set"},next:{title:"kusion config",permalink:"/docs/reference/commands/kusion-config"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],u={toc:p};function l(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-config-unset"},"kusion config unset"),(0,o.kt)("p",null,"Unset a config item"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command unsets a specified kusion config item, where the config item must be registered."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion config unset\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Unset a config item\n kusion config unset backends.mysql-pre.configs.port\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for unset\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-config"},"kusion config"),"\t - Interact with the Kusion config")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}l.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8607],{3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function s(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),p=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},u=function(e){var n=p(e.components);return r.createElement(c.Provider,{value:n},e.children)},l={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,u=a(e,["components","mdxType","originalType","parentName"]),f=p(t),m=o,d=f["".concat(c,".").concat(m)]||f[m]||l[m]||i;return t?r.createElement(d,s(s({ref:n},u),{},{components:t})):r.createElement(d,s({ref:n},u))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,s=new Array(i);s[0]=f;var a={};for(var c in n)hasOwnProperty.call(n,c)&&(a[c]=n[c]);a.originalType=e,a.mdxType="string"==typeof e?e:o,s[1]=a;for(var p=2;p{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>s,default:()=>l,frontMatter:()=>i,metadata:()=>a,toc:()=>p});var r=t(87462),o=(t(67294),t(3905));const i={},s="kusion config unset",a={unversionedId:"reference/commands/kusion-config-unset",id:"version-v0.11/reference/commands/kusion-config-unset",title:"kusion config unset",description:"Unset a config item",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-config-unset.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-config-unset",permalink:"/docs/reference/commands/kusion-config-unset",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-config-unset.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion config set",permalink:"/docs/reference/commands/kusion-config-set"},next:{title:"kusion config",permalink:"/docs/reference/commands/kusion-config"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],u={toc:p};function l(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-config-unset"},"kusion config unset"),(0,o.kt)("p",null,"Unset a config item"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command unsets a specified kusion config item, where the config item must be registered."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion config unset\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Unset a config item\n kusion config unset backends.mysql-pre.configs.port\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for unset\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-config"},"kusion config"),"\t - Interact with the Kusion config")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}l.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7c47ad75.4749175e.js b/assets/js/7c47ad75.4749175e.js deleted file mode 100644 index 10aca953b9d..00000000000 --- a/assets/js/7c47ad75.4749175e.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[191],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),d=s(n),m=a,f=d["".concat(p,".").concat(m)]||d[m]||u[m]||o;return n?r.createElement(f,l(l({ref:t},c),{},{components:n})):r.createElement(f,l({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=d;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>s});var r=n(87462),a=(n(67294),n(3905));const o={},l="appconfiguration",i={unversionedId:"reference/modules/developer-schemas/app-configuration",id:"reference/modules/developer-schemas/app-configuration",title:"appconfiguration",description:"Schema AppConfiguration",source:"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/app-configuration.md",sourceDirName:"6-reference/2-modules/1-developer-schemas",slug:"/reference/modules/developer-schemas/app-configuration",permalink:"/docs/next/reference/modules/developer-schemas/app-configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/1-developer-schemas/app-configuration.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Kusion Modules",permalink:"/docs/next/reference/modules/"},next:{title:"mysql",permalink:"/docs/next/reference/modules/developer-schemas/database/mysql"}},p={},s=[{value:"Schema AppConfiguration",id:"schema-appconfiguration",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],c={toc:s};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"appconfiguration"},"appconfiguration"),(0,a.kt)("h2",{id:"schema-appconfiguration"},"Schema AppConfiguration"),(0,a.kt)("p",null,"AppConfiguration is a developer-centric definition that describes how to run an Application.",(0,a.kt)("br",null),"This application model builds upon a decade of experience at AntGroup running super large scale",(0,a.kt)("br",null),"internal developer platform, combined with best-of-breed ideas and practices from the community."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"accessories")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:any}"),(0,a.kt)("td",{parentName:"tr",align:null},"Accessories defines a collection of accessories that will be attached to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{}")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Annotations are key/value pairs that attach arbitrary non-identifying metadata to resources."),(0,a.kt)("td",{parentName:"tr",align:null},"{}")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Labels can be used to attach arbitrary metadata as key-value pairs to resources."),(0,a.kt)("td",{parentName:"tr",align:null},"{}")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"workload")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"workload/service#schema-service"},"wl.Service")," ","|"," ",(0,a.kt)("a",{parentName:"td",href:"workload/job#schema-job"},"wl.Job")),(0,a.kt)("td",{parentName:"tr",align:null},"Workload defines how to run your application code. Currently supported workload profile",(0,a.kt)("br",null),"includes Service and Job."),(0,a.kt)("td",{parentName:"tr",align:null},"N/A")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'# Instantiate an App with a long-running service and its image is "nginx:v1"\n\nimport kam as ac\nimport kam.workload as wl\nimport kam.workload.container as c\n\nhelloworld : ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "nginx": c.Container {\n image: "nginx:v1"\n }\n }\n }\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7c47ad75.ad260db1.js b/assets/js/7c47ad75.ad260db1.js new file mode 100644 index 00000000000..a419c5e3ada --- /dev/null +++ b/assets/js/7c47ad75.ad260db1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[191],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),d=s(n),m=a,f=d["".concat(p,".").concat(m)]||d[m]||u[m]||o;return n?r.createElement(f,l(l({ref:t},c),{},{components:n})):r.createElement(f,l({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=d;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>s});var r=n(87462),a=(n(67294),n(3905));const o={},l="appconfiguration",i={unversionedId:"reference/modules/developer-schemas/app-configuration",id:"reference/modules/developer-schemas/app-configuration",title:"appconfiguration",description:"Schema AppConfiguration",source:"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/app-configuration.md",sourceDirName:"6-reference/2-modules/1-developer-schemas",slug:"/reference/modules/developer-schemas/app-configuration",permalink:"/docs/next/reference/modules/developer-schemas/app-configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/1-developer-schemas/app-configuration.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Kusion Modules",permalink:"/docs/next/reference/modules/"},next:{title:"mysql",permalink:"/docs/next/reference/modules/developer-schemas/database/mysql"}},p={},s=[{value:"Schema AppConfiguration",id:"schema-appconfiguration",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],c={toc:s};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"appconfiguration"},"appconfiguration"),(0,a.kt)("h2",{id:"schema-appconfiguration"},"Schema AppConfiguration"),(0,a.kt)("p",null,"AppConfiguration is a developer-centric definition that describes how to run an Application.",(0,a.kt)("br",null),"This application model builds upon a decade of experience at AntGroup running super large scale",(0,a.kt)("br",null),"internal developer platform, combined with best-of-breed ideas and practices from the community."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"accessories")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:any}"),(0,a.kt)("td",{parentName:"tr",align:null},"Accessories defines a collection of accessories that will be attached to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{}")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Annotations are key/value pairs that attach arbitrary non-identifying metadata to resources."),(0,a.kt)("td",{parentName:"tr",align:null},"{}")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Labels can be used to attach arbitrary metadata as key-value pairs to resources."),(0,a.kt)("td",{parentName:"tr",align:null},"{}")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"workload")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"workload/service#schema-service"},"wl.Service")," ","|"," ",(0,a.kt)("a",{parentName:"td",href:"workload/job#schema-job"},"wl.Job")),(0,a.kt)("td",{parentName:"tr",align:null},"Workload defines how to run your application code. Currently supported workload profile",(0,a.kt)("br",null),"includes Service and Job."),(0,a.kt)("td",{parentName:"tr",align:null},"N/A")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'# Instantiate an App with a long-running service and its image is "nginx:v1"\n\nimport kam as ac\nimport kam.workload as wl\nimport kam.workload.container as c\n\nhelloworld : ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "nginx": c.Container {\n image: "nginx:v1"\n }\n }\n }\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7d99d243.54012244.js b/assets/js/7d99d243.d6656fe6.js similarity index 85% rename from assets/js/7d99d243.54012244.js rename to assets/js/7d99d243.d6656fe6.js index c5e434348d2..59626560f52 100644 --- a/assets/js/7d99d243.54012244.js +++ b/assets/js/7d99d243.d6656fe6.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7214],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(c[n]=e[n]);return c}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n])}return c}var s=r.createContext({}),l=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,c=e.mdxType,o=e.originalType,s=e.parentName,p=a(e,["components","mdxType","originalType","parentName"]),d=l(n),m=c,f=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function m(e,t){var n=arguments,c=t&&t.mdxType;if("string"==typeof e||c){var o=n.length,i=new Array(o);i[0]=d;var a={};for(var s in t)hasOwnProperty.call(t,s)&&(a[s]=t[s]);a.originalType=e,a.mdxType="string"==typeof e?e:c,i[1]=a;for(var l=2;l{n.r(t),n.d(t,{assets:()=>x,contentTitle:()=>k,default:()=>N,frontMatter:()=>O,metadata:()=>E,toc:()=>j});var r=n(87462),c=n(67294),o=n(3905),i=n(86010),a=n(53438),s=n(39960),l=n(13919),p=n(95999);const u="cardContainer_fWXF",d="cardTitle_rnsV",m="cardDescription_PWke";function f(e){let{href:t,children:n}=e;return c.createElement(s.Z,{href:t,className:(0,i.Z)("card padding--lg",u)},n)}function y(e){let{href:t,icon:n,title:r,description:o}=e;return c.createElement(f,{href:t},c.createElement("h2",{className:(0,i.Z)("text--truncate",d),title:r},n," ",r),o&&c.createElement("p",{className:(0,i.Z)("text--truncate",m),title:o},o))}function h(e){let{item:t}=e;const n=(0,a.Wl)(t);return n?c.createElement(y,{href:n,icon:"\ud83d\uddc3\ufe0f",title:t.label,description:t.description??(0,p.I)({message:"{count} items",id:"theme.docs.DocCard.categoryDescription",description:"The default description for a category card in the generated index about how many items this category includes"},{count:t.items.length})}):null}function v(e){let{item:t}=e;const n=(0,l.Z)(t.href)?"\ud83d\udcc4\ufe0f":"\ud83d\udd17",r=(0,a.xz)(t.docId??void 0);return c.createElement(y,{href:t.href,icon:n,title:t.label,description:t.description??(null==r?void 0:r.description)})}function b(e){let{item:t}=e;switch(t.type){case"link":return c.createElement(v,{item:t});case"category":return c.createElement(h,{item:t});default:throw new Error(`unknown item type ${JSON.stringify(t)}`)}}function g(e){let{className:t}=e;const n=(0,a.jA)();return c.createElement(w,{items:n.items,className:t})}function w(e){const{items:t,className:n}=e;if(!t)return c.createElement(g,e);const r=(0,a.MN)(t);return c.createElement("section",{className:(0,i.Z)("row",n)},r.map(((e,t)=>c.createElement("article",{key:t,className:"col col--6 margin-bottom--lg"},c.createElement(b,{item:e})))))}const O={},k="Concepts",E={unversionedId:"concepts/index",id:"version-v0.9/concepts/index",title:"Concepts",description:"In this section, we will introduce the architecture of KusionStack and some core concepts.",source:"@site/docs_versioned_docs/version-v0.9/concepts/index.md",sourceDirName:"concepts",slug:"/concepts/",permalink:"/docs/v0.9/concepts/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/concepts/index.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Deliver the WordPress Application on Kubernetes",permalink:"/docs/v0.9/getting-started/deliver-wordpress"},next:{title:"Architecture",permalink:"/docs/v0.9/concepts/arch"}},x={},j=[],P={toc:j};function N(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},P,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"concepts"},"Concepts"),(0,o.kt)("p",null,"In this section, we will introduce the architecture of KusionStack and some core concepts."),(0,o.kt)(w,{mdxType:"DocCardList"}))}N.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7214],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function c(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(c[n]=e[n]);return c}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(c[n]=e[n])}return c}var s=r.createContext({}),l=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,c=e.mdxType,o=e.originalType,s=e.parentName,p=a(e,["components","mdxType","originalType","parentName"]),d=l(n),m=c,f=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function m(e,t){var n=arguments,c=t&&t.mdxType;if("string"==typeof e||c){var o=n.length,i=new Array(o);i[0]=d;var a={};for(var s in t)hasOwnProperty.call(t,s)&&(a[s]=t[s]);a.originalType=e,a.mdxType="string"==typeof e?e:c,i[1]=a;for(var l=2;l{n.r(t),n.d(t,{assets:()=>x,contentTitle:()=>k,default:()=>D,frontMatter:()=>O,metadata:()=>E,toc:()=>j});var r=n(87462),c=n(67294),o=n(3905),i=n(86010),a=n(53438),s=n(39960),l=n(13919),p=n(95999);const u="cardContainer_fWXF",d="cardTitle_rnsV",m="cardDescription_PWke";function f(e){let{href:t,children:n}=e;return c.createElement(s.Z,{href:t,className:(0,i.Z)("card padding--lg",u)},n)}function y(e){let{href:t,icon:n,title:r,description:o}=e;return c.createElement(f,{href:t},c.createElement("h2",{className:(0,i.Z)("text--truncate",d),title:r},n," ",r),o&&c.createElement("p",{className:(0,i.Z)("text--truncate",m),title:o},o))}function h(e){let{item:t}=e;const n=(0,a.Wl)(t);return n?c.createElement(y,{href:n,icon:"\ud83d\uddc3\ufe0f",title:t.label,description:t.description??(0,p.I)({message:"{count} items",id:"theme.docs.DocCard.categoryDescription",description:"The default description for a category card in the generated index about how many items this category includes"},{count:t.items.length})}):null}function v(e){let{item:t}=e;const n=(0,l.Z)(t.href)?"\ud83d\udcc4\ufe0f":"\ud83d\udd17",r=(0,a.xz)(t.docId??void 0);return c.createElement(y,{href:t.href,icon:n,title:t.label,description:t.description??(null==r?void 0:r.description)})}function b(e){let{item:t}=e;switch(t.type){case"link":return c.createElement(v,{item:t});case"category":return c.createElement(h,{item:t});default:throw new Error(`unknown item type ${JSON.stringify(t)}`)}}function g(e){let{className:t}=e;const n=(0,a.jA)();return c.createElement(w,{items:n.items,className:t})}function w(e){const{items:t,className:n}=e;if(!t)return c.createElement(g,e);const r=(0,a.MN)(t);return c.createElement("section",{className:(0,i.Z)("row",n)},r.map(((e,t)=>c.createElement("article",{key:t,className:"col col--6 margin-bottom--lg"},c.createElement(b,{item:e})))))}const O={},k="Concepts",E={unversionedId:"concepts/index",id:"version-v0.9/concepts/index",title:"Concepts",description:"In this section, we will introduce the architecture of KusionStack and some core concepts.",source:"@site/docs_versioned_docs/version-v0.9/concepts/index.md",sourceDirName:"concepts",slug:"/concepts/",permalink:"/docs/v0.9/concepts/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/concepts/index.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Deliver the WordPress Application on Kubernetes",permalink:"/docs/v0.9/getting-started/deliver-wordpress"},next:{title:"Architecture",permalink:"/docs/v0.9/concepts/arch"}},x={},j=[],P={toc:j};function D(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},P,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"concepts"},"Concepts"),(0,o.kt)("p",null,"In this section, we will introduce the architecture of KusionStack and some core concepts."),(0,o.kt)(w,{mdxType:"DocCardList"}))}D.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7dad11d2.dad942d9.js b/assets/js/7dad11d2.dad942d9.js deleted file mode 100644 index 124bdd09d37..00000000000 --- a/assets/js/7dad11d2.dad942d9.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6956],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>u});var i=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=i.createContext({}),p=function(e){var t=i.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},c=function(e){var t=p(e.components);return i.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},m=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),m=p(n),u=a,k=m["".concat(l,".").concat(u)]||m[u]||d[u]||o;return n?i.createElement(k,r(r({ref:t},c),{},{components:n})):i.createElement(k,r({ref:t},c))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,r=new Array(o);r[0]=m;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,r[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var i=n(87462),a=(n(67294),n(3905));const o={id:"configuration",sidebar_label:"Configuration"},r="Configuration",s={unversionedId:"concepts/configuration",id:"concepts/configuration",title:"Configuration",description:"Kusion can be configured with some global settings, which are separate from the AppConfiguration written by the application developers and the workspace configurations written by the platform engineers.",source:"@site/docs/kusion/3-concepts/8-configuration.md",sourceDirName:"3-concepts",slug:"/concepts/configuration",permalink:"/docs/next/concepts/configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/3-concepts/8-configuration.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:8,frontMatter:{id:"configuration",sidebar_label:"Configuration"},sidebar:"kusion",previous:{title:"Backend",permalink:"/docs/next/concepts/backend"},next:{title:"How Kusion Works?",permalink:"/docs/next/concepts/how-kusion-works"}},l={},p=[{value:"Configuration Management",id:"configuration-management",level:2},{value:"Get a Specified Configuration Item",id:"get-a-specified-configuration-item",level:3},{value:"List the Configuration Items",id:"list-the-configuration-items",level:3},{value:"Set a Specified Configuration Item",id:"set-a-specified-configuration-item",level:3},{value:"Unset a Specified Configuration Item",id:"unset-a-specified-configuration-item",level:3},{value:"Backend Configurations",id:"backend-configurations",level:2},{value:"Available Configuration Items",id:"available-configuration-items",level:3}],c={toc:p};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,i.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"configuration"},"Configuration"),(0,a.kt)("p",null,"Kusion can be configured with some global settings, which are separate from the AppConfiguration written by the application developers and the workspace configurations written by the platform engineers. "),(0,a.kt)("p",null,"The configurations are only relevant to the Kusion itself, and can be managed by command ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion config"),". The configuration items are specified, which are in the hierarchical format with full stop for segmentation, such as ",(0,a.kt)("inlineCode",{parentName:"p"},"backends.current"),". For now, only the backend configurations are included."),(0,a.kt)("p",null,"The configuration is stored in the file ",(0,a.kt)("inlineCode",{parentName:"p"},"${KUSION_HOME}/config.yaml"),". For sensitive data, such as password, access key id and secret, setting them in the configuration file is not recommended, using the corresponding environment variables is safer. "),(0,a.kt)("h2",{id:"configuration-management"},"Configuration Management"),(0,a.kt)("p",null,"Kusion provides the command ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion config"),", and its sub-commands ",(0,a.kt)("inlineCode",{parentName:"p"},"get"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"list"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"set"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"unset")," to manage the configuration. The usages are shown as below:"),(0,a.kt)("h3",{id:"get-a-specified-configuration-item"},"Get a Specified Configuration Item"),(0,a.kt)("p",null,"Use ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion config get")," to get the value of a specified configuration item, only the registered item can be obtained correctly. The example is as below."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"# get a configuration item\nkusion config get backends.current\n")),(0,a.kt)("h3",{id:"list-the-configuration-items"},"List the Configuration Items"),(0,a.kt)("p",null,"Use ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion config list")," to list all the Kusion configurations, where the result is in the YAML format. The example is as below."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"# list all the Kusion configurations\nkusion config list\n")),(0,a.kt)("h3",{id:"set-a-specified-configuration-item"},"Set a Specified Configuration Item"),(0,a.kt)("p",null,"Use ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion config set")," to set the value of a specified configuration item, where the type of the value of is also determinate. Kusion supports ",(0,a.kt)("inlineCode",{parentName:"p"},"string"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"int"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"bool"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"array")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"map")," as the value type, which should be conveyed in the following format through CLI."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"string"),": the original format, such as ",(0,a.kt)("inlineCode",{parentName:"li"},"local-dev"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"oss-pre"),";"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"int"),": convert to string, such as ",(0,a.kt)("inlineCode",{parentName:"li"},"3306"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"80"),";"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"bool"),": convert to string, only support ",(0,a.kt)("inlineCode",{parentName:"li"},"true")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"false"),";"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"array"),": convert to string with JSON marshal, such as ",(0,a.kt)("inlineCode",{parentName:"li"},'\'["mysql","oss"]\''),". To preserve the format, enclosing the string content in single quotes is a good idea, or there may be unexpected errors;"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"map"),": convert to string with JSON marshal, such as ",(0,a.kt)("inlineCode",{parentName:"li"},'\'{"path":"\\etc"}\''),".")),(0,a.kt)("p",null,"Besides the type, some configuration items have more setting requirements. The configuration item dependency may exist, that is, a configuration item must be set after another item. And there may exist more restrictions for the configuration values themselves. For example, the valid keys for the map type value, the data range for the int type value. For detailed configuration item information, please refer to the following content of this article."),(0,a.kt)("p",null,"The example of setting configuration item is as blow."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},'# set a configuration item of type string\nkusion config set backends.pre.type mysql\n\n# set a configuration item of type int\nkusion config set backends.pre.configs.port 3306\n\n# set a configuration item of type map\nkusion config set backends.prod `{"configs":{"bucket":"kusion"},"type":"s3"}`\n')),(0,a.kt)("h3",{id:"unset-a-specified-configuration-item"},"Unset a Specified Configuration Item"),(0,a.kt)("p",null,"Use ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion config unset")," to unset a specified configuration item. Be attention, some items have dependencies, which must be unset in a correct order. The example is as below."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"# unset a specified configuration item\nkusion config unset backends.pre\n")),(0,a.kt)("h2",{id:"backend-configurations"},"Backend Configurations"),(0,a.kt)("p",null,"The backend configurations define the place to store Workspace, Spec and State files. Multiple backends and current backend are supported to set."),(0,a.kt)("h3",{id:"available-configuration-items"},"Available Configuration Items"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.current"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the current used backend name. It can be set as the configured backend name. If not set, the default local backend will be used."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"map"),", a total backend configuration, contains type and config items, whose format is as below. It can be unset when the backend is not the current.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'{\n "type": "${backend_type}", # type string, required, support local, mysql, oss, s3.\n "configs": ${backend_configs} # type map, optional for type local, required for the others, the specific keys depend on the type, refer to the description of backends.${name}.configs.\n}\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.type"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the backend type, support ",(0,a.kt)("inlineCode",{parentName:"li"},"local"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"mysql"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"s3")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"oss"),". It can be unset when the backend is not the current, and the corresponding ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.configs")," are empty."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"map"),", the backend config items, whose format depends on the backend type and is as below. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type"),".")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'# type local\n{\n "path": "${local_path}" # type string, optional, the directory to store the files. If not set, use the default path ${KUSION_HOME}.\n}\n\n# type mysql\n {\n "dbName": "${mysql_db_name}", # type string, required, the database name.\n "user": "${mysql_user}", # type string, required, the database user.\n "password": "${mysql_password}", # type string, optional, the database password, which can be also obtained by environment variable KUSION_BACKEND_MYSQL_PASSWORD.\n "host": "${mysql_host}", # type string, required, the database host.\n "port": "${mysql_port}" # type string, optional, the database port. If not set, use the default port 3306.\n }\n\n# type oss\n {\n "endpoint": "${oss_endpoint}", # type string, required, the oss endpoint.\n "accessKeyID": "${oss_access_key_id}", # type string, optional, the oss access key id, which can be also obtained by environment variable OSS_ACCESS_KEY_ID.\n "accessKeySecret": "${oss_access_key_secret}", # type string, optional, the oss access key secret, which can be also obtained by environment variable OSS_ACCESS_KEY_SECRET\n "bucket": "${oss_bucket}", # type string, required, the oss bucket.\n "prefix": "${oss_prefix}" # type string, optional, the prefix to store the files.\n }\n\n # type s3\n {\n "region": "${s3_region}", # type string, optional, the aws region, which can be also obtained by environment variables AWS_REGION and AWS_DEFAULT_REGION.\n "endpoint": "${s3_endpoint}", # type string, optional, the aws endpoint. \n "accessKeyID": "${s3_access_key_id}", # type string, optional, the aws access key id, which can be also obtained by environment variable AWS_ACCESS_KEY_ID.\n "accessKeySecret": "${s3_access_key_secret}", # type string, optional, the aws access key secret, which can be also obtained by environment variable AWS_SECRET_ACCESS_KEY\n "bucket": "${s3_bucket}", # type string, required, the s3 bucket.\n "prefix": "${s3_prefix}" # type string, optional, the prefix to store the files.\n }\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.path"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the path of local type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"local"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.dbName"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the database name of mysql type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"mysql"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.user"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the database user of mysql type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"mysql"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.password"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the database password of mysql type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"mysql"),". It can be also obtained by environment variable ",(0,a.kt)("inlineCode",{parentName:"li"},"KUSION_BACKEND_MYSQL_PASSWORD"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.host"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the database host of mysql type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"mysql"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.port"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"int"),", the database port of mysql type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"mysql"),". If not set, the default value ",(0,a.kt)("inlineCode",{parentName:"li"},"3306")," will be used."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.endpoint"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the endpoint of oss or s3 type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"oss")," or ",(0,a.kt)("inlineCode",{parentName:"li"},"s3"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.accessKeyID"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the access key id of oss or s3 type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"oss")," or ",(0,a.kt)("inlineCode",{parentName:"li"},"s3"),". For ",(0,a.kt)("inlineCode",{parentName:"li"},"oss"),", it can be also obtained by environment variable ",(0,a.kt)("inlineCode",{parentName:"li"},"OSS_ACCESS_KEY_ID"),"; while for s3, it is ",(0,a.kt)("inlineCode",{parentName:"li"},"AWS_ACCESS_KEY_ID"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.accessKeySecret"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the access key secret of oss or s3 type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"oss")," or ",(0,a.kt)("inlineCode",{parentName:"li"},"s3"),". For ",(0,a.kt)("inlineCode",{parentName:"li"},"oss"),", it can be also obtained by environment variable ",(0,a.kt)("inlineCode",{parentName:"li"},"OSS_ACCESS_KEY_SECRET"),"; while for s3, it is ",(0,a.kt)("inlineCode",{parentName:"li"},"AWS_SECRET_ACCESS_KEY"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.bucket"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the bucket of oss or s3 type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"oss")," or ",(0,a.kt)("inlineCode",{parentName:"li"},"s3"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.prefix"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the prefix to store the files of oss or s3 type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"oss")," or ",(0,a.kt)("inlineCode",{parentName:"li"},"s3"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.region"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the aws region of s3 type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"s3"),". It can be also obtained by environment variables ",(0,a.kt)("inlineCode",{parentName:"li"},"AWS_REGION")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"AWS_DEFAULT_REGION"),", where the former is priority.")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7dad11d2.fef3060c.js b/assets/js/7dad11d2.fef3060c.js new file mode 100644 index 00000000000..44e8eaa318b --- /dev/null +++ b/assets/js/7dad11d2.fef3060c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6956],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>u});var i=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=i.createContext({}),p=function(e){var t=i.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},c=function(e){var t=p(e.components);return i.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},m=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),m=p(n),u=a,k=m["".concat(l,".").concat(u)]||m[u]||d[u]||o;return n?i.createElement(k,r(r({ref:t},c),{},{components:n})):i.createElement(k,r({ref:t},c))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,r=new Array(o);r[0]=m;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,r[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var i=n(87462),a=(n(67294),n(3905));const o={id:"configuration",sidebar_label:"Configuration"},r="Configuration",s={unversionedId:"concepts/configuration",id:"concepts/configuration",title:"Configuration",description:"Kusion can be configured with some global settings, which are separate from the AppConfiguration written by the application developers and the workspace configurations written by the platform engineers.",source:"@site/docs/kusion/3-concepts/8-configuration.md",sourceDirName:"3-concepts",slug:"/concepts/configuration",permalink:"/docs/next/concepts/configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/3-concepts/8-configuration.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:8,frontMatter:{id:"configuration",sidebar_label:"Configuration"},sidebar:"kusion",previous:{title:"Backend",permalink:"/docs/next/concepts/backend"},next:{title:"How Kusion Works?",permalink:"/docs/next/concepts/how-kusion-works"}},l={},p=[{value:"Configuration Management",id:"configuration-management",level:2},{value:"Get a Specified Configuration Item",id:"get-a-specified-configuration-item",level:3},{value:"List the Configuration Items",id:"list-the-configuration-items",level:3},{value:"Set a Specified Configuration Item",id:"set-a-specified-configuration-item",level:3},{value:"Unset a Specified Configuration Item",id:"unset-a-specified-configuration-item",level:3},{value:"Backend Configurations",id:"backend-configurations",level:2},{value:"Available Configuration Items",id:"available-configuration-items",level:3}],c={toc:p};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,i.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"configuration"},"Configuration"),(0,a.kt)("p",null,"Kusion can be configured with some global settings, which are separate from the AppConfiguration written by the application developers and the workspace configurations written by the platform engineers. "),(0,a.kt)("p",null,"The configurations are only relevant to the Kusion itself, and can be managed by command ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion config"),". The configuration items are specified, which are in the hierarchical format with full stop for segmentation, such as ",(0,a.kt)("inlineCode",{parentName:"p"},"backends.current"),". For now, only the backend configurations are included."),(0,a.kt)("p",null,"The configuration is stored in the file ",(0,a.kt)("inlineCode",{parentName:"p"},"${KUSION_HOME}/config.yaml"),". For sensitive data, such as password, access key id and secret, setting them in the configuration file is not recommended, using the corresponding environment variables is safer. "),(0,a.kt)("h2",{id:"configuration-management"},"Configuration Management"),(0,a.kt)("p",null,"Kusion provides the command ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion config"),", and its sub-commands ",(0,a.kt)("inlineCode",{parentName:"p"},"get"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"list"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"set"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"unset")," to manage the configuration. The usages are shown as below:"),(0,a.kt)("h3",{id:"get-a-specified-configuration-item"},"Get a Specified Configuration Item"),(0,a.kt)("p",null,"Use ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion config get")," to get the value of a specified configuration item, only the registered item can be obtained correctly. The example is as below."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"# get a configuration item\nkusion config get backends.current\n")),(0,a.kt)("h3",{id:"list-the-configuration-items"},"List the Configuration Items"),(0,a.kt)("p",null,"Use ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion config list")," to list all the Kusion configurations, where the result is in the YAML format. The example is as below."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"# list all the Kusion configurations\nkusion config list\n")),(0,a.kt)("h3",{id:"set-a-specified-configuration-item"},"Set a Specified Configuration Item"),(0,a.kt)("p",null,"Use ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion config set")," to set the value of a specified configuration item, where the type of the value of is also determinate. Kusion supports ",(0,a.kt)("inlineCode",{parentName:"p"},"string"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"int"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"bool"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"array")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"map")," as the value type, which should be conveyed in the following format through CLI."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"string"),": the original format, such as ",(0,a.kt)("inlineCode",{parentName:"li"},"local-dev"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"oss-pre"),";"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"int"),": convert to string, such as ",(0,a.kt)("inlineCode",{parentName:"li"},"3306"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"80"),";"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"bool"),": convert to string, only support ",(0,a.kt)("inlineCode",{parentName:"li"},"true")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"false"),";"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"array"),": convert to string with JSON marshal, such as ",(0,a.kt)("inlineCode",{parentName:"li"},'\'["mysql","oss"]\''),". To preserve the format, enclosing the string content in single quotes is a good idea, or there may be unexpected errors;"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"map"),": convert to string with JSON marshal, such as ",(0,a.kt)("inlineCode",{parentName:"li"},'\'{"path":"\\etc"}\''),".")),(0,a.kt)("p",null,"Besides the type, some configuration items have more setting requirements. The configuration item dependency may exist, that is, a configuration item must be set after another item. And there may exist more restrictions for the configuration values themselves. For example, the valid keys for the map type value, the data range for the int type value. For detailed configuration item information, please refer to the following content of this article."),(0,a.kt)("p",null,"The example of setting configuration item is as blow."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},'# set a configuration item of type string\nkusion config set backends.pre.type mysql\n\n# set a configuration item of type int\nkusion config set backends.pre.configs.port 3306\n\n# set a configuration item of type map\nkusion config set backends.prod `{"configs":{"bucket":"kusion"},"type":"s3"}`\n')),(0,a.kt)("h3",{id:"unset-a-specified-configuration-item"},"Unset a Specified Configuration Item"),(0,a.kt)("p",null,"Use ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion config unset")," to unset a specified configuration item. Be attention, some items have dependencies, which must be unset in a correct order. The example is as below."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"# unset a specified configuration item\nkusion config unset backends.pre\n")),(0,a.kt)("h2",{id:"backend-configurations"},"Backend Configurations"),(0,a.kt)("p",null,"The backend configurations define the place to store Workspace, Spec and State files. Multiple backends and current backend are supported to set."),(0,a.kt)("h3",{id:"available-configuration-items"},"Available Configuration Items"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.current"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the current used backend name. It can be set as the configured backend name. If not set, the default local backend will be used."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"map"),", a total backend configuration, contains type and config items, whose format is as below. It can be unset when the backend is not the current.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'{\n "type": "${backend_type}", # type string, required, support local, mysql, oss, s3.\n "configs": ${backend_configs} # type map, optional for type local, required for the others, the specific keys depend on the type, refer to the description of backends.${name}.configs.\n}\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.type"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the backend type, support ",(0,a.kt)("inlineCode",{parentName:"li"},"local"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"mysql"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"s3")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"oss"),". It can be unset when the backend is not the current, and the corresponding ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.configs")," are empty."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"map"),", the backend config items, whose format depends on the backend type and is as below. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type"),".")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'# type local\n{\n "path": "${local_path}" # type string, optional, the directory to store the files. If not set, use the default path ${KUSION_HOME}.\n}\n\n# type mysql\n {\n "dbName": "${mysql_db_name}", # type string, required, the database name.\n "user": "${mysql_user}", # type string, required, the database user.\n "password": "${mysql_password}", # type string, optional, the database password, which can be also obtained by environment variable KUSION_BACKEND_MYSQL_PASSWORD.\n "host": "${mysql_host}", # type string, required, the database host.\n "port": "${mysql_port}" # type string, optional, the database port. If not set, use the default port 3306.\n }\n\n# type oss\n {\n "endpoint": "${oss_endpoint}", # type string, required, the oss endpoint.\n "accessKeyID": "${oss_access_key_id}", # type string, optional, the oss access key id, which can be also obtained by environment variable OSS_ACCESS_KEY_ID.\n "accessKeySecret": "${oss_access_key_secret}", # type string, optional, the oss access key secret, which can be also obtained by environment variable OSS_ACCESS_KEY_SECRET\n "bucket": "${oss_bucket}", # type string, required, the oss bucket.\n "prefix": "${oss_prefix}" # type string, optional, the prefix to store the files.\n }\n\n # type s3\n {\n "region": "${s3_region}", # type string, optional, the aws region, which can be also obtained by environment variables AWS_REGION and AWS_DEFAULT_REGION.\n "endpoint": "${s3_endpoint}", # type string, optional, the aws endpoint. \n "accessKeyID": "${s3_access_key_id}", # type string, optional, the aws access key id, which can be also obtained by environment variable AWS_ACCESS_KEY_ID.\n "accessKeySecret": "${s3_access_key_secret}", # type string, optional, the aws access key secret, which can be also obtained by environment variable AWS_SECRET_ACCESS_KEY\n "bucket": "${s3_bucket}", # type string, required, the s3 bucket.\n "prefix": "${s3_prefix}" # type string, optional, the prefix to store the files.\n }\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.path"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the path of local type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"local"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.dbName"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the database name of mysql type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"mysql"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.user"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the database user of mysql type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"mysql"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.password"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the database password of mysql type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"mysql"),". It can be also obtained by environment variable ",(0,a.kt)("inlineCode",{parentName:"li"},"KUSION_BACKEND_MYSQL_PASSWORD"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.host"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the database host of mysql type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"mysql"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.port"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"int"),", the database port of mysql type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"mysql"),". If not set, the default value ",(0,a.kt)("inlineCode",{parentName:"li"},"3306")," will be used."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.endpoint"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the endpoint of oss or s3 type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"oss")," or ",(0,a.kt)("inlineCode",{parentName:"li"},"s3"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.accessKeyID"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the access key id of oss or s3 type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"oss")," or ",(0,a.kt)("inlineCode",{parentName:"li"},"s3"),". For ",(0,a.kt)("inlineCode",{parentName:"li"},"oss"),", it can be also obtained by environment variable ",(0,a.kt)("inlineCode",{parentName:"li"},"OSS_ACCESS_KEY_ID"),"; while for s3, it is ",(0,a.kt)("inlineCode",{parentName:"li"},"AWS_ACCESS_KEY_ID"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.accessKeySecret"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the access key secret of oss or s3 type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"oss")," or ",(0,a.kt)("inlineCode",{parentName:"li"},"s3"),". For ",(0,a.kt)("inlineCode",{parentName:"li"},"oss"),", it can be also obtained by environment variable ",(0,a.kt)("inlineCode",{parentName:"li"},"OSS_ACCESS_KEY_SECRET"),"; while for s3, it is ",(0,a.kt)("inlineCode",{parentName:"li"},"AWS_SECRET_ACCESS_KEY"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.bucket"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the bucket of oss or s3 type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"oss")," or ",(0,a.kt)("inlineCode",{parentName:"li"},"s3"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.prefix"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the prefix to store the files of oss or s3 type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"oss")," or ",(0,a.kt)("inlineCode",{parentName:"li"},"s3"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.region"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the aws region of s3 type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"s3"),". It can be also obtained by environment variables ",(0,a.kt)("inlineCode",{parentName:"li"},"AWS_REGION")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"AWS_DEFAULT_REGION"),", where the former is priority.")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7de5ceea.5445c664.js b/assets/js/7de5ceea.5445c664.js new file mode 100644 index 00000000000..0cdc36cccd0 --- /dev/null +++ b/assets/js/7de5ceea.5445c664.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8627],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,s=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(r),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||s;return r?n.createElement(f,a(a({ref:t},p),{},{components:r})):n.createElement(f,a({ref:t},p))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=r.length,a=new Array(s);a[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,a[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>s,metadata:()=>i,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const s={},a="kusion destroy",i={unversionedId:"reference/commands/kusion-destroy",id:"version-v0.11/reference/commands/kusion-destroy",title:"kusion destroy",description:"Destroy resources within the stack.",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-destroy.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-destroy",permalink:"/docs/reference/commands/kusion-destroy",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-destroy.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion config",permalink:"/docs/reference/commands/kusion-config"},next:{title:"kusion generate",permalink:"/docs/reference/commands/kusion-generate"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:l};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-destroy"},"kusion destroy"),(0,o.kt)("p",null,"Destroy resources within the stack."),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Destroy resources within the stack."),(0,o.kt)("p",null," Please note that the destroy command does NOT perform resource version checks. Therefore, if someone submits an update to a resource at the same time you execute a destroy command, their update will be lost along with the rest of the resource."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion destroy [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Delete resources of current stack\n kusion destroy\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string The backend to use, supports 'local', 'oss' and 's3'.\n -d, --detail Automatically show preview details after previewing it\n -h, --help help for destroy\n --no-style no-style sets to RawOutput mode and disables all of styling\n --operator string Specify the operator\n -w, --workdir string The work directory to run Kusion CLI.\n --workspace string The name of target workspace to operate in.\n -y, --yes Automatically approve and perform the update after previewing it\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7de5ceea.b2af9ad9.js b/assets/js/7de5ceea.b2af9ad9.js deleted file mode 100644 index 10977a0b899..00000000000 --- a/assets/js/7de5ceea.b2af9ad9.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8627],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,s=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(r),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||s;return r?n.createElement(f,a(a({ref:t},p),{},{components:r})):n.createElement(f,a({ref:t},p))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=r.length,a=new Array(s);a[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,a[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>s,metadata:()=>i,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const s={},a="kusion destroy",i={unversionedId:"reference/commands/kusion-destroy",id:"version-v0.11/reference/commands/kusion-destroy",title:"kusion destroy",description:"Destroy resources within the stack.",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-destroy.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-destroy",permalink:"/docs/reference/commands/kusion-destroy",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-destroy.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion config",permalink:"/docs/reference/commands/kusion-config"},next:{title:"kusion generate",permalink:"/docs/reference/commands/kusion-generate"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:l};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-destroy"},"kusion destroy"),(0,o.kt)("p",null,"Destroy resources within the stack."),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Destroy resources within the stack."),(0,o.kt)("p",null," Please note that the destroy command does NOT perform resource version checks. Therefore, if someone submits an update to a resource at the same time you execute a destroy command, their update will be lost along with the rest of the resource."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion destroy [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Delete resources of current stack\n kusion destroy\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string The backend to use, supports 'local', 'oss' and 's3'.\n -d, --detail Automatically show preview details after previewing it\n -h, --help help for destroy\n --no-style no-style sets to RawOutput mode and disables all of styling\n --operator string Specify the operator\n -w, --workdir string The work directory to run Kusion CLI.\n --workspace string The name of target workspace to operate in.\n -y, --yes Automatically approve and perform the update after previewing it\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/81f06d1d.223390d8.js b/assets/js/81f06d1d.223390d8.js new file mode 100644 index 00000000000..d911e8b91a0 --- /dev/null +++ b/assets/js/81f06d1d.223390d8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5835],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var o=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function r(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var p=o.createContext({}),s=function(e){var n=o.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):r(r({},n),e)),t},c=function(e){var n=s(e.components);return o.createElement(p.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},u=o.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(t),m=a,k=u["".concat(p,".").concat(m)]||u[m]||d[m]||i;return t?o.createElement(k,r(r({ref:n},c),{},{components:t})):o.createElement(k,r({ref:n},c))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,r=new Array(i);r[0]=u;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:a,r[1]=l;for(var s=2;s{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>r,default:()=>d,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var o=t(87462),a=(t(67294),t(3905));const i={},r="Workload",l={unversionedId:"configuration-walkthrough/workload",id:"version-v0.11/configuration-walkthrough/workload",title:"Workload",description:"The workload attribute in the AppConfiguration instance is used to describe the specification for the application workload. The application workload generally represents the computing component for the application.",source:"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/4-workload.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/workload",permalink:"/docs/configuration-walkthrough/workload",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/4-workload.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:4,frontMatter:{},sidebar:"kusion",previous:{title:"Base and Override",permalink:"/docs/configuration-walkthrough/base-override"},next:{title:"Application Networking",permalink:"/docs/configuration-walkthrough/networking"}},p={},s=[{value:"Table of Content",id:"table-of-content",level:2},{value:"Import",id:"import",level:2},{value:"Types of Workloads",id:"types-of-workloads",level:2},{value:"Configure containers",id:"configure-containers",level:2},{value:"Application image",id:"application-image",level:3},{value:"Resource Requirements",id:"resource-requirements",level:3},{value:"Health Probes",id:"health-probes",level:3},{value:"Lifecycle Hooks",id:"lifecycle-hooks",level:3},{value:"Create Files",id:"create-files",level:3},{value:"Customize container initialization",id:"customize-container-initialization",level:3},{value:"Configure Replicas",id:"configure-replicas",level:2},{value:"Differences between Service and Job",id:"differences-between-service-and-job",level:2},{value:"Exposure",id:"exposure",level:3},{value:"Job Schedule",id:"job-schedule",level:3},{value:"Workload References",id:"workload-references",level:2}],c={toc:s};function d(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,o.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"workload"},"Workload"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," attribute in the ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance is used to describe the specification for the application workload. The application workload generally represents the computing component for the application."),(0,a.kt)("p",null,"A ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," maps to an ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance 1:1. If there are more than one workload, they should be considered different applications."),(0,a.kt)("h2",{id:"table-of-content"},"Table of Content"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#import"},"Import")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#types-of-workloads"},"Types of workloads")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#configure-containers"},"Configure containers"),(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#application-image"},"Application image")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#resource-requirements"},"Resource Requirements")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#health-probes"},"Health Probes")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#lifecycle-hooks"},"Lifecycle Hooks")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#create-files"},"Create Files")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#customize-container-initialization"},"Customize container initialization")))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#configure-replicas"},"Configure Replicas")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#differences-between-service-and-job"},"Differences between Service and Job")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#workload-references"},"Workload References"))),(0,a.kt)("h2",{id:"import"},"Import"),(0,a.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,a.kt)("inlineCode",{parentName:"p"},"catalog")," package. For more details on KCL package import, please refer to the ",(0,a.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport kam.v1.workload.container.probe as p\nimport kam.v1.workload.container.lifecycle as lc\n")),(0,a.kt)("h2",{id:"types-of-workloads"},"Types of Workloads"),(0,a.kt)("p",null,"There are currently two types of workloads:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Service"),', representing a long-running, scalable workload type that should "never" go down and respond to short-lived latency-sensitive requests. This workload type is commonly used for web applications and services that expose APIs.'),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Job"),", representing batch tasks that take from a few seconds to days to complete and then stop. These are commonly used for batch processing that is less sensitive to short-term performance fluctuations.")),(0,a.kt)("p",null,"To instantiate a ",(0,a.kt)("inlineCode",{parentName:"p"},"Service"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {}\n}\n")),(0,a.kt)("p",null,"To instantiate a ",(0,a.kt)("inlineCode",{parentName:"p"},"Job"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Job {}\n}\n")),(0,a.kt)("p",null,"Of course, the ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instances above is not sufficient to describe an application. We still need to provide more details in the ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," section."),(0,a.kt)("h2",{id:"configure-containers"},"Configure containers"),(0,a.kt)("p",null,"Kusion is built on top of cloud-native philosophies. One of which is that applications should run as loosely coupled microservices on abstract and self-contained software units, such as containers."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"containers")," attribute in a workload instance is used to define the behavior for the containers that run application workload. The ",(0,a.kt)("inlineCode",{parentName:"p"},"containers")," attribute is a map, from the name of the container to the ",(0,a.kt)("inlineCode",{parentName:"p"},"catalog.models.schema.v1.workload.container.Container")," Object which includes the container configurations."),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"The name of the container is in the context of the configuration file, so you could refer to it later. It's not referring to the name of the container in the Kubernetes cluster (or any other runtime).")),(0,a.kt)("p",null,"Everything defined in the ",(0,a.kt)("inlineCode",{parentName:"p"},"containers")," attribute is considered an application container, as opposed to a sidecar container. Sidecar containers will be introduced in a different attribute in a future version."),(0,a.kt)("p",null,"In most of the cases, only one application container is needed. Ideally, we recommend mapping an ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance to a microservice in the microservice terminology."),(0,a.kt)("p",null,"We will walk through the details of configuring a container using an example of the ",(0,a.kt)("inlineCode",{parentName:"p"},"Service")," type."),(0,a.kt)("p",null,"To add an application container:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {}\n }\n }\n}\n')),(0,a.kt)("h3",{id:"application-image"},"Application image"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"image")," attribute in the ",(0,a.kt)("inlineCode",{parentName:"p"},"Container")," schema specifies the application image to run. This is the only required field in the ",(0,a.kt)("inlineCode",{parentName:"p"},"Container")," schema."),(0,a.kt)("p",null,"To specify an application image:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n }\n # ...\n }\n }\n}\n')),(0,a.kt)("h3",{id:"resource-requirements"},"Resource Requirements"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"resources")," attribute in the ",(0,a.kt)("inlineCode",{parentName:"p"},"Container")," schema specifies the application resource requirements such as cpu and memory."),(0,a.kt)("p",null,"You can specify an upper limit (which maps to resource limits only) or a range as the resource requirements (which maps to resource requests and limits in Kubernetes)."),(0,a.kt)("p",null,"To specify an upper bound (only resource limits):"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n # ...\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"To specify a range (both resource requests and limits):"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # Sets requests to cpu=250m and memory=256Mi\n # Sets limits to cpu=500m and memory=512Mi\n resources: {\n "cpu": "250m-500m"\n "memory": "256Mi-512Mi"\n }\n # ...\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"health-probes"},"Health Probes"),(0,a.kt)("p",null,"There are three types of ",(0,a.kt)("inlineCode",{parentName:"p"},"Probe")," defined in a ",(0,a.kt)("inlineCode",{parentName:"p"},"Container"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"livenessProbe")," - used to determine if the container is healthy and running"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"readinessProbe")," - used to determine if the container is ready to accept traffic"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"startupProbe")," - used to determine if the container has started properly. Liveness and readiness probes don't start until ",(0,a.kt)("inlineCode",{parentName:"li"},"startupProbe")," succeeds. Commonly used for containers that takes a while to start")),(0,a.kt)("p",null,"The probes are optional. You can only have one Probe of each kind for a given ",(0,a.kt)("inlineCode",{parentName:"p"},"Container"),"."),(0,a.kt)("p",null,"To configure a ",(0,a.kt)("inlineCode",{parentName:"p"},"Http")," type ",(0,a.kt)("inlineCode",{parentName:"p"},"readinessProbe")," that probes the health via HTTP request and a ",(0,a.kt)("inlineCode",{parentName:"p"},"Exec")," type ",(0,a.kt)("inlineCode",{parentName:"p"},"livenessProbe")," which executes a command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # ...\n # Configure an Http type readiness probe at /healthz\n readinessProbe: p.Probe {\n probeHandler: p.Http {\n url: "/healthz"\n }\n initialDelaySeconds: 10\n timeoutSeconds: 5\n periodSeconds: 15\n successThreshold: 3\n failureThreshold: 1\n }\n # Configure an Exec type liveness probe that executes probe.sh\n livenessProbe: p.Probe {\n probeHandler: p.Exec {\n command: ["probe.sh"]\n }\n initialDelaySeconds: 10\n }\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"lifecycle-hooks"},"Lifecycle Hooks"),(0,a.kt)("p",null,"You can also configure lifecycle hooks that triggers in response to container lifecycle events such as liveness/startup probe failure, preemption, resource contention, etc."),(0,a.kt)("p",null,"There are two types that is currently supported:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"PreStop")," - triggers before the container is terminated."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"PostStart")," - triggers after the container is initialized.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # ...\n # Configure lifecycle hooks\n lifecycle: lc.Lifecycle {\n # Configures an Exec type pre-stop hook that executes preStop.sh\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n # Configures an Http type pre-stop hook at /post-start\n postStart: p.Http {\n url: "/post-start"\n }\n }\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"create-files"},"Create Files"),(0,a.kt)("p",null,"You can also create files on-demand during the container initialization."),(0,a.kt)("p",null,"To create a custom file and mount it to ",(0,a.kt)("inlineCode",{parentName:"p"},"/home/admin/my-file")," when the container starts:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n }\n # ...\n # Creates a file during container startup\n files: {\n "/home/admin/my-file": c.FileSpec {\n content: "some file contents"\n mode: "0777"\n }\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"customize-container-initialization"},"Customize container initialization"),(0,a.kt)("p",null,"You can also customize the container entrypoint via ",(0,a.kt)("inlineCode",{parentName:"p"},"command"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"args"),", and ",(0,a.kt)("inlineCode",{parentName:"p"},"workingDir"),". These should ",(0,a.kt)("strong",{parentName:"p"},"most likely not be required"),". In most of the cases, the entrypoint details should be baked into the application image itself."),(0,a.kt)("p",null,"To customize the container entrypoint:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # ...\n # This command will overwrite the entrypoint set in the image Dockerfile\n command: ["/usr/local/bin/my-init-script.sh"]\n # Extra arguments append to command defined above\n args: [\n "--log-dir=/home/my-app/logs"\n "--timeout=60s"\n ]\n # Run the command as defined above, in the directory "/tmp"\n workingDir: "/tmp"\n }\n }\n }\n}\n')),(0,a.kt)("h2",{id:"configure-replicas"},"Configure Replicas"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"replicas")," field in the ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," instance describes the number of identical copies to run at the same time. It is generally recommended to have multiple replicas in production environments to eliminate any single point of failure. In Kubernetes, this corresponds to the ",(0,a.kt)("inlineCode",{parentName:"p"},"spec.replicas")," field in the relevant workload manifests."),(0,a.kt)("p",null,"To configure a workload to have a replica count of 3:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n # ...\n }\n replicas: 3\n # ...\n }\n # ...\n}\n")),(0,a.kt)("h2",{id:"differences-between-service-and-job"},"Differences between Service and Job"),(0,a.kt)("p",null,"The two types of workloads, namely ",(0,a.kt)("inlineCode",{parentName:"p"},"Service")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"Job"),", share a majority of the attributes with some minor differences."),(0,a.kt)("h3",{id:"exposure"},"Exposure"),(0,a.kt)("p",null,"A ",(0,a.kt)("inlineCode",{parentName:"p"},"Service")," usually represents a long-running, scalable workload that responds to short-lived latency-sensitive requests and never go down. Hence, a ",(0,a.kt)("inlineCode",{parentName:"p"},"Service")," has an additional attribute that determines how it is exposed and can be accessed. A ",(0,a.kt)("inlineCode",{parentName:"p"},"Job")," does NOT have the option to be exposed. We will explore more in the ",(0,a.kt)("a",{parentName:"p",href:"networking"},"application networking walkthrough"),"."),(0,a.kt)("h3",{id:"job-schedule"},"Job Schedule"),(0,a.kt)("p",null,"A ",(0,a.kt)("inlineCode",{parentName:"p"},"Job")," can be configured to run in a recurring manner. In this case, the job will have a cron-format schedule that represents its recurring schedule."),(0,a.kt)("p",null,"To configure a job to run at 21:00 every night:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myjob: ac.AppConfiguration {\n workload: wl.Job {\n containers: {\n "busybox": c.Container {\n image: "busybox:1.28"\n # Run the following command as defined\n command: ["/bin/sh", "-c", "echo hello"]\n }\n }\n # Run every hour.\n schedule: "0 * * * *"\n }\n}\n')),(0,a.kt)("h2",{id:"workload-references"},"Workload References"),(0,a.kt)("p",null,"You can find workload references ",(0,a.kt)("a",{parentName:"p",href:"../reference/modules/developer-schemas/workload/service"},"here"),"."),(0,a.kt)("p",null,"You can find workload schema source ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog/tree/main/models/schema/v1/workload"},"here"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/81f06d1d.60bcd9fe.js b/assets/js/81f06d1d.60bcd9fe.js deleted file mode 100644 index df95938f6fc..00000000000 --- a/assets/js/81f06d1d.60bcd9fe.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5835],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var o=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function r(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var p=o.createContext({}),s=function(e){var n=o.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):r(r({},n),e)),t},c=function(e){var n=s(e.components);return o.createElement(p.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},u=o.forwardRef((function(e,n){var t=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(t),m=a,k=u["".concat(p,".").concat(m)]||u[m]||d[m]||i;return t?o.createElement(k,r(r({ref:n},c),{},{components:t})):o.createElement(k,r({ref:n},c))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var i=t.length,r=new Array(i);r[0]=u;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:a,r[1]=l;for(var s=2;s{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>r,default:()=>d,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var o=t(87462),a=(t(67294),t(3905));const i={},r="Workload",l={unversionedId:"configuration-walkthrough/workload",id:"version-v0.11/configuration-walkthrough/workload",title:"Workload",description:"The workload attribute in the AppConfiguration instance is used to describe the specification for the application workload. The application workload generally represents the computing component for the application.",source:"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/4-workload.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/workload",permalink:"/docs/configuration-walkthrough/workload",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/4-workload.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:4,frontMatter:{},sidebar:"kusion",previous:{title:"Base and Override",permalink:"/docs/configuration-walkthrough/base-override"},next:{title:"Application Networking",permalink:"/docs/configuration-walkthrough/networking"}},p={},s=[{value:"Table of Content",id:"table-of-content",level:2},{value:"Import",id:"import",level:2},{value:"Types of Workloads",id:"types-of-workloads",level:2},{value:"Configure containers",id:"configure-containers",level:2},{value:"Application image",id:"application-image",level:3},{value:"Resource Requirements",id:"resource-requirements",level:3},{value:"Health Probes",id:"health-probes",level:3},{value:"Lifecycle Hooks",id:"lifecycle-hooks",level:3},{value:"Create Files",id:"create-files",level:3},{value:"Customize container initialization",id:"customize-container-initialization",level:3},{value:"Configure Replicas",id:"configure-replicas",level:2},{value:"Differences between Service and Job",id:"differences-between-service-and-job",level:2},{value:"Exposure",id:"exposure",level:3},{value:"Job Schedule",id:"job-schedule",level:3},{value:"Workload References",id:"workload-references",level:2}],c={toc:s};function d(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,o.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"workload"},"Workload"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," attribute in the ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance is used to describe the specification for the application workload. The application workload generally represents the computing component for the application."),(0,a.kt)("p",null,"A ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," maps to an ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance 1:1. If there are more than one workload, they should be considered different applications."),(0,a.kt)("h2",{id:"table-of-content"},"Table of Content"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#import"},"Import")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#types-of-workloads"},"Types of workloads")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#configure-containers"},"Configure containers"),(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#application-image"},"Application image")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#resource-requirements"},"Resource Requirements")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#health-probes"},"Health Probes")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#lifecycle-hooks"},"Lifecycle Hooks")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#create-files"},"Create Files")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#customize-container-initialization"},"Customize container initialization")))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#configure-replicas"},"Configure Replicas")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#differences-between-service-and-job"},"Differences between Service and Job")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#workload-references"},"Workload References"))),(0,a.kt)("h2",{id:"import"},"Import"),(0,a.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,a.kt)("inlineCode",{parentName:"p"},"catalog")," package. For more details on KCL package import, please refer to the ",(0,a.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport kam.v1.workload.container.probe as p\nimport kam.v1.workload.container.lifecycle as lc\n")),(0,a.kt)("h2",{id:"types-of-workloads"},"Types of Workloads"),(0,a.kt)("p",null,"There are currently two types of workloads:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Service"),', representing a long-running, scalable workload type that should "never" go down and respond to short-lived latency-sensitive requests. This workload type is commonly used for web applications and services that expose APIs.'),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Job"),", representing batch tasks that take from a few seconds to days to complete and then stop. These are commonly used for batch processing that is less sensitive to short-term performance fluctuations.")),(0,a.kt)("p",null,"To instantiate a ",(0,a.kt)("inlineCode",{parentName:"p"},"Service"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {}\n}\n")),(0,a.kt)("p",null,"To instantiate a ",(0,a.kt)("inlineCode",{parentName:"p"},"Job"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Job {}\n}\n")),(0,a.kt)("p",null,"Of course, the ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instances above is not sufficient to describe an application. We still need to provide more details in the ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," section."),(0,a.kt)("h2",{id:"configure-containers"},"Configure containers"),(0,a.kt)("p",null,"Kusion is built on top of cloud-native philosophies. One of which is that applications should run as loosely coupled microservices on abstract and self-contained software units, such as containers."),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"containers")," attribute in a workload instance is used to define the behavior for the containers that run application workload. The ",(0,a.kt)("inlineCode",{parentName:"p"},"containers")," attribute is a map, from the name of the container to the ",(0,a.kt)("inlineCode",{parentName:"p"},"catalog.models.schema.v1.workload.container.Container")," Object which includes the container configurations."),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"The name of the container is in the context of the configuration file, so you could refer to it later. It's not referring to the name of the container in the Kubernetes cluster (or any other runtime).")),(0,a.kt)("p",null,"Everything defined in the ",(0,a.kt)("inlineCode",{parentName:"p"},"containers")," attribute is considered an application container, as opposed to a sidecar container. Sidecar containers will be introduced in a different attribute in a future version."),(0,a.kt)("p",null,"In most of the cases, only one application container is needed. Ideally, we recommend mapping an ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance to a microservice in the microservice terminology."),(0,a.kt)("p",null,"We will walk through the details of configuring a container using an example of the ",(0,a.kt)("inlineCode",{parentName:"p"},"Service")," type."),(0,a.kt)("p",null,"To add an application container:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {}\n }\n }\n}\n')),(0,a.kt)("h3",{id:"application-image"},"Application image"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"image")," attribute in the ",(0,a.kt)("inlineCode",{parentName:"p"},"Container")," schema specifies the application image to run. This is the only required field in the ",(0,a.kt)("inlineCode",{parentName:"p"},"Container")," schema."),(0,a.kt)("p",null,"To specify an application image:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n }\n # ...\n }\n }\n}\n')),(0,a.kt)("h3",{id:"resource-requirements"},"Resource Requirements"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"resources")," attribute in the ",(0,a.kt)("inlineCode",{parentName:"p"},"Container")," schema specifies the application resource requirements such as cpu and memory."),(0,a.kt)("p",null,"You can specify an upper limit (which maps to resource limits only) or a range as the resource requirements (which maps to resource requests and limits in Kubernetes)."),(0,a.kt)("p",null,"To specify an upper bound (only resource limits):"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n # ...\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"To specify a range (both resource requests and limits):"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # Sets requests to cpu=250m and memory=256Mi\n # Sets limits to cpu=500m and memory=512Mi\n resources: {\n "cpu": "250m-500m"\n "memory": "256Mi-512Mi"\n }\n # ...\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"health-probes"},"Health Probes"),(0,a.kt)("p",null,"There are three types of ",(0,a.kt)("inlineCode",{parentName:"p"},"Probe")," defined in a ",(0,a.kt)("inlineCode",{parentName:"p"},"Container"),":"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"livenessProbe")," - used to determine if the container is healthy and running"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"readinessProbe")," - used to determine if the container is ready to accept traffic"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"startupProbe")," - used to determine if the container has started properly. Liveness and readiness probes don't start until ",(0,a.kt)("inlineCode",{parentName:"li"},"startupProbe")," succeeds. Commonly used for containers that takes a while to start")),(0,a.kt)("p",null,"The probes are optional. You can only have one Probe of each kind for a given ",(0,a.kt)("inlineCode",{parentName:"p"},"Container"),"."),(0,a.kt)("p",null,"To configure a ",(0,a.kt)("inlineCode",{parentName:"p"},"Http")," type ",(0,a.kt)("inlineCode",{parentName:"p"},"readinessProbe")," that probes the health via HTTP request and a ",(0,a.kt)("inlineCode",{parentName:"p"},"Exec")," type ",(0,a.kt)("inlineCode",{parentName:"p"},"livenessProbe")," which executes a command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # ...\n # Configure an Http type readiness probe at /healthz\n readinessProbe: p.Probe {\n probeHandler: p.Http {\n url: "/healthz"\n }\n initialDelaySeconds: 10\n timeoutSeconds: 5\n periodSeconds: 15\n successThreshold: 3\n failureThreshold: 1\n }\n # Configure an Exec type liveness probe that executes probe.sh\n livenessProbe: p.Probe {\n probeHandler: p.Exec {\n command: ["probe.sh"]\n }\n initialDelaySeconds: 10\n }\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"lifecycle-hooks"},"Lifecycle Hooks"),(0,a.kt)("p",null,"You can also configure lifecycle hooks that triggers in response to container lifecycle events such as liveness/startup probe failure, preemption, resource contention, etc."),(0,a.kt)("p",null,"There are two types that is currently supported:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"PreStop")," - triggers before the container is terminated."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"PostStart")," - triggers after the container is initialized.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # ...\n # Configure lifecycle hooks\n lifecycle: lc.Lifecycle {\n # Configures an Exec type pre-stop hook that executes preStop.sh\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n # Configures an Http type pre-stop hook at /post-start\n postStart: p.Http {\n url: "/post-start"\n }\n }\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"create-files"},"Create Files"),(0,a.kt)("p",null,"You can also create files on-demand during the container initialization."),(0,a.kt)("p",null,"To create a custom file and mount it to ",(0,a.kt)("inlineCode",{parentName:"p"},"/home/admin/my-file")," when the container starts:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n }\n # ...\n # Creates a file during container startup\n files: {\n "/home/admin/my-file": c.FileSpec {\n content: "some file contents"\n mode: "0777"\n }\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"customize-container-initialization"},"Customize container initialization"),(0,a.kt)("p",null,"You can also customize the container entrypoint via ",(0,a.kt)("inlineCode",{parentName:"p"},"command"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"args"),", and ",(0,a.kt)("inlineCode",{parentName:"p"},"workingDir"),". These should ",(0,a.kt)("strong",{parentName:"p"},"most likely not be required"),". In most of the cases, the entrypoint details should be baked into the application image itself."),(0,a.kt)("p",null,"To customize the container entrypoint:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v5"\n # ...\n # This command will overwrite the entrypoint set in the image Dockerfile\n command: ["/usr/local/bin/my-init-script.sh"]\n # Extra arguments append to command defined above\n args: [\n "--log-dir=/home/my-app/logs"\n "--timeout=60s"\n ]\n # Run the command as defined above, in the directory "/tmp"\n workingDir: "/tmp"\n }\n }\n }\n}\n')),(0,a.kt)("h2",{id:"configure-replicas"},"Configure Replicas"),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"replicas")," field in the ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," instance describes the number of identical copies to run at the same time. It is generally recommended to have multiple replicas in production environments to eliminate any single point of failure. In Kubernetes, this corresponds to the ",(0,a.kt)("inlineCode",{parentName:"p"},"spec.replicas")," field in the relevant workload manifests."),(0,a.kt)("p",null,"To configure a workload to have a replica count of 3:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n # ...\n }\n replicas: 3\n # ...\n }\n # ...\n}\n")),(0,a.kt)("h2",{id:"differences-between-service-and-job"},"Differences between Service and Job"),(0,a.kt)("p",null,"The two types of workloads, namely ",(0,a.kt)("inlineCode",{parentName:"p"},"Service")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"Job"),", share a majority of the attributes with some minor differences."),(0,a.kt)("h3",{id:"exposure"},"Exposure"),(0,a.kt)("p",null,"A ",(0,a.kt)("inlineCode",{parentName:"p"},"Service")," usually represents a long-running, scalable workload that responds to short-lived latency-sensitive requests and never go down. Hence, a ",(0,a.kt)("inlineCode",{parentName:"p"},"Service")," has an additional attribute that determines how it is exposed and can be accessed. A ",(0,a.kt)("inlineCode",{parentName:"p"},"Job")," does NOT have the option to be exposed. We will explore more in the ",(0,a.kt)("a",{parentName:"p",href:"networking"},"application networking walkthrough"),"."),(0,a.kt)("h3",{id:"job-schedule"},"Job Schedule"),(0,a.kt)("p",null,"A ",(0,a.kt)("inlineCode",{parentName:"p"},"Job")," can be configured to run in a recurring manner. In this case, the job will have a cron-format schedule that represents its recurring schedule."),(0,a.kt)("p",null,"To configure a job to run at 21:00 every night:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myjob: ac.AppConfiguration {\n workload: wl.Job {\n containers: {\n "busybox": c.Container {\n image: "busybox:1.28"\n # Run the following command as defined\n command: ["/bin/sh", "-c", "echo hello"]\n }\n }\n # Run every hour.\n schedule: "0 * * * *"\n }\n}\n')),(0,a.kt)("h2",{id:"workload-references"},"Workload References"),(0,a.kt)("p",null,"You can find workload references ",(0,a.kt)("a",{parentName:"p",href:"../reference/modules/developer-schemas/workload/service"},"here"),"."),(0,a.kt)("p",null,"You can find workload schema source ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog/tree/main/models/schema/v1/workload"},"here"),"."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/83a718dd.0adb0e64.js b/assets/js/83a718dd.2ec37ad9.js similarity index 58% rename from assets/js/83a718dd.0adb0e64.js rename to assets/js/83a718dd.2ec37ad9.js index 65b1c136cd5..770dcd980c4 100644 --- a/assets/js/83a718dd.0adb0e64.js +++ b/assets/js/83a718dd.2ec37ad9.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4085],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function s(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=o.createContext({}),l=function(e){var t=o.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=l(e.components);return o.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(n),m=r,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||a;return n?o.createElement(f,s(s({ref:t},p),{},{components:n})):o.createElement(f,s({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,s=new Array(a);s[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>l});var o=n(87462),r=(n(67294),n(3905));const a={},s="Kusion Module",i={unversionedId:"concepts/kusion-module",id:"version-v0.10/concepts/kusion-module",title:"Kusion Module",description:"A Kusion module is a reusable building block designed by platform engineers to standardize application deployments and enable app developers to self-service. It consists of two parts:",source:"@site/docs_versioned_docs/version-v0.10/3-concepts/3-kusion-module.md",sourceDirName:"3-concepts",slug:"/concepts/kusion-module",permalink:"/docs/v0.10/concepts/kusion-module",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/3-concepts/3-kusion-module.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{},sidebar:"kusion",previous:{title:"Stack Configuration",permalink:"/docs/v0.10/concepts/stack/configuration"},next:{title:"Workspace",permalink:"/docs/v0.10/concepts/workspace"}},c={},l=[],p={toc:l};function u(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,o.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"kusion-module"},"Kusion Module"),(0,r.kt)("p",null,"A Kusion module is a reusable building block designed by platform engineers to standardize application deployments and enable app developers to self-service. It consists of two parts:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"App developer-oriented schema: It is a ",(0,r.kt)("a",{parentName:"li",href:"https://kcl-lang.io/docs/user_docs/guides/schema-definition/"},"KCL schema"),". Fields in this schema are recommended to be understandable to application developers and workspace-agnostic. For example, a database Kusion module schema only contains fields like database engine type and database version."),(0,r.kt)("li",{parentName:"ul"},"Kusion module generator: It is a piece of logic that generates the Intent with an instantiated schema mentioned above, along with platform configurations (",(0,r.kt)("a",{parentName:"li",href:"workspace"},"workspace"),"). As a building block, Kusion module hides the complexity of infrastructures. A database Kusion module not only represents a cloud RDS, but it also contains logic to configure other resources such as security groups and IAM policies. Additionally, it seamlessly injects the database host address, username, and password into the workload's environment variables. The generator logic can be very complex in some situations so we recommend implementing it in a GPL like ",(0,r.kt)("a",{parentName:"li",href:"https://go.dev/"},"go"),".")),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kusion-module",src:n(63623).Z,width:"1443",height:"429"})))}u.isMDXComponent=!0},63623:(e,t,n)=>{n.d(t,{Z:()=>o});const o=n.p+"assets/images/kusion-module-635aee19e95fcd57ebebeaa106fa04ee.png"}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4085],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function s(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=o.createContext({}),l=function(e){var t=o.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=l(e.components);return o.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(n),m=r,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||a;return n?o.createElement(f,s(s({ref:t},p),{},{components:n})):o.createElement(f,s({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,s=new Array(a);s[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>l});var o=n(87462),r=(n(67294),n(3905));const a={},s="Kusion Module",i={unversionedId:"concepts/kusion-module",id:"version-v0.10/concepts/kusion-module",title:"Kusion Module",description:"A Kusion module is a reusable building block designed by platform engineers to standardize application deployments and enable app developers to self-service. It consists of two parts:",source:"@site/docs_versioned_docs/version-v0.10/3-concepts/3-kusion-module.md",sourceDirName:"3-concepts",slug:"/concepts/kusion-module",permalink:"/docs/v0.10/concepts/kusion-module",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/3-concepts/3-kusion-module.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{},sidebar:"kusion",previous:{title:"Stack Configuration",permalink:"/docs/v0.10/concepts/stack/configuration"},next:{title:"Workspace",permalink:"/docs/v0.10/concepts/workspace"}},c={},l=[],p={toc:l};function u(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,o.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"kusion-module"},"Kusion Module"),(0,r.kt)("p",null,"A Kusion module is a reusable building block designed by platform engineers to standardize application deployments and enable app developers to self-service. It consists of two parts:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"App developer-oriented schema: It is a ",(0,r.kt)("a",{parentName:"li",href:"https://kcl-lang.io/docs/user_docs/guides/schema-definition/"},"KCL schema"),". Fields in this schema are recommended to be understandable to application developers and workspace-agnostic. For example, a database Kusion module schema only contains fields like database engine type and database version."),(0,r.kt)("li",{parentName:"ul"},"Kusion module generator: It is a piece of logic that generates the Intent with an instantiated schema mentioned above, along with platform configurations (",(0,r.kt)("a",{parentName:"li",href:"workspace"},"workspace"),"). As a building block, Kusion module hides the complexity of infrastructures. A database Kusion module not only represents a cloud RDS, but it also contains logic to configure other resources such as security groups and IAM policies. Additionally, it seamlessly injects the database host address, username, and password into the workload's environment variables. The generator logic can be very complex in some situations so we recommend implementing it in a GPL like ",(0,r.kt)("a",{parentName:"li",href:"https://go.dev/"},"go"),".")),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kusion-module",src:n(63623).Z,width:"1443",height:"429"})))}u.isMDXComponent=!0},63623:(e,t,n)=>{n.d(t,{Z:()=>o});const o=n.p+"assets/images/kusion-module-635aee19e95fcd57ebebeaa106fa04ee.png"}}]); \ No newline at end of file diff --git a/assets/js/84d0485c.8bd39c4b.js b/assets/js/84d0485c.8bd39c4b.js deleted file mode 100644 index e5d6e02c858..00000000000 --- a/assets/js/84d0485c.8bd39c4b.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6626],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>u});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),m=c(r),u=o,b=m["".concat(s,".").concat(u)]||m[u]||d[u]||a;return r?n.createElement(b,i(i({ref:t},p),{},{components:r})):n.createElement(b,i({ref:t},p))}));function u(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var c=2;c{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>l,toc:()=>c});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:1},i="Installation",l={unversionedId:"faq/install-error",id:"version-v0.11/faq/install-error",title:"Installation",description:"1. Could not find libintl.dylib",source:"@site/docs_versioned_docs/version-v0.11/7-faq/1-install-error.md",sourceDirName:"7-faq",slug:"/faq/install-error",permalink:"/docs/faq/install-error",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/7-faq/1-install-error.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"kusion",previous:{title:"Roadmap",permalink:"/docs/reference/roadmap"},next:{title:"KCL",permalink:"/docs/faq/kcl"}},s={},c=[{value:"1. Could not find libintl.dylib",id:"1-could-not-find-libintldylib",level:2},{value:"2. macOS system SSL related errors",id:"2-macos-system-ssl-related-errors",level:2}],p={toc:c};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"installation"},"Installation"),(0,o.kt)("h2",{id:"1-could-not-find-libintldylib"},"1. Could not find ",(0,o.kt)("inlineCode",{parentName:"h2"},"libintl.dylib")),(0,o.kt)("p",null,"This problem is that some tools depends on the ",(0,o.kt)("inlineCode",{parentName:"p"},"Gettext")," library, but macOS does not have this library by default. You can try to solve it in the following ways:"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"(Skip this step for non-macOS m1) For macOS m1 operating system, make sure you have a homebrew arm64e-version installed in /opt/homebrew, otherwise install the arm version of brew with the following command")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"\n# add to path\nexport PATH=/opt/homebrew/bin:$PATH\n')),(0,o.kt)("ol",{start:2},(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"brew install gettext")),(0,o.kt)("li",{parentName:"ol"},"Make sure ",(0,o.kt)("inlineCode",{parentName:"li"},"libintl.8.dylib")," exists in ",(0,o.kt)("inlineCode",{parentName:"li"},"/usr/local/opt/gettext/lib")," directory"),(0,o.kt)("li",{parentName:"ol"},"If brew is installed in another directory, the library can be created by copying it to the corresponding directory")),(0,o.kt)("h2",{id:"2-macos-system-ssl-related-errors"},"2. macOS system SSL related errors"),(0,o.kt)("p",null,"Openssl dylib library not found or SSL module is not available problem"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"(Skip this step for non-macOS m1) For macOS m1 operating system, make sure you have a homebrew arm64e-version installed in /opt/homebrew, otherwise install the arm version of brew with the following command")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"\n# add to path\nexport PATH=/opt/homebrew/bin:$PATH\n')),(0,o.kt)("ol",{start:2},(0,o.kt)("li",{parentName:"ol"},"Install openssl (version 1.1) via brew")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"brew install openssl@1.1\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/84d0485c.9ebc7e60.js b/assets/js/84d0485c.9ebc7e60.js new file mode 100644 index 00000000000..f18888c3a6d --- /dev/null +++ b/assets/js/84d0485c.9ebc7e60.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6626],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>u});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),m=c(r),u=o,b=m["".concat(s,".").concat(u)]||m[u]||d[u]||a;return r?n.createElement(b,i(i({ref:t},p),{},{components:r})):n.createElement(b,i({ref:t},p))}));function u(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var c=2;c{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>l,toc:()=>c});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:1},i="Installation",l={unversionedId:"faq/install-error",id:"version-v0.11/faq/install-error",title:"Installation",description:"1. Could not find libintl.dylib",source:"@site/docs_versioned_docs/version-v0.11/7-faq/1-install-error.md",sourceDirName:"7-faq",slug:"/faq/install-error",permalink:"/docs/faq/install-error",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/7-faq/1-install-error.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"kusion",previous:{title:"Roadmap",permalink:"/docs/reference/roadmap"},next:{title:"KCL",permalink:"/docs/faq/kcl"}},s={},c=[{value:"1. Could not find libintl.dylib",id:"1-could-not-find-libintldylib",level:2},{value:"2. macOS system SSL related errors",id:"2-macos-system-ssl-related-errors",level:2}],p={toc:c};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"installation"},"Installation"),(0,o.kt)("h2",{id:"1-could-not-find-libintldylib"},"1. Could not find ",(0,o.kt)("inlineCode",{parentName:"h2"},"libintl.dylib")),(0,o.kt)("p",null,"This problem is that some tools depends on the ",(0,o.kt)("inlineCode",{parentName:"p"},"Gettext")," library, but macOS does not have this library by default. You can try to solve it in the following ways:"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"(Skip this step for non-macOS m1) For macOS m1 operating system, make sure you have a homebrew arm64e-version installed in /opt/homebrew, otherwise install the arm version of brew with the following command")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"\n# add to path\nexport PATH=/opt/homebrew/bin:$PATH\n')),(0,o.kt)("ol",{start:2},(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"brew install gettext")),(0,o.kt)("li",{parentName:"ol"},"Make sure ",(0,o.kt)("inlineCode",{parentName:"li"},"libintl.8.dylib")," exists in ",(0,o.kt)("inlineCode",{parentName:"li"},"/usr/local/opt/gettext/lib")," directory"),(0,o.kt)("li",{parentName:"ol"},"If brew is installed in another directory, the library can be created by copying it to the corresponding directory")),(0,o.kt)("h2",{id:"2-macos-system-ssl-related-errors"},"2. macOS system SSL related errors"),(0,o.kt)("p",null,"Openssl dylib library not found or SSL module is not available problem"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"(Skip this step for non-macOS m1) For macOS m1 operating system, make sure you have a homebrew arm64e-version installed in /opt/homebrew, otherwise install the arm version of brew with the following command")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"\n# add to path\nexport PATH=/opt/homebrew/bin:$PATH\n')),(0,o.kt)("ol",{start:2},(0,o.kt)("li",{parentName:"ol"},"Install openssl (version 1.1) via brew")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"brew install openssl@1.1\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/84d7eb88.0b23a5c2.js b/assets/js/84d7eb88.0b23a5c2.js deleted file mode 100644 index 73b22183db4..00000000000 --- a/assets/js/84d7eb88.0b23a5c2.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[944],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(n),m=i,k=u["".concat(s,".").concat(m)]||u[m]||c[m]||o;return n?a.createElement(k,r(r({ref:t},d),{},{components:n})):a.createElement(k,r({ref:t},d))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,r=new Array(o);r[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>r,default:()=>c,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var a=n(87462),i=(n(67294),n(3905));const o={id:"kcl-basics"},r="KCL Basics",l={unversionedId:"configuration-walkthrough/kcl-basics",id:"version-v0.11/configuration-walkthrough/kcl-basics",title:"KCL Basics",description:"Table of Content",source:"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/2-kcl-basics.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/kcl-basics",permalink:"/docs/configuration-walkthrough/kcl-basics",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/2-kcl-basics.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"kcl-basics"},sidebar:"kusion",previous:{title:"Configuration File Overview",permalink:"/docs/configuration-walkthrough/overview"},next:{title:"Base and Override",permalink:"/docs/configuration-walkthrough/base-override"}},s={},p=[{value:"Table of Content",id:"table-of-content",level:2},{value:"Variable assignments",id:"variable-assignments",level:2},{value:"Common built-in types",id:"common-built-in-types",level:2},{value:"Lists and maps",id:"lists-and-maps",level:2},{value:"Conditional statements",id:"conditional-statements",level:2},{value:"The : and = operator",id:"the--and--operator",level:2},{value:"Advanced KCL capabilities",id:"advanced-kcl-capabilities",level:2}],d={toc:p};function c(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"kcl-basics"},"KCL Basics"),(0,i.kt)("h2",{id:"table-of-content"},"Table of Content"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#variable-assignments"},"Variable assignments")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#common-built-in-types"},"Common built-in types")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#lists-and-maps"},"Lists and maps")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#conditional-statements"},"Conditional statements")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#the--and--operator"},"The : and = operator")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#advanced-kcl-capabilities"},"Advanced KCL capabilities"))),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/"},"KCL")," is the choice of configuration language consumed by Kusion. KCL is an open source constraint-based record and functional language. KCL works well with a large number of complex configurations via modern programming language technology and practice, and is committed to provide better modularity, scalability, stability and extensibility."),(0,i.kt)("h2",{id:"variable-assignments"},"Variable assignments"),(0,i.kt)("p",null,"There are two ways to initialize a variable in KCL. You can either use the ",(0,i.kt)("inlineCode",{parentName:"p"},":")," operator or the ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operator. We will discuss the difference between them in ",(0,i.kt)("a",{parentName:"p",href:"#the--and--operator"},"this section later"),"."),(0,i.kt)("p",null,"Here are the two ways to create a variable and initialize it:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'foo = "Foo" # Declare a variable named `foo` and its value is a string literal "Foo"\nbar: "Bar" # Declare a variable named `bar` and its value is a string literal "Bar"\n')),(0,i.kt)("p",null,"You will be able to override a variable assignment via the ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operator. We will discuss this in depth in the ",(0,i.kt)("a",{parentName:"p",href:"#the--and--operator"},(0,i.kt)("inlineCode",{parentName:"a"},":")," and ",(0,i.kt)("inlineCode",{parentName:"a"},"=")," operator section"),"."),(0,i.kt)("h2",{id:"common-built-in-types"},"Common built-in types"),(0,i.kt)("p",null,"KCL supports ",(0,i.kt)("inlineCode",{parentName:"p"},"int"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"float"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"bool")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"string")," as the built-in types."),(0,i.kt)("p",null,"Other types are defined in the packages that are imported into the application configuration files. One such example would be the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," object (or ",(0,i.kt)("inlineCode",{parentName:"p"},"Container"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Probe"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Port")," object, etc) that are defined in the ",(0,i.kt)("inlineCode",{parentName:"p"},"kam")," repository."),(0,i.kt)("h2",{id:"lists-and-maps"},"Lists and maps"),(0,i.kt)("p",null,"Lists are represented using the ",(0,i.kt)("inlineCode",{parentName:"p"},"[]")," notation.\nAn example of lists:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"list0 = [1, 2, 3]\nlist1 = [4, 5, 6]\njoined_list = list0 + list1 # [1, 2, 3, 4, 5, 6]\n")),(0,i.kt)("p",null,"Maps are represented using the ",(0,i.kt)("inlineCode",{parentName:"p"},"{}")," notation.\nAn example of maps:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"a = {\"one\" = 1, \"two\" = 2, \"three\" = 3}\nb = {'one' = 1, 'two' = 2, 'three' = 3}\nassert a == b # True\nassert len(a) == 3 # True\n")),(0,i.kt)("h2",{id:"conditional-statements"},"Conditional statements"),(0,i.kt)("p",null,"You can also use basic control flow statements when writing the configuration file."),(0,i.kt)("p",null,"An example that sets the value of ",(0,i.kt)("inlineCode",{parentName:"p"},"replicas")," conditionally based on the value of ",(0,i.kt)("inlineCode",{parentName:"p"},"containers.myapp.resources.cpu"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\n\nmyapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: ""\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1 if containers.myapp.resources.cpu == "500m" else 2\n }\n}\n')),(0,i.kt)("p",null,"For more details on KCL's control flow statements, please refer to the ",(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/reference/lang/tour#control-flow-statements"},"KCL documentation"),"."),(0,i.kt)("h2",{id:"the--and--operator"},"The ",(0,i.kt)("inlineCode",{parentName:"h2"},":")," and ",(0,i.kt)("inlineCode",{parentName:"h2"},"=")," operator"),(0,i.kt)("p",null,"You might have noticed there is a mixed usage of the ",(0,i.kt)("inlineCode",{parentName:"p"},":")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," in the samples above."),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("strong",{parentName:"p"},"TLDR: The recommendation is to use ",(0,i.kt)("inlineCode",{parentName:"strong"},":")," in the common configurations, and ",(0,i.kt)("inlineCode",{parentName:"strong"},"=")," for override in the environment-specific configurations."))),(0,i.kt)("p",null,"In KCL:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},":")," represents a union-ed value assignment. In the pattern ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier: E")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier: T E"),", the value of the expression ",(0,i.kt)("inlineCode",{parentName:"li"},"E")," with optional type annotation ",(0,i.kt)("inlineCode",{parentName:"li"},"T")," will be merged and union-ed into the element value."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"=")," represents a value override. In the pattern ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier = E")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier = T E"),", The value of the expression ",(0,i.kt)("inlineCode",{parentName:"li"},"E")," with optional type annotation ",(0,i.kt)("inlineCode",{parentName:"li"},"T")," will override the ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier")," attribute value.")),(0,i.kt)("p",null,"Let's take a look at an example:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"# This is one configuration that will be merged.\nconfig: Config {\n data.d1 = 1\n}\n# This is another configuration that will be merged.\nconfig: Config {\n data.d2 = 2\n}\n")),(0,i.kt)("p",null,"The above is equivalent to the snippet below since the two expressions for ",(0,i.kt)("inlineCode",{parentName:"p"},"config")," get merged/union-ed into one:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"config: Config {\n data.d1 = 1\n data.d2 = 1\n}\n")),(0,i.kt)("p",null,"whereas using the ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operators will result in a different outcome:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"# This is first configuration.\nconfig = Config {\n data.d1 = 1\n}\n# This is second configuration that will override the prior one.\nconfig = Config {\n data.d2 = 2\n}\n")),(0,i.kt)("p",null,"The config above results in:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"config: Config {\n data.d2 = 2\n}\n")),(0,i.kt)("p",null,"Please note that the ",(0,i.kt)("inlineCode",{parentName:"p"},":")," attribute operator represents an idempotent merge operation, and an error will be thrown when the values that need to be merged conflict with each other."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"data0 = {id: 1} | {id: 2} # Error\uff1aconflicting values between {'id': 2} and {'id': 1}\ndata1 = {id: 1} | {id = 2} # Ok, the value of `data` is {\"id\": 2}\n")),(0,i.kt)("p",null,"More about ",(0,i.kt)("inlineCode",{parentName:"p"},":")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operator can be found in the ",(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/reference/lang/tour#config-operations"},"KCL documentation"),"."),(0,i.kt)("h2",{id:"advanced-kcl-capabilities"},"Advanced KCL capabilities"),(0,i.kt)("p",null,"For more advanced KCL capabilities, please visit the ",(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/user_docs/support/faq-kcl"},"KCL website"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/84d7eb88.8354a109.js b/assets/js/84d7eb88.8354a109.js new file mode 100644 index 00000000000..d18cd4614ec --- /dev/null +++ b/assets/js/84d7eb88.8354a109.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[944],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(n),m=i,k=u["".concat(s,".").concat(m)]||u[m]||c[m]||o;return n?a.createElement(k,r(r({ref:t},d),{},{components:n})):a.createElement(k,r({ref:t},d))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,r=new Array(o);r[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>r,default:()=>c,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var a=n(87462),i=(n(67294),n(3905));const o={id:"kcl-basics"},r="KCL Basics",l={unversionedId:"configuration-walkthrough/kcl-basics",id:"version-v0.11/configuration-walkthrough/kcl-basics",title:"KCL Basics",description:"Table of Content",source:"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/2-kcl-basics.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/kcl-basics",permalink:"/docs/configuration-walkthrough/kcl-basics",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/2-kcl-basics.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"kcl-basics"},sidebar:"kusion",previous:{title:"Configuration File Overview",permalink:"/docs/configuration-walkthrough/overview"},next:{title:"Base and Override",permalink:"/docs/configuration-walkthrough/base-override"}},s={},p=[{value:"Table of Content",id:"table-of-content",level:2},{value:"Variable assignments",id:"variable-assignments",level:2},{value:"Common built-in types",id:"common-built-in-types",level:2},{value:"Lists and maps",id:"lists-and-maps",level:2},{value:"Conditional statements",id:"conditional-statements",level:2},{value:"The : and = operator",id:"the--and--operator",level:2},{value:"Advanced KCL capabilities",id:"advanced-kcl-capabilities",level:2}],d={toc:p};function c(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"kcl-basics"},"KCL Basics"),(0,i.kt)("h2",{id:"table-of-content"},"Table of Content"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#variable-assignments"},"Variable assignments")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#common-built-in-types"},"Common built-in types")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#lists-and-maps"},"Lists and maps")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#conditional-statements"},"Conditional statements")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#the--and--operator"},"The : and = operator")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#advanced-kcl-capabilities"},"Advanced KCL capabilities"))),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/"},"KCL")," is the choice of configuration language consumed by Kusion. KCL is an open source constraint-based record and functional language. KCL works well with a large number of complex configurations via modern programming language technology and practice, and is committed to provide better modularity, scalability, stability and extensibility."),(0,i.kt)("h2",{id:"variable-assignments"},"Variable assignments"),(0,i.kt)("p",null,"There are two ways to initialize a variable in KCL. You can either use the ",(0,i.kt)("inlineCode",{parentName:"p"},":")," operator or the ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operator. We will discuss the difference between them in ",(0,i.kt)("a",{parentName:"p",href:"#the--and--operator"},"this section later"),"."),(0,i.kt)("p",null,"Here are the two ways to create a variable and initialize it:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'foo = "Foo" # Declare a variable named `foo` and its value is a string literal "Foo"\nbar: "Bar" # Declare a variable named `bar` and its value is a string literal "Bar"\n')),(0,i.kt)("p",null,"You will be able to override a variable assignment via the ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operator. We will discuss this in depth in the ",(0,i.kt)("a",{parentName:"p",href:"#the--and--operator"},(0,i.kt)("inlineCode",{parentName:"a"},":")," and ",(0,i.kt)("inlineCode",{parentName:"a"},"=")," operator section"),"."),(0,i.kt)("h2",{id:"common-built-in-types"},"Common built-in types"),(0,i.kt)("p",null,"KCL supports ",(0,i.kt)("inlineCode",{parentName:"p"},"int"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"float"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"bool")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"string")," as the built-in types."),(0,i.kt)("p",null,"Other types are defined in the packages that are imported into the application configuration files. One such example would be the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," object (or ",(0,i.kt)("inlineCode",{parentName:"p"},"Container"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Probe"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Port")," object, etc) that are defined in the ",(0,i.kt)("inlineCode",{parentName:"p"},"kam")," repository."),(0,i.kt)("h2",{id:"lists-and-maps"},"Lists and maps"),(0,i.kt)("p",null,"Lists are represented using the ",(0,i.kt)("inlineCode",{parentName:"p"},"[]")," notation.\nAn example of lists:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"list0 = [1, 2, 3]\nlist1 = [4, 5, 6]\njoined_list = list0 + list1 # [1, 2, 3, 4, 5, 6]\n")),(0,i.kt)("p",null,"Maps are represented using the ",(0,i.kt)("inlineCode",{parentName:"p"},"{}")," notation.\nAn example of maps:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"a = {\"one\" = 1, \"two\" = 2, \"three\" = 3}\nb = {'one' = 1, 'two' = 2, 'three' = 3}\nassert a == b # True\nassert len(a) == 3 # True\n")),(0,i.kt)("h2",{id:"conditional-statements"},"Conditional statements"),(0,i.kt)("p",null,"You can also use basic control flow statements when writing the configuration file."),(0,i.kt)("p",null,"An example that sets the value of ",(0,i.kt)("inlineCode",{parentName:"p"},"replicas")," conditionally based on the value of ",(0,i.kt)("inlineCode",{parentName:"p"},"containers.myapp.resources.cpu"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\n\nmyapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: ""\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1 if containers.myapp.resources.cpu == "500m" else 2\n }\n}\n')),(0,i.kt)("p",null,"For more details on KCL's control flow statements, please refer to the ",(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/reference/lang/tour#control-flow-statements"},"KCL documentation"),"."),(0,i.kt)("h2",{id:"the--and--operator"},"The ",(0,i.kt)("inlineCode",{parentName:"h2"},":")," and ",(0,i.kt)("inlineCode",{parentName:"h2"},"=")," operator"),(0,i.kt)("p",null,"You might have noticed there is a mixed usage of the ",(0,i.kt)("inlineCode",{parentName:"p"},":")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," in the samples above."),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("strong",{parentName:"p"},"TLDR: The recommendation is to use ",(0,i.kt)("inlineCode",{parentName:"strong"},":")," in the common configurations, and ",(0,i.kt)("inlineCode",{parentName:"strong"},"=")," for override in the environment-specific configurations."))),(0,i.kt)("p",null,"In KCL:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},":")," represents a union-ed value assignment. In the pattern ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier: E")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier: T E"),", the value of the expression ",(0,i.kt)("inlineCode",{parentName:"li"},"E")," with optional type annotation ",(0,i.kt)("inlineCode",{parentName:"li"},"T")," will be merged and union-ed into the element value."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"=")," represents a value override. In the pattern ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier = E")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier = T E"),", The value of the expression ",(0,i.kt)("inlineCode",{parentName:"li"},"E")," with optional type annotation ",(0,i.kt)("inlineCode",{parentName:"li"},"T")," will override the ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier")," attribute value.")),(0,i.kt)("p",null,"Let's take a look at an example:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"# This is one configuration that will be merged.\nconfig: Config {\n data.d1 = 1\n}\n# This is another configuration that will be merged.\nconfig: Config {\n data.d2 = 2\n}\n")),(0,i.kt)("p",null,"The above is equivalent to the snippet below since the two expressions for ",(0,i.kt)("inlineCode",{parentName:"p"},"config")," get merged/union-ed into one:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"config: Config {\n data.d1 = 1\n data.d2 = 1\n}\n")),(0,i.kt)("p",null,"whereas using the ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operators will result in a different outcome:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"# This is first configuration.\nconfig = Config {\n data.d1 = 1\n}\n# This is second configuration that will override the prior one.\nconfig = Config {\n data.d2 = 2\n}\n")),(0,i.kt)("p",null,"The config above results in:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"config: Config {\n data.d2 = 2\n}\n")),(0,i.kt)("p",null,"Please note that the ",(0,i.kt)("inlineCode",{parentName:"p"},":")," attribute operator represents an idempotent merge operation, and an error will be thrown when the values that need to be merged conflict with each other."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"data0 = {id: 1} | {id: 2} # Error\uff1aconflicting values between {'id': 2} and {'id': 1}\ndata1 = {id: 1} | {id = 2} # Ok, the value of `data` is {\"id\": 2}\n")),(0,i.kt)("p",null,"More about ",(0,i.kt)("inlineCode",{parentName:"p"},":")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operator can be found in the ",(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/reference/lang/tour#config-operations"},"KCL documentation"),"."),(0,i.kt)("h2",{id:"advanced-kcl-capabilities"},"Advanced KCL capabilities"),(0,i.kt)("p",null,"For more advanced KCL capabilities, please visit the ",(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/user_docs/support/faq-kcl"},"KCL website"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/84e0516e.4464f876.js b/assets/js/84e0516e.4464f876.js new file mode 100644 index 00000000000..80b45e1b4e4 --- /dev/null +++ b/assets/js/84e0516e.4464f876.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2781],{3905:(t,e,a)=>{a.d(e,{Zo:()=>d,kt:()=>c});var n=a(67294);function r(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function l(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function i(t){for(var e=1;e=0||(r[a]=t[a]);return r}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}var p=n.createContext({}),s=function(t){var e=n.useContext(p),a=e;return t&&(a="function"==typeof t?t(e):i(i({},e),t)),a},d=function(t){var e=s(t.components);return n.createElement(p.Provider,{value:e},t.children)},m={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},u=n.forwardRef((function(t,e){var a=t.components,r=t.mdxType,l=t.originalType,p=t.parentName,d=o(t,["components","mdxType","originalType","parentName"]),u=s(a),c=r,k=u["".concat(p,".").concat(c)]||u[c]||m[c]||l;return a?n.createElement(k,i(i({ref:e},d),{},{components:a})):n.createElement(k,i({ref:e},d))}));function c(t,e){var a=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var l=a.length,i=new Array(l);i[0]=u;var o={};for(var p in e)hasOwnProperty.call(e,p)&&(o[p]=e[p]);o.originalType=t,o.mdxType="string"==typeof t?t:r,i[1]=o;for(var s=2;s{a.r(e),a.d(e,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>o,toc:()=>s});var n=a(87462),r=(a(67294),a(3905));const l={},i="job",o={unversionedId:"reference/modules/catalog-models/workload/job",id:"version-v0.10/reference/modules/catalog-models/workload/job",title:"job",description:"Schemas",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/workload/job.md",sourceDirName:"6-reference/2-modules/1-catalog-models/workload",slug:"/reference/modules/catalog-models/workload/job",permalink:"/docs/v0.10/reference/modules/catalog-models/workload/job",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/workload/job.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"opsrule",permalink:"/docs/v0.10/reference/modules/catalog-models/trait/opsrule"},next:{title:"service",permalink:"/docs/v0.10/reference/modules/catalog-models/workload/service"}},p={},s=[{value:"Schemas",id:"schemas",level:2},{value:"Schema Job",id:"schema-job",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Base Schema",id:"base-schema",level:3},{value:"Schema Container",id:"schema-container",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3},{value:"Schema FileSpec",id:"schema-filespec",level:2},{value:"Attributes",id:"attributes-2",level:3},{value:"Examples",id:"examples-2",level:3},{value:"Schema Probe",id:"schema-probe",level:2},{value:"Attributes",id:"attributes-3",level:3},{value:"Examples",id:"examples-3",level:3},{value:"Schema Exec",id:"schema-exec",level:2},{value:"Attributes",id:"attributes-4",level:3},{value:"Examples",id:"examples-4",level:3},{value:"Schema Http",id:"schema-http",level:2},{value:"Attributes",id:"attributes-5",level:3},{value:"Examples",id:"examples-5",level:3},{value:"Schema Tcp",id:"schema-tcp",level:2},{value:"Attributes",id:"attributes-6",level:3},{value:"Examples",id:"examples-6",level:3},{value:"Schema Lifecycle",id:"schema-lifecycle",level:2},{value:"Attributes",id:"attributes-7",level:3},{value:"Examples",id:"examples-7",level:3},{value:"Schema Secret",id:"schema-secret",level:2},{value:"Attributes",id:"attributes-8",level:3},{value:"Examples",id:"examples-8",level:3}],d={toc:s};function m(t){let{components:e,...a}=t;return(0,r.kt)("wrapper",(0,n.Z)({},d,a,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"job"},"job"),(0,r.kt)("h2",{id:"schemas"},"Schemas"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-job"},"Job"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-container"},"Container"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-filespec"},"Filespec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-lifecycle"},"LifeCycle")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-probe"},"Probe"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-exec"},"Exec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-http"},"Http")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-tcp"},"Tcp")))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-secret"},"Secret"))))),(0,r.kt)("h2",{id:"schema-job"},"Schema Job"),(0,r.kt)("p",null,"Job is a kind of workload profile that describes how to run your application code. This",(0,r.kt)("br",null),"is typically used for tasks that take from a few seconds to a few days to complete."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"containers"),(0,r.kt)("br",null),"Containers defines the templates of containers to be ran.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers"},"https://kubernetes.io/docs/concepts/containers")),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-container"},"container.Container"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"schedule")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"replicas"),(0,r.kt)("br",null),"Number of container replicas based on this configuration that should be ran."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"2"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"secrets")),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-secret"},"secret.Secret"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"labels"),(0,r.kt)("br",null),"Labels are key/value pairs that are attached to the workload."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"annotations"),(0,r.kt)("br",null),"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'Instantiate a job with busybox image and runs every hour\n\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\n\njob: wl.Job {\n containers: {\n "busybox": c.Container{\n image: "busybox:1.28"\n command: ["/bin/sh", "-c", "echo hello"]\n }\n }\n schedule: "0 * * * *"\n}\n')),(0,r.kt)("h3",{id:"base-schema"},"Base Schema"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../internal/common#schema-workloadbase"},"WorkloadBase")),(0,r.kt)("h2",{id:"schema-container"},"Schema Container"),(0,r.kt)("p",null,"Container describes how the Application's tasks are expected to be run. Depending on",(0,r.kt)("br",null),"the replicas parameter 1 or more containers can be created from each template."),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"image"),(0,r.kt)("br",null),"Image refers to the Docker image name to run for this container.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/images"},"https://kubernetes.io/docs/concepts/containers/images")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command"),(0,r.kt)("br",null),"Entrypoint array. Not executed within a shell.",(0,r.kt)("br",null),"Command will overwrite the ENTRYPOINT value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's ENTRYPOINT is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"args"),(0,r.kt)("br",null),"Arguments to the entrypoint.",(0,r.kt)("br",null),"Args will overwrite the CMD value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's CMD is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"env"),(0,r.kt)("br",null),"List of environment variables to set in the container.",(0,r.kt)("br",null),"The value of the environment variable may be static text or a value from a secret."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"workingDir"),(0,r.kt)("br",null),"The working directory of the running process defined in entrypoint.",(0,r.kt)("br",null),"Default container runtime will be used if this is not specified."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"resources"),(0,r.kt)("br",null),"Map of resource requirements the container should run with.",(0,r.kt)("br",null),"The resources parameter is a dict with the key being the resource name and the value being",(0,r.kt)("br",null),"the resource value."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"files"),(0,r.kt)("br",null),"List of files to create in the container.",(0,r.kt)("br",null),"The files parameter is a dict with the key being the file name in the container and the value",(0,r.kt)("br",null),"being the target file specification."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-filespec"},"container.FileSpec"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"dirs"),(0,r.kt)("br",null),"Collection of volumes mount into the container's filesystem.",(0,r.kt)("br",null),"The dirs parameter is a dict with the key being the folder name in the container and the value",(0,r.kt)("br",null),"being the referenced volume."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"livenessProbe"),(0,r.kt)("br",null),"LivenessProbe indicates if a running process is healthy.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"readinessProbe"),(0,r.kt)("br",null),"ReadinessProbe indicates whether an application is available to handle requests."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"startupProbe"),(0,r.kt)("br",null),"StartupProbe indicates that the container has started for the first time.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"lifecycle"),(0,r.kt)("br",null),"Lifecycle refers to actions that the management system should take in response to container lifecycle events."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-lifecycle"},"lc.Lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container as c\n\nweb = c.Container {\n image: "nginx:latest"\n command: ["/bin/sh", "-c", "echo hi"]\n env: {\n "name": "value"\n }\n resources: {\n "cpu": "2"\n "memory": "4Gi"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-filespec"},"Schema FileSpec"),(0,r.kt)("p",null,"FileSpec defines the target file in a Container."),(0,r.kt)("h3",{id:"attributes-2"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"content"),(0,r.kt)("br",null),"File content in plain text."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"contentFrom"),(0,r.kt)("br",null),"Source for the file content, reference to a secret of configmap value."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"mode"),(0,r.kt)("br",null),"Mode bits used to set permissions on this file, must be an octal value",(0,r.kt)("br",null),"between 0000 and 0777 or a decimal value between 0 and 511"),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-2"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container as c\n\ntmpFile = c.FileSpec {\n content: "some file contents"\n mode: "0777"\n}\n')),(0,r.kt)("h2",{id:"schema-probe"},"Schema Probe"),(0,r.kt)("p",null,"Probe describes a health check to be performed against a container to determine whether it is",(0,r.kt)("br",null),"alive or ready to receive traffic. There are three probe types: readiness, liveness, and startup."),(0,r.kt)("h3",{id:"attributes-3"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"probeHandler"),(0,r.kt)("br",null),"The action taken to determine the alive or health of a container"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-tcp"},"probe.Tcp")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"initialDelaySeconds"),(0,r.kt)("br",null),"The number of seconds before health checking is activated.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle%5C#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle\\#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"timeoutSeconds"),(0,r.kt)("br",null),"The number of seconds after which the probe times out.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle%5C#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle\\#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"periodSeconds"),(0,r.kt)("br",null),"How often (in seconds) to perform the probe."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"successThreshold"),(0,r.kt)("br",null),"Minimum consecutive successes for the probe to be considered successful after having failed."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"failureThreshold"),(0,r.kt)("br",null),"Minimum consecutive failures for the probe to be considered failed after having succeeded."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"terminationGracePeriod")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-3"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nprobe = p.Probe {\n probeHandler: p.Http {\n path: "/healthz"\n }\n initialDelaySeconds: 10\n}\n')),(0,r.kt)("h2",{id:"schema-exec"},"Schema Exec"),(0,r.kt)("p",null,'Exec describes a "run in container" action.'),(0,r.kt)("h3",{id:"attributes-4"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command"),(0,r.kt)("br",null),"The command line to execute inside the container."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-4"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nexecProbe = p.Exec {\n command: ["probe.sh"]\n}\n')),(0,r.kt)("h2",{id:"schema-http"},"Schema Http"),(0,r.kt)("p",null,"Http describes an action based on HTTP Get requests."),(0,r.kt)("h3",{id:"attributes-5"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url"),(0,r.kt)("br",null),"The full qualified url to send HTTP requests."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"headers"),(0,r.kt)("br",null),"Collection of custom headers to set in the request"),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-5"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nhttpProbe = p.Http {\n url: "http://localhost:80"\n headers: {\n "X-HEADER": "VALUE"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-tcp"},"Schema Tcp"),(0,r.kt)("p",null,"Tcp describes an action based on opening a socket."),(0,r.kt)("h3",{id:"attributes-6"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url"),(0,r.kt)("br",null),"The full qualified url to open a socket."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-6"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\ntcpProbe = p.Tcp {\n url: "tcp://localhost:1234"\n}\n')),(0,r.kt)("h2",{id:"schema-lifecycle"},"Schema Lifecycle"),(0,r.kt)("p",null,"Lifecycle describes actions that the management system should take in response",(0,r.kt)("br",null),"to container lifecycle events."),(0,r.kt)("h3",{id:"attributes-7"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"preStop"),(0,r.kt)("br",null),"The action to be taken before a container is terminated due to an API request or",(0,r.kt)("br",null),"management event such as liveness/startup probe failure, preemption, resource contention, etc.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/%5C#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/\\#container-hooks")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"postStart"),(0,r.kt)("br",null),"The action to be taken after a container is created.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/%5C#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/\\#container-hooks")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-7"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.container.lifecycle as lc\n\nlifecycleHook = lc.Lifecycle {\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n postStart: p.Http {\n url: "http://localhost:80"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-secret"},"Schema Secret"),(0,r.kt)("p",null,"Secret can be used to store sensitive data."),(0,r.kt)("h3",{id:"attributes-8"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type"),(0,r.kt)("br",null),"Type of secret, used to facilitate programmatic handling of secret data.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/configuration/secret/%5C#secret-types"},"https://kubernetes.io/docs/concepts/configuration/secret/\\#secret-types")),(0,r.kt)("td",{parentName:"tr",align:null},'"basic" ',"|",' "opaque"'),(0,r.kt)("td",{parentName:"tr",align:null},"opaque"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"data"),(0,r.kt)("br",null),"Data contains the non-binary secret data in string form."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"immutable"),(0,r.kt)("br",null),"Immutable, if set to true, ensures that data stored in the Secret cannot be updated."),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-8"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.secret as sec\n\nbasicAuth = sec.Secret {\n type: "basic"\n data: {\n "username": ""\n "password": ""\n }\n}\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/84e0516e.6228a083.js b/assets/js/84e0516e.6228a083.js deleted file mode 100644 index 0225d5f0356..00000000000 --- a/assets/js/84e0516e.6228a083.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2781],{3905:(t,e,a)=>{a.d(e,{Zo:()=>d,kt:()=>c});var n=a(67294);function r(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function l(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function i(t){for(var e=1;e=0||(r[a]=t[a]);return r}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}var p=n.createContext({}),s=function(t){var e=n.useContext(p),a=e;return t&&(a="function"==typeof t?t(e):i(i({},e),t)),a},d=function(t){var e=s(t.components);return n.createElement(p.Provider,{value:e},t.children)},m={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},u=n.forwardRef((function(t,e){var a=t.components,r=t.mdxType,l=t.originalType,p=t.parentName,d=o(t,["components","mdxType","originalType","parentName"]),u=s(a),c=r,k=u["".concat(p,".").concat(c)]||u[c]||m[c]||l;return a?n.createElement(k,i(i({ref:e},d),{},{components:a})):n.createElement(k,i({ref:e},d))}));function c(t,e){var a=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var l=a.length,i=new Array(l);i[0]=u;var o={};for(var p in e)hasOwnProperty.call(e,p)&&(o[p]=e[p]);o.originalType=t,o.mdxType="string"==typeof t?t:r,i[1]=o;for(var s=2;s{a.r(e),a.d(e,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>o,toc:()=>s});var n=a(87462),r=(a(67294),a(3905));const l={},i="job",o={unversionedId:"reference/modules/catalog-models/workload/job",id:"version-v0.10/reference/modules/catalog-models/workload/job",title:"job",description:"Schemas",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/workload/job.md",sourceDirName:"6-reference/2-modules/1-catalog-models/workload",slug:"/reference/modules/catalog-models/workload/job",permalink:"/docs/v0.10/reference/modules/catalog-models/workload/job",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/workload/job.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"opsrule",permalink:"/docs/v0.10/reference/modules/catalog-models/trait/opsrule"},next:{title:"service",permalink:"/docs/v0.10/reference/modules/catalog-models/workload/service"}},p={},s=[{value:"Schemas",id:"schemas",level:2},{value:"Schema Job",id:"schema-job",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Base Schema",id:"base-schema",level:3},{value:"Schema Container",id:"schema-container",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3},{value:"Schema FileSpec",id:"schema-filespec",level:2},{value:"Attributes",id:"attributes-2",level:3},{value:"Examples",id:"examples-2",level:3},{value:"Schema Probe",id:"schema-probe",level:2},{value:"Attributes",id:"attributes-3",level:3},{value:"Examples",id:"examples-3",level:3},{value:"Schema Exec",id:"schema-exec",level:2},{value:"Attributes",id:"attributes-4",level:3},{value:"Examples",id:"examples-4",level:3},{value:"Schema Http",id:"schema-http",level:2},{value:"Attributes",id:"attributes-5",level:3},{value:"Examples",id:"examples-5",level:3},{value:"Schema Tcp",id:"schema-tcp",level:2},{value:"Attributes",id:"attributes-6",level:3},{value:"Examples",id:"examples-6",level:3},{value:"Schema Lifecycle",id:"schema-lifecycle",level:2},{value:"Attributes",id:"attributes-7",level:3},{value:"Examples",id:"examples-7",level:3},{value:"Schema Secret",id:"schema-secret",level:2},{value:"Attributes",id:"attributes-8",level:3},{value:"Examples",id:"examples-8",level:3}],d={toc:s};function m(t){let{components:e,...a}=t;return(0,r.kt)("wrapper",(0,n.Z)({},d,a,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"job"},"job"),(0,r.kt)("h2",{id:"schemas"},"Schemas"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-job"},"Job"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-container"},"Container"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-filespec"},"Filespec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-lifecycle"},"LifeCycle")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-probe"},"Probe"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-exec"},"Exec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-http"},"Http")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-tcp"},"Tcp")))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-secret"},"Secret"))))),(0,r.kt)("h2",{id:"schema-job"},"Schema Job"),(0,r.kt)("p",null,"Job is a kind of workload profile that describes how to run your application code. This",(0,r.kt)("br",null),"is typically used for tasks that take from a few seconds to a few days to complete."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"containers"),(0,r.kt)("br",null),"Containers defines the templates of containers to be ran.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers"},"https://kubernetes.io/docs/concepts/containers")),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-container"},"container.Container"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"schedule")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"replicas"),(0,r.kt)("br",null),"Number of container replicas based on this configuration that should be ran."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"2"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"secrets")),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-secret"},"secret.Secret"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"labels"),(0,r.kt)("br",null),"Labels are key/value pairs that are attached to the workload."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"annotations"),(0,r.kt)("br",null),"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'Instantiate a job with busybox image and runs every hour\n\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\n\njob: wl.Job {\n containers: {\n "busybox": c.Container{\n image: "busybox:1.28"\n command: ["/bin/sh", "-c", "echo hello"]\n }\n }\n schedule: "0 * * * *"\n}\n')),(0,r.kt)("h3",{id:"base-schema"},"Base Schema"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../internal/common#schema-workloadbase"},"WorkloadBase")),(0,r.kt)("h2",{id:"schema-container"},"Schema Container"),(0,r.kt)("p",null,"Container describes how the Application's tasks are expected to be run. Depending on",(0,r.kt)("br",null),"the replicas parameter 1 or more containers can be created from each template."),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"image"),(0,r.kt)("br",null),"Image refers to the Docker image name to run for this container.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/images"},"https://kubernetes.io/docs/concepts/containers/images")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command"),(0,r.kt)("br",null),"Entrypoint array. Not executed within a shell.",(0,r.kt)("br",null),"Command will overwrite the ENTRYPOINT value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's ENTRYPOINT is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"args"),(0,r.kt)("br",null),"Arguments to the entrypoint.",(0,r.kt)("br",null),"Args will overwrite the CMD value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's CMD is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"env"),(0,r.kt)("br",null),"List of environment variables to set in the container.",(0,r.kt)("br",null),"The value of the environment variable may be static text or a value from a secret."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"workingDir"),(0,r.kt)("br",null),"The working directory of the running process defined in entrypoint.",(0,r.kt)("br",null),"Default container runtime will be used if this is not specified."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"resources"),(0,r.kt)("br",null),"Map of resource requirements the container should run with.",(0,r.kt)("br",null),"The resources parameter is a dict with the key being the resource name and the value being",(0,r.kt)("br",null),"the resource value."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"files"),(0,r.kt)("br",null),"List of files to create in the container.",(0,r.kt)("br",null),"The files parameter is a dict with the key being the file name in the container and the value",(0,r.kt)("br",null),"being the target file specification."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-filespec"},"container.FileSpec"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"dirs"),(0,r.kt)("br",null),"Collection of volumes mount into the container's filesystem.",(0,r.kt)("br",null),"The dirs parameter is a dict with the key being the folder name in the container and the value",(0,r.kt)("br",null),"being the referenced volume."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"livenessProbe"),(0,r.kt)("br",null),"LivenessProbe indicates if a running process is healthy.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"readinessProbe"),(0,r.kt)("br",null),"ReadinessProbe indicates whether an application is available to handle requests."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"startupProbe"),(0,r.kt)("br",null),"StartupProbe indicates that the container has started for the first time.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"lifecycle"),(0,r.kt)("br",null),"Lifecycle refers to actions that the management system should take in response to container lifecycle events."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-lifecycle"},"lc.Lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container as c\n\nweb = c.Container {\n image: "nginx:latest"\n command: ["/bin/sh", "-c", "echo hi"]\n env: {\n "name": "value"\n }\n resources: {\n "cpu": "2"\n "memory": "4Gi"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-filespec"},"Schema FileSpec"),(0,r.kt)("p",null,"FileSpec defines the target file in a Container."),(0,r.kt)("h3",{id:"attributes-2"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"content"),(0,r.kt)("br",null),"File content in plain text."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"contentFrom"),(0,r.kt)("br",null),"Source for the file content, reference to a secret of configmap value."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"mode"),(0,r.kt)("br",null),"Mode bits used to set permissions on this file, must be an octal value",(0,r.kt)("br",null),"between 0000 and 0777 or a decimal value between 0 and 511"),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-2"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container as c\n\ntmpFile = c.FileSpec {\n content: "some file contents"\n mode: "0777"\n}\n')),(0,r.kt)("h2",{id:"schema-probe"},"Schema Probe"),(0,r.kt)("p",null,"Probe describes a health check to be performed against a container to determine whether it is",(0,r.kt)("br",null),"alive or ready to receive traffic. There are three probe types: readiness, liveness, and startup."),(0,r.kt)("h3",{id:"attributes-3"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"probeHandler"),(0,r.kt)("br",null),"The action taken to determine the alive or health of a container"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-tcp"},"probe.Tcp")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"initialDelaySeconds"),(0,r.kt)("br",null),"The number of seconds before health checking is activated.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle%5C#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle\\#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"timeoutSeconds"),(0,r.kt)("br",null),"The number of seconds after which the probe times out.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle%5C#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle\\#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"periodSeconds"),(0,r.kt)("br",null),"How often (in seconds) to perform the probe."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"successThreshold"),(0,r.kt)("br",null),"Minimum consecutive successes for the probe to be considered successful after having failed."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"failureThreshold"),(0,r.kt)("br",null),"Minimum consecutive failures for the probe to be considered failed after having succeeded."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"terminationGracePeriod")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-3"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nprobe = p.Probe {\n probeHandler: p.Http {\n path: "/healthz"\n }\n initialDelaySeconds: 10\n}\n')),(0,r.kt)("h2",{id:"schema-exec"},"Schema Exec"),(0,r.kt)("p",null,'Exec describes a "run in container" action.'),(0,r.kt)("h3",{id:"attributes-4"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command"),(0,r.kt)("br",null),"The command line to execute inside the container."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-4"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nexecProbe = p.Exec {\n command: ["probe.sh"]\n}\n')),(0,r.kt)("h2",{id:"schema-http"},"Schema Http"),(0,r.kt)("p",null,"Http describes an action based on HTTP Get requests."),(0,r.kt)("h3",{id:"attributes-5"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url"),(0,r.kt)("br",null),"The full qualified url to send HTTP requests."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"headers"),(0,r.kt)("br",null),"Collection of custom headers to set in the request"),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-5"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nhttpProbe = p.Http {\n url: "http://localhost:80"\n headers: {\n "X-HEADER": "VALUE"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-tcp"},"Schema Tcp"),(0,r.kt)("p",null,"Tcp describes an action based on opening a socket."),(0,r.kt)("h3",{id:"attributes-6"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url"),(0,r.kt)("br",null),"The full qualified url to open a socket."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-6"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\ntcpProbe = p.Tcp {\n url: "tcp://localhost:1234"\n}\n')),(0,r.kt)("h2",{id:"schema-lifecycle"},"Schema Lifecycle"),(0,r.kt)("p",null,"Lifecycle describes actions that the management system should take in response",(0,r.kt)("br",null),"to container lifecycle events."),(0,r.kt)("h3",{id:"attributes-7"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"preStop"),(0,r.kt)("br",null),"The action to be taken before a container is terminated due to an API request or",(0,r.kt)("br",null),"management event such as liveness/startup probe failure, preemption, resource contention, etc.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/%5C#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/\\#container-hooks")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"postStart"),(0,r.kt)("br",null),"The action to be taken after a container is created.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/%5C#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/\\#container-hooks")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-7"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.container.lifecycle as lc\n\nlifecycleHook = lc.Lifecycle {\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n postStart: p.Http {\n url: "http://localhost:80"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-secret"},"Schema Secret"),(0,r.kt)("p",null,"Secret can be used to store sensitive data."),(0,r.kt)("h3",{id:"attributes-8"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type"),(0,r.kt)("br",null),"Type of secret, used to facilitate programmatic handling of secret data.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/configuration/secret/%5C#secret-types"},"https://kubernetes.io/docs/concepts/configuration/secret/\\#secret-types")),(0,r.kt)("td",{parentName:"tr",align:null},'"basic" ',"|",' "opaque"'),(0,r.kt)("td",{parentName:"tr",align:null},"opaque"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"data"),(0,r.kt)("br",null),"Data contains the non-binary secret data in string form."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"immutable"),(0,r.kt)("br",null),"Immutable, if set to true, ensures that data stored in the Secret cannot be updated."),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-8"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.secret as sec\n\nbasicAuth = sec.Secret {\n type: "basic"\n data: {\n "username": ""\n "password": ""\n }\n}\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/86470930.36c5dffa.js b/assets/js/86470930.36c5dffa.js deleted file mode 100644 index d44ba8b137f..00000000000 --- a/assets/js/86470930.36c5dffa.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3389],{3905:(e,t,r)=>{r.d(t,{Zo:()=>m,kt:()=>u});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),c=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},m=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},p=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,m=s(e,["components","mdxType","originalType","parentName"]),p=c(r),u=a,k=p["".concat(i,".").concat(u)]||p[u]||d[u]||o;return r?n.createElement(k,l(l({ref:t},m),{},{components:r})):n.createElement(k,l({ref:t},m))}));function u(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=p;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,l[1]=s;for(var c=2;c{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const o={},l="common",s={unversionedId:"reference/modules/developer-schemas/internal/common",id:"reference/modules/developer-schemas/internal/common",title:"common",description:"Schema WorkloadBase",source:"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/internal/common.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/internal",slug:"/reference/modules/developer-schemas/internal/common",permalink:"/docs/next/reference/modules/developer-schemas/internal/common",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/1-developer-schemas/internal/common.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"postgres",permalink:"/docs/next/reference/modules/developer-schemas/database/postgres"},next:{title:"container",permalink:"/docs/next/reference/modules/developer-schemas/internal/container/"}},i={},c=[{value:"Schema WorkloadBase",id:"schema-workloadbase",level:2},{value:"Attributes",id:"attributes",level:3}],m={toc:c};function d(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"common"},"common"),(0,a.kt)("h2",{id:"schema-workloadbase"},"Schema WorkloadBase"),(0,a.kt)("p",null,"WorkloadBase defines set of attributes shared by different workload profile, e.g Service",(0,a.kt)("br",null),"and Job. You can inherit this Schema to reuse these common attributes."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"containers")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:}"),(0,a.kt)("td",{parentName:"tr",align:null},"Containers defines the templates of containers to be ran.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers"},"https://kubernetes.io/docs/concepts/containers")),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Labels are key/value pairs that are attached to the workload."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"replicas")),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"Number of container replicas based on this configuration that should be ran."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"secrets")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:",(0,a.kt)("a",{parentName:"td",href:"#schema-secret"},"s.Secret"),"}"),(0,a.kt)("td",{parentName:"tr",align:null},"Secrets can be used to store small amount of sensitive data e.g. password, token."),(0,a.kt)("td",{parentName:"tr",align:null})))))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/86470930.54135190.js b/assets/js/86470930.54135190.js new file mode 100644 index 00000000000..b7ffcd64142 --- /dev/null +++ b/assets/js/86470930.54135190.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3389],{3905:(e,t,r)=>{r.d(t,{Zo:()=>m,kt:()=>u});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),c=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},m=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},p=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,m=s(e,["components","mdxType","originalType","parentName"]),p=c(r),u=a,k=p["".concat(i,".").concat(u)]||p[u]||d[u]||o;return r?n.createElement(k,l(l({ref:t},m),{},{components:r})):n.createElement(k,l({ref:t},m))}));function u(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=p;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,l[1]=s;for(var c=2;c{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const o={},l="common",s={unversionedId:"reference/modules/developer-schemas/internal/common",id:"reference/modules/developer-schemas/internal/common",title:"common",description:"Schema WorkloadBase",source:"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/internal/common.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/internal",slug:"/reference/modules/developer-schemas/internal/common",permalink:"/docs/next/reference/modules/developer-schemas/internal/common",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/1-developer-schemas/internal/common.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"postgres",permalink:"/docs/next/reference/modules/developer-schemas/database/postgres"},next:{title:"container",permalink:"/docs/next/reference/modules/developer-schemas/internal/container/"}},i={},c=[{value:"Schema WorkloadBase",id:"schema-workloadbase",level:2},{value:"Attributes",id:"attributes",level:3}],m={toc:c};function d(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"common"},"common"),(0,a.kt)("h2",{id:"schema-workloadbase"},"Schema WorkloadBase"),(0,a.kt)("p",null,"WorkloadBase defines set of attributes shared by different workload profile, e.g Service",(0,a.kt)("br",null),"and Job. You can inherit this Schema to reuse these common attributes."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"containers")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:}"),(0,a.kt)("td",{parentName:"tr",align:null},"Containers defines the templates of containers to be ran.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers"},"https://kubernetes.io/docs/concepts/containers")),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Labels are key/value pairs that are attached to the workload."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"replicas")),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"Number of container replicas based on this configuration that should be ran."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"secrets")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:",(0,a.kt)("a",{parentName:"td",href:"#schema-secret"},"s.Secret"),"}"),(0,a.kt)("td",{parentName:"tr",align:null},"Secrets can be used to store small amount of sensitive data e.g. password, token."),(0,a.kt)("td",{parentName:"tr",align:null})))))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/86b70772.08e3b047.js b/assets/js/86b70772.08e3b047.js deleted file mode 100644 index a6036810233..00000000000 --- a/assets/js/86b70772.08e3b047.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4679],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(n),m=a,g=d["".concat(c,".").concat(m)]||d[m]||u[m]||s;return n?r.createElement(g,o(o({ref:t},p),{},{components:n})):r.createElement(g,o({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>s,metadata:()=>i,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const s={},o="Using Cloud Secrets Manager",i={unversionedId:"user-guides/secrets-management/using-cloud-secrets",id:"version-v0.10/user-guides/secrets-management/using-cloud-secrets",title:"Using Cloud Secrets Manager",description:"Applications usually store sensitive data in secrets by using centralized secrets management solutions. For example, you authenticate databases, services, and external systems with passwords, API keys, tokens, and other credentials stored in a secret store, e.g. Hashicorp Vault, AWS Secrets Manager, Azure Key Vault, etc",source:"@site/docs_versioned_docs/version-v0.10/5-user-guides/5-secrets-management/1-using-cloud-secrets.md",sourceDirName:"5-user-guides/5-secrets-management",slug:"/user-guides/secrets-management/using-cloud-secrets",permalink:"/docs/v0.10/user-guides/secrets-management/using-cloud-secrets",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/5-user-guides/5-secrets-management/1-using-cloud-secrets.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{},sidebar:"kusion",previous:{title:"Deploy Application Securely and Efficiently via GitHub Actions",permalink:"/docs/v0.10/user-guides/github-actions/deploy-application-via-github-actions"},next:{title:"Kusion Commands",permalink:"/docs/v0.10/reference/commands/"}},c={},l=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Setting up workspace",id:"setting-up-workspace",level:2},{value:"Update AppConfiguration",id:"update-appconfiguration",level:2},{value:"Apply and Verify",id:"apply-and-verify",level:2}],p={toc:l};function u(e){let{components:t,...s}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,s,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"using-cloud-secrets-manager"},"Using Cloud Secrets Manager"),(0,a.kt)("p",null,"Applications usually store sensitive data in secrets by using centralized secrets management solutions. For example, you authenticate databases, services, and external systems with passwords, API keys, tokens, and other credentials stored in a secret store, e.g. Hashicorp Vault, AWS Secrets Manager, Azure Key Vault, etc"),(0,a.kt)("p",null,"Kusion provides out-of-the-box support to reference existing external secrets management solution, this tutorial introduces that how to pull the secret from AWS Secrets Manager to make it available to applications."),(0,a.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,a.kt)("p",null,"Please refer to the ",(0,a.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,a.kt)("p",null,"The example below also requires you to have ",(0,a.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#initializing"},"initialized the project")," using the ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will generate a ",(0,a.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#kclmod"},(0,a.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the project directory."),(0,a.kt)("p",null,"Additionally, you also need to configure the obtained AccessKey and SecretKey as environment variables: "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},'export AWS_ACCESS_KEY_ID="AKIAQZDxxxx" # replace it with your AccessKey\nexport AWS_SECRET_ACCESS_KEY="oE/xxxx" # replace it with your SecretKey\n')),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"aws iam account",src:n(24838).Z,width:"2874",height:"1398"})),(0,a.kt)("h2",{id:"setting-up-workspace"},"Setting up workspace"),(0,a.kt)("p",null,"Since v0.10.0, we have introduced the concept of ",(0,a.kt)("a",{parentName:"p",href:"/docs/v0.10/concepts/workspace"},"workspaces"),", whose configurations represent the part of the application behaviors that platform teams are interested in standardizing, or the ones to eliminate from developer's mind to make their lives easier."),(0,a.kt)("p",null,"In the case of setting up cloud secrets manager, platform teams need to specify which secrets management solution to use and necessary information to access on the workspace level."),(0,a.kt)("p",null,"A sample ",(0,a.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," with AWS Secrets Manager settings:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"modules:\n ...\nsecretStore:\n provider:\n aws:\n region: us-east-1\n profile: The optional profile to be used to interact with AWS Secrets Manager.\n...\n")),(0,a.kt)("h2",{id:"update-appconfiguration"},"Update AppConfiguration"),(0,a.kt)("p",null,"At this point we are set up for good! Now you can declare external type of secrets via the ",(0,a.kt)("inlineCode",{parentName:"p"},"secrets")," field in the ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model to consume sensitive data stored in AWS Secrets Manager."),(0,a.kt)("p",null,"See the example below for a full, deployable AppConfiguration."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import models.schema.v1 as ac\nimport models.schema.v1.workload as wl\nimport models.schema.v1.workload.container as c\nimport models.schema.v1.workload.secret as sec\n\ngitsync: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "syncer": c.Container {\n image: "dyrnq/git-sync"\n # Run the following command as defined\n command: [\n "--repo=https://github.com/KusionStack/kusion"\n "--ref=HEAD"\n "--root=/mnt/git"\n ]\n # Consume secrets in environment variables\n env: {\n "GIT_SYNC_USERNAME": "secret://git-auth/username"\n "GIT_SYNC_PASSWORD": "secret://git-auth/password"\n }\n }\n }\n # Secrets used to retrieve secret data from AWS Secrets Manager\n secrets: {\n "git-auth": sec.Secret {\n type: "external"\n data: {\n "username": "ref://git-auth-info/username"\n "password": "ref://git-auth-info/password"\n }\n }\n }\n }\n}\n')),(0,a.kt)("h2",{id:"apply-and-verify"},"Apply and Verify"),(0,a.kt)("p",null,"Run ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion apply")," command to deploy above application, then use the below command to verify if the secret got deployed:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"kubectl get secret -n secretdemo\n")),(0,a.kt)("p",null,"You will find ",(0,a.kt)("inlineCode",{parentName:"p"},"git-auth")," of type Opaque automatically created and contains sensitive information pulled from AWS Secrets Manager."))}u.isMDXComponent=!0},24838:(e,t,n)=>{n.d(t,{Z:()=>r});const r=n.p+"assets/images/aws-iam-account-2216105e7fa18fb2f7bf4be7e19f98bd.png"}}]); \ No newline at end of file diff --git a/assets/js/86b70772.c1e63193.js b/assets/js/86b70772.c1e63193.js new file mode 100644 index 00000000000..a654118052a --- /dev/null +++ b/assets/js/86b70772.c1e63193.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4679],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(n),m=a,g=d["".concat(c,".").concat(m)]||d[m]||u[m]||s;return n?r.createElement(g,o(o({ref:t},p),{},{components:n})):r.createElement(g,o({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>s,metadata:()=>i,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const s={},o="Using Cloud Secrets Manager",i={unversionedId:"user-guides/secrets-management/using-cloud-secrets",id:"version-v0.10/user-guides/secrets-management/using-cloud-secrets",title:"Using Cloud Secrets Manager",description:"Applications usually store sensitive data in secrets by using centralized secrets management solutions. For example, you authenticate databases, services, and external systems with passwords, API keys, tokens, and other credentials stored in a secret store, e.g. Hashicorp Vault, AWS Secrets Manager, Azure Key Vault, etc",source:"@site/docs_versioned_docs/version-v0.10/5-user-guides/5-secrets-management/1-using-cloud-secrets.md",sourceDirName:"5-user-guides/5-secrets-management",slug:"/user-guides/secrets-management/using-cloud-secrets",permalink:"/docs/v0.10/user-guides/secrets-management/using-cloud-secrets",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/5-user-guides/5-secrets-management/1-using-cloud-secrets.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{},sidebar:"kusion",previous:{title:"Deploy Application Securely and Efficiently via GitHub Actions",permalink:"/docs/v0.10/user-guides/github-actions/deploy-application-via-github-actions"},next:{title:"Kusion Commands",permalink:"/docs/v0.10/reference/commands/"}},c={},l=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Setting up workspace",id:"setting-up-workspace",level:2},{value:"Update AppConfiguration",id:"update-appconfiguration",level:2},{value:"Apply and Verify",id:"apply-and-verify",level:2}],p={toc:l};function u(e){let{components:t,...s}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,s,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"using-cloud-secrets-manager"},"Using Cloud Secrets Manager"),(0,a.kt)("p",null,"Applications usually store sensitive data in secrets by using centralized secrets management solutions. For example, you authenticate databases, services, and external systems with passwords, API keys, tokens, and other credentials stored in a secret store, e.g. Hashicorp Vault, AWS Secrets Manager, Azure Key Vault, etc"),(0,a.kt)("p",null,"Kusion provides out-of-the-box support to reference existing external secrets management solution, this tutorial introduces that how to pull the secret from AWS Secrets Manager to make it available to applications."),(0,a.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,a.kt)("p",null,"Please refer to the ",(0,a.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,a.kt)("p",null,"The example below also requires you to have ",(0,a.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#initializing"},"initialized the project")," using the ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will generate a ",(0,a.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#kclmod"},(0,a.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the project directory."),(0,a.kt)("p",null,"Additionally, you also need to configure the obtained AccessKey and SecretKey as environment variables: "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},'export AWS_ACCESS_KEY_ID="AKIAQZDxxxx" # replace it with your AccessKey\nexport AWS_SECRET_ACCESS_KEY="oE/xxxx" # replace it with your SecretKey\n')),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"aws iam account",src:n(24838).Z,width:"2874",height:"1398"})),(0,a.kt)("h2",{id:"setting-up-workspace"},"Setting up workspace"),(0,a.kt)("p",null,"Since v0.10.0, we have introduced the concept of ",(0,a.kt)("a",{parentName:"p",href:"/docs/v0.10/concepts/workspace"},"workspaces"),", whose configurations represent the part of the application behaviors that platform teams are interested in standardizing, or the ones to eliminate from developer's mind to make their lives easier."),(0,a.kt)("p",null,"In the case of setting up cloud secrets manager, platform teams need to specify which secrets management solution to use and necessary information to access on the workspace level."),(0,a.kt)("p",null,"A sample ",(0,a.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," with AWS Secrets Manager settings:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"modules:\n ...\nsecretStore:\n provider:\n aws:\n region: us-east-1\n profile: The optional profile to be used to interact with AWS Secrets Manager.\n...\n")),(0,a.kt)("h2",{id:"update-appconfiguration"},"Update AppConfiguration"),(0,a.kt)("p",null,"At this point we are set up for good! Now you can declare external type of secrets via the ",(0,a.kt)("inlineCode",{parentName:"p"},"secrets")," field in the ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model to consume sensitive data stored in AWS Secrets Manager."),(0,a.kt)("p",null,"See the example below for a full, deployable AppConfiguration."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import models.schema.v1 as ac\nimport models.schema.v1.workload as wl\nimport models.schema.v1.workload.container as c\nimport models.schema.v1.workload.secret as sec\n\ngitsync: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "syncer": c.Container {\n image: "dyrnq/git-sync"\n # Run the following command as defined\n command: [\n "--repo=https://github.com/KusionStack/kusion"\n "--ref=HEAD"\n "--root=/mnt/git"\n ]\n # Consume secrets in environment variables\n env: {\n "GIT_SYNC_USERNAME": "secret://git-auth/username"\n "GIT_SYNC_PASSWORD": "secret://git-auth/password"\n }\n }\n }\n # Secrets used to retrieve secret data from AWS Secrets Manager\n secrets: {\n "git-auth": sec.Secret {\n type: "external"\n data: {\n "username": "ref://git-auth-info/username"\n "password": "ref://git-auth-info/password"\n }\n }\n }\n }\n}\n')),(0,a.kt)("h2",{id:"apply-and-verify"},"Apply and Verify"),(0,a.kt)("p",null,"Run ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion apply")," command to deploy above application, then use the below command to verify if the secret got deployed:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"kubectl get secret -n secretdemo\n")),(0,a.kt)("p",null,"You will find ",(0,a.kt)("inlineCode",{parentName:"p"},"git-auth")," of type Opaque automatically created and contains sensitive information pulled from AWS Secrets Manager."))}u.isMDXComponent=!0},24838:(e,t,n)=>{n.d(t,{Z:()=>r});const r=n.p+"assets/images/aws-iam-account-2216105e7fa18fb2f7bf4be7e19f98bd.png"}}]); \ No newline at end of file diff --git a/assets/js/8892d5ac.86e54523.js b/assets/js/8892d5ac.86e54523.js deleted file mode 100644 index 3fd5a76c5a6..00000000000 --- a/assets/js/8892d5ac.86e54523.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4505],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>f});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),l=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},p=function(e){var n=l(e.components);return r.createElement(c.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},d=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=l(t),f=o,m=d["".concat(c,".").concat(f)]||d[f]||u[f]||i;return t?r.createElement(m,a(a({ref:n},p),{},{components:t})):r.createElement(m,a({ref:n},p))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=d;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var l=2;l{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var r=t(87462),o=(t(67294),t(3905));const i={},a="Kusion Modules",s={unversionedId:"reference/modules/index",id:"version-v0.11/reference/modules/index",title:"Kusion Modules",description:"KusionStack presets application configuration models described by KCL, where the model is called Kusion Model. The GitHub repository KusionStack/catalog is used to store these models, which is known as Kusion Model Library.",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/index.md",sourceDirName:"6-reference/2-modules",slug:"/reference/modules/",permalink:"/docs/reference/modules/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/index.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace",permalink:"/docs/reference/commands/kusion-workspace"},next:{title:"appconfiguration",permalink:"/docs/reference/modules/developer-schemas/app-configuration"}},c={},l=[],p={toc:l};function u(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-modules"},"Kusion Modules"),(0,o.kt)("p",null,"KusionStack presets application configuration models described by KCL, where the model is called ",(0,o.kt)("strong",{parentName:"p"},"Kusion Model"),". The GitHub repository ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"KusionStack/catalog")," is used to store these models, which is known as ",(0,o.kt)("strong",{parentName:"p"},"Kusion Model Library"),"."),(0,o.kt)("p",null,"The original intention of designing Kusion Model is to enhance the efficiency and improve the experience of YAML users. Through the unified application model defined by code, abstract and encapsulate complex configuration items, omit repetitive and derivable configurations, and supplement with necessary verification logic. Only the necessary attributes get exposed, users get an out-of-the-box, easy-to-understand configuration interface, which reduces the difficulty and improves the reliability of the configuration work."),(0,o.kt)("p",null,"Kusion Model Library currently provides the Kusion Model ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),". The design of ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," is developer-centric, based on Ant Group's decades of practice in building and managing hyperscale IDP (Internal Developer Platform), and the best practice of community. ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," describes the full lifecycle of an application."),(0,o.kt)("p",null,"A simple example of using ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," to describe an application is as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},'wordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "wordpress": c.Container {\n image: "wordpress:latest"\n env: {\n "WORDPRESS_DB_HOST": "secret://wordpress-db/hostAddress"\n "WORDPRESS_DB_PASSWORD": "secret://wordpress-db/password"\n }\n resources: {\n "cpu": "1"\n "memory": "2Gi"\n }\n }\n }\n replicas: 2\n ports: [\n n.Port {\n port: 80\n public: True\n }\n ]\n }\n \n database: db.Database {\n type: "alicloud"\n engine: "MySQL"\n version: "5.7"\n size: 20\n instanceType: "mysql.n2.serverless.1c"\n category: "serverless_basic"\n }\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8892d5ac.9ea5ed3b.js b/assets/js/8892d5ac.9ea5ed3b.js new file mode 100644 index 00000000000..7f9dec53306 --- /dev/null +++ b/assets/js/8892d5ac.9ea5ed3b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4505],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>f});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),l=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},p=function(e){var n=l(e.components);return r.createElement(c.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},d=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=l(t),f=o,m=d["".concat(c,".").concat(f)]||d[f]||u[f]||i;return t?r.createElement(m,a(a({ref:n},p),{},{components:t})):r.createElement(m,a({ref:n},p))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=d;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var l=2;l{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var r=t(87462),o=(t(67294),t(3905));const i={},a="Kusion Modules",s={unversionedId:"reference/modules/index",id:"version-v0.11/reference/modules/index",title:"Kusion Modules",description:"KusionStack presets application configuration models described by KCL, where the model is called Kusion Model. The GitHub repository KusionStack/catalog is used to store these models, which is known as Kusion Model Library.",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/index.md",sourceDirName:"6-reference/2-modules",slug:"/reference/modules/",permalink:"/docs/reference/modules/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/index.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace",permalink:"/docs/reference/commands/kusion-workspace"},next:{title:"appconfiguration",permalink:"/docs/reference/modules/developer-schemas/app-configuration"}},c={},l=[],p={toc:l};function u(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-modules"},"Kusion Modules"),(0,o.kt)("p",null,"KusionStack presets application configuration models described by KCL, where the model is called ",(0,o.kt)("strong",{parentName:"p"},"Kusion Model"),". The GitHub repository ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"KusionStack/catalog")," is used to store these models, which is known as ",(0,o.kt)("strong",{parentName:"p"},"Kusion Model Library"),"."),(0,o.kt)("p",null,"The original intention of designing Kusion Model is to enhance the efficiency and improve the experience of YAML users. Through the unified application model defined by code, abstract and encapsulate complex configuration items, omit repetitive and derivable configurations, and supplement with necessary verification logic. Only the necessary attributes get exposed, users get an out-of-the-box, easy-to-understand configuration interface, which reduces the difficulty and improves the reliability of the configuration work."),(0,o.kt)("p",null,"Kusion Model Library currently provides the Kusion Model ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),". The design of ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," is developer-centric, based on Ant Group's decades of practice in building and managing hyperscale IDP (Internal Developer Platform), and the best practice of community. ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," describes the full lifecycle of an application."),(0,o.kt)("p",null,"A simple example of using ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," to describe an application is as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},'wordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "wordpress": c.Container {\n image: "wordpress:latest"\n env: {\n "WORDPRESS_DB_HOST": "secret://wordpress-db/hostAddress"\n "WORDPRESS_DB_PASSWORD": "secret://wordpress-db/password"\n }\n resources: {\n "cpu": "1"\n "memory": "2Gi"\n }\n }\n }\n replicas: 2\n ports: [\n n.Port {\n port: 80\n public: True\n }\n ]\n }\n \n database: db.Database {\n type: "alicloud"\n engine: "MySQL"\n version: "5.7"\n size: 20\n instanceType: "mysql.n2.serverless.1c"\n category: "serverless_basic"\n }\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/891a814b.a7aa745a.js b/assets/js/891a814b.de2a1f1e.js similarity index 50% rename from assets/js/891a814b.a7aa745a.js rename to assets/js/891a814b.de2a1f1e.js index d6e051fbe18..8148319f872 100644 --- a/assets/js/891a814b.a7aa745a.js +++ b/assets/js/891a814b.de2a1f1e.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8514],{3905:(e,r,n)=>{n.d(r,{Zo:()=>l,kt:()=>f});var o=n(67294);function t(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function a(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,o)}return n}function s(e){for(var r=1;r=0||(t[n]=e[n]);return t}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var c=o.createContext({}),p=function(e){var r=o.useContext(c),n=r;return e&&(n="function"==typeof e?e(r):s(s({},r),e)),n},l=function(e){var r=p(e.components);return o.createElement(c.Provider,{value:r},e.children)},u={inlineCode:"code",wrapper:function(e){var r=e.children;return o.createElement(o.Fragment,{},r)}},d=o.forwardRef((function(e,r){var n=e.components,t=e.mdxType,a=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=p(n),f=t,m=d["".concat(c,".").concat(f)]||d[f]||u[f]||a;return n?o.createElement(m,s(s({ref:r},l),{},{components:n})):o.createElement(m,s({ref:r},l))}));function f(e,r){var n=arguments,t=r&&r.mdxType;if("string"==typeof e||t){var a=n.length,s=new Array(a);s[0]=d;var i={};for(var c in r)hasOwnProperty.call(r,c)&&(i[c]=r[c]);i.originalType=e,i.mdxType="string"==typeof e?e:t,s[1]=i;for(var p=2;p{n.r(r),n.d(r,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var o=n(87462),t=(n(67294),n(3905));const a={},s="kusion workspace show",i={unversionedId:"reference/commands/kusion-workspace-show",id:"version-v0.11/reference/commands/kusion-workspace-show",title:"kusion workspace show",description:"Show a workspace configuration",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-show.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-show",permalink:"/docs/reference/commands/kusion-workspace-show",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-show.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace list",permalink:"/docs/reference/commands/kusion-workspace-list"},next:{title:"kusion workspace switch",permalink:"/docs/reference/commands/kusion-workspace-switch"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:r,...n}=e;return(0,t.kt)("wrapper",(0,o.Z)({},l,n,{components:r,mdxType:"MDXLayout"}),(0,t.kt)("h1",{id:"kusion-workspace-show"},"kusion workspace show"),(0,t.kt)("p",null,"Show a workspace configuration"),(0,t.kt)("h3",{id:"synopsis"},"Synopsis"),(0,t.kt)("p",null,"This command gets the current or a specified workspace configuration."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre"},"kusion workspace show\n")),(0,t.kt)("h3",{id:"examples"},"Examples"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre"}," # Show current workspace configuration\n kusion workspace show\n \n # Show a specified workspace configuration\n kusion workspace show dev\n \n # Show a specified workspace in a specified backend\n kusion workspace show prod --backend oss-prod\n")),(0,t.kt)("h3",{id:"options"},"Options"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre"}," --backend string the backend name\n -h, --help help for show\n")),(0,t.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,t.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,t.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8514],{3905:(e,r,n)=>{n.d(r,{Zo:()=>l,kt:()=>f});var o=n(67294);function t(e,r,n){return r in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function a(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,o)}return n}function s(e){for(var r=1;r=0||(t[n]=e[n]);return t}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}var c=o.createContext({}),p=function(e){var r=o.useContext(c),n=r;return e&&(n="function"==typeof e?e(r):s(s({},r),e)),n},l=function(e){var r=p(e.components);return o.createElement(c.Provider,{value:r},e.children)},u={inlineCode:"code",wrapper:function(e){var r=e.children;return o.createElement(o.Fragment,{},r)}},d=o.forwardRef((function(e,r){var n=e.components,t=e.mdxType,a=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=p(n),f=t,k=d["".concat(c,".").concat(f)]||d[f]||u[f]||a;return n?o.createElement(k,s(s({ref:r},l),{},{components:n})):o.createElement(k,s({ref:r},l))}));function f(e,r){var n=arguments,t=r&&r.mdxType;if("string"==typeof e||t){var a=n.length,s=new Array(a);s[0]=d;var i={};for(var c in r)hasOwnProperty.call(r,c)&&(i[c]=r[c]);i.originalType=e,i.mdxType="string"==typeof e?e:t,s[1]=i;for(var p=2;p{n.r(r),n.d(r,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var o=n(87462),t=(n(67294),n(3905));const a={},s="kusion workspace show",i={unversionedId:"reference/commands/kusion-workspace-show",id:"version-v0.11/reference/commands/kusion-workspace-show",title:"kusion workspace show",description:"Show a workspace configuration",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-show.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-show",permalink:"/docs/reference/commands/kusion-workspace-show",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-show.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace list",permalink:"/docs/reference/commands/kusion-workspace-list"},next:{title:"kusion workspace switch",permalink:"/docs/reference/commands/kusion-workspace-switch"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:r,...n}=e;return(0,t.kt)("wrapper",(0,o.Z)({},l,n,{components:r,mdxType:"MDXLayout"}),(0,t.kt)("h1",{id:"kusion-workspace-show"},"kusion workspace show"),(0,t.kt)("p",null,"Show a workspace configuration"),(0,t.kt)("h3",{id:"synopsis"},"Synopsis"),(0,t.kt)("p",null,"This command gets the current or a specified workspace configuration."),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre"},"kusion workspace show\n")),(0,t.kt)("h3",{id:"examples"},"Examples"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre"}," # Show current workspace configuration\n kusion workspace show\n \n # Show a specified workspace configuration\n kusion workspace show dev\n \n # Show a specified workspace in a specified backend\n kusion workspace show prod --backend oss-prod\n")),(0,t.kt)("h3",{id:"options"},"Options"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre"}," --backend string the backend name\n -h, --help help for show\n")),(0,t.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,t.kt)("pre",null,(0,t.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,t.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,t.kt)("ul",null,(0,t.kt)("li",{parentName:"ul"},(0,t.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,t.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/891ff042.ce730ce0.js b/assets/js/891ff042.ce730ce0.js deleted file mode 100644 index 9189ebea303..00000000000 --- a/assets/js/891ff042.ce730ce0.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3769],{3905:(e,r,t)=>{t.d(r,{Zo:()=>u,kt:()=>m});var o=t(67294);function n(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function s(e){for(var r=1;r=0||(n[t]=e[t]);return n}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t])}return n}var l=o.createContext({}),p=function(e){var r=o.useContext(l),t=r;return e&&(t="function"==typeof e?e(r):s(s({},r),e)),t},u=function(e){var r=p(e.components);return o.createElement(l.Provider,{value:r},e.children)},c={inlineCode:"code",wrapper:function(e){var r=e.children;return o.createElement(o.Fragment,{},r)}},d=o.forwardRef((function(e,r){var t=e.components,n=e.mdxType,a=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=p(t),m=n,f=d["".concat(l,".").concat(m)]||d[m]||c[m]||a;return t?o.createElement(f,s(s({ref:r},u),{},{components:t})):o.createElement(f,s({ref:r},u))}));function m(e,r){var t=arguments,n=r&&r.mdxType;if("string"==typeof e||n){var a=t.length,s=new Array(a);s[0]=d;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i.mdxType="string"==typeof e?e:n,s[1]=i;for(var p=2;p{t.r(r),t.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var o=t(87462),n=(t(67294),t(3905));const a={},s="Roadmap",i={unversionedId:"reference/roadmap",id:"version-v0.9/reference/roadmap",title:"Roadmap",description:"For a finer-grained view into our roadmap and what is being worked on for a release, please refer to the GitHub Issue Tracker",source:"@site/docs_versioned_docs/version-v0.9/reference/roadmap.md",sourceDirName:"reference",slug:"/reference/roadmap",permalink:"/docs/v0.9/reference/roadmap",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/roadmap.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Project & Stack Config Items",permalink:"/docs/v0.9/reference/model/project-stack-config-items"},next:{title:"FAQ",permalink:"/docs/v0.9/support/"}},l={},p=[{value:"Resource Ecosystem",id:"resource-ecosystem",level:2},{value:"App Progressive Rollout",id:"app-progressive-rollout",level:2},{value:"Custom Pipelines",id:"custom-pipelines",level:2},{value:"Runtime Plugin",id:"runtime-plugin",level:2}],u={toc:p};function c(e){let{components:r,...t}=e;return(0,n.kt)("wrapper",(0,o.Z)({},u,t,{components:r,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"roadmap"},"Roadmap"),(0,n.kt)("p",null,"For a finer-grained view into our roadmap and what is being worked on for a release, please refer to the ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/issues"},"GitHub Issue Tracker")),(0,n.kt)("h2",{id:"resource-ecosystem"},"Resource Ecosystem"),(0,n.kt)("p",null,"We plan to expand the range of resource types that our platform can handle. This includes not only traditional cloud IaaS resources, but also popular cloud-native products such as Prometheus, istio and Argo. By supporting a wider variety of resources, we aim to address the heterogeneous needs of modern applications and allow users to harness the full power of the cloud-native technologies."),(0,n.kt)("h2",{id:"app-progressive-rollout"},"App Progressive Rollout"),(0,n.kt)("p",null,"One of the key challenges in delivering applications at scale is to balance the need for speed with the need for reliability. To help our users achieve this balance, we will introduce progressive rollout strategies, such as canary release, rolling release, and percentage release. These techniques enable users to test new features or versions on a small subset of their users or infrastructure before rolling them out to the entire system. By doing so, users can minimize the risk of downtime or errors caused by untested changes."),(0,n.kt)("h2",{id:"custom-pipelines"},"Custom Pipelines"),(0,n.kt)("p",null,"Thie current workflow of KusionStack is ",(0,n.kt)("inlineCode",{parentName:"p"},"write"),",",(0,n.kt)("inlineCode",{parentName:"p"},"preview")," and ",(0,n.kt)("inlineCode",{parentName:"p"},"apply"),", but to handle more complex deployments we need to empower users to customize the deployment pipelines to fit their specific workflows and requirements. This includes the ability to define custom stages, add or remove steps, and integrate with third-party tools. With customizable pipelines, users can streamline their deployment process, automate repetitive tasks, and satisfy their own needs by themself."),(0,n.kt)("h2",{id:"runtime-plugin"},"Runtime Plugin"),(0,n.kt)("p",null,"We have already supported IaaS cloud resources and Kubernetes resources, but we need a more flexible mechanism to support a broader range of on-premise infrastructure. By supporting a diverse set of infrastructures, we can help users avoid vendor lock-in, optimize their resource usage, and scale their applications across different regions and geographies."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/891ff042.f1877020.js b/assets/js/891ff042.f1877020.js new file mode 100644 index 00000000000..3fe0a60de47 --- /dev/null +++ b/assets/js/891ff042.f1877020.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3769],{3905:(e,r,t)=>{t.d(r,{Zo:()=>u,kt:()=>m});var o=t(67294);function n(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function s(e){for(var r=1;r=0||(n[t]=e[t]);return n}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t])}return n}var l=o.createContext({}),p=function(e){var r=o.useContext(l),t=r;return e&&(t="function"==typeof e?e(r):s(s({},r),e)),t},u=function(e){var r=p(e.components);return o.createElement(l.Provider,{value:r},e.children)},c={inlineCode:"code",wrapper:function(e){var r=e.children;return o.createElement(o.Fragment,{},r)}},d=o.forwardRef((function(e,r){var t=e.components,n=e.mdxType,a=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),d=p(t),m=n,f=d["".concat(l,".").concat(m)]||d[m]||c[m]||a;return t?o.createElement(f,s(s({ref:r},u),{},{components:t})):o.createElement(f,s({ref:r},u))}));function m(e,r){var t=arguments,n=r&&r.mdxType;if("string"==typeof e||n){var a=t.length,s=new Array(a);s[0]=d;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i.mdxType="string"==typeof e?e:n,s[1]=i;for(var p=2;p{t.r(r),t.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var o=t(87462),n=(t(67294),t(3905));const a={},s="Roadmap",i={unversionedId:"reference/roadmap",id:"version-v0.9/reference/roadmap",title:"Roadmap",description:"For a finer-grained view into our roadmap and what is being worked on for a release, please refer to the GitHub Issue Tracker",source:"@site/docs_versioned_docs/version-v0.9/reference/roadmap.md",sourceDirName:"reference",slug:"/reference/roadmap",permalink:"/docs/v0.9/reference/roadmap",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/roadmap.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Project & Stack Config Items",permalink:"/docs/v0.9/reference/model/project-stack-config-items"},next:{title:"FAQ",permalink:"/docs/v0.9/support/"}},l={},p=[{value:"Resource Ecosystem",id:"resource-ecosystem",level:2},{value:"App Progressive Rollout",id:"app-progressive-rollout",level:2},{value:"Custom Pipelines",id:"custom-pipelines",level:2},{value:"Runtime Plugin",id:"runtime-plugin",level:2}],u={toc:p};function c(e){let{components:r,...t}=e;return(0,n.kt)("wrapper",(0,o.Z)({},u,t,{components:r,mdxType:"MDXLayout"}),(0,n.kt)("h1",{id:"roadmap"},"Roadmap"),(0,n.kt)("p",null,"For a finer-grained view into our roadmap and what is being worked on for a release, please refer to the ",(0,n.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/issues"},"GitHub Issue Tracker")),(0,n.kt)("h2",{id:"resource-ecosystem"},"Resource Ecosystem"),(0,n.kt)("p",null,"We plan to expand the range of resource types that our platform can handle. This includes not only traditional cloud IaaS resources, but also popular cloud-native products such as Prometheus, istio and Argo. By supporting a wider variety of resources, we aim to address the heterogeneous needs of modern applications and allow users to harness the full power of the cloud-native technologies."),(0,n.kt)("h2",{id:"app-progressive-rollout"},"App Progressive Rollout"),(0,n.kt)("p",null,"One of the key challenges in delivering applications at scale is to balance the need for speed with the need for reliability. To help our users achieve this balance, we will introduce progressive rollout strategies, such as canary release, rolling release, and percentage release. These techniques enable users to test new features or versions on a small subset of their users or infrastructure before rolling them out to the entire system. By doing so, users can minimize the risk of downtime or errors caused by untested changes."),(0,n.kt)("h2",{id:"custom-pipelines"},"Custom Pipelines"),(0,n.kt)("p",null,"Thie current workflow of KusionStack is ",(0,n.kt)("inlineCode",{parentName:"p"},"write"),",",(0,n.kt)("inlineCode",{parentName:"p"},"preview")," and ",(0,n.kt)("inlineCode",{parentName:"p"},"apply"),", but to handle more complex deployments we need to empower users to customize the deployment pipelines to fit their specific workflows and requirements. This includes the ability to define custom stages, add or remove steps, and integrate with third-party tools. With customizable pipelines, users can streamline their deployment process, automate repetitive tasks, and satisfy their own needs by themself."),(0,n.kt)("h2",{id:"runtime-plugin"},"Runtime Plugin"),(0,n.kt)("p",null,"We have already supported IaaS cloud resources and Kubernetes resources, but we need a more flexible mechanism to support a broader range of on-premise infrastructure. By supporting a diverse set of infrastructures, we can help users avoid vendor lock-in, optimize their resource usage, and scale their applications across different regions and geographies."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8953171e.1bc88db1.js b/assets/js/8953171e.1bc88db1.js new file mode 100644 index 00000000000..854c14e517e --- /dev/null +++ b/assets/js/8953171e.1bc88db1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6338],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),l=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},p=function(e){var n=l(e.components);return r.createElement(c.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=l(t),m=o,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||a;return t?r.createElement(f,i(i({ref:n},p),{},{components:t})):r.createElement(f,i({ref:n},p))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=u;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=t(87462),o=(t(67294),t(3905));const a={sidebar_position:3},i="Base and Override",s={unversionedId:"config-walkthrough/base_override",id:"version-v0.9/config-walkthrough/base_override",title:"Base and Override",description:"In practice, what we have observed for production-grade applications is that they usually need to be deployed to a wide range of different targets, be it different environments in the SDLC, or different clouds, regions or runtimes for cost/regulation/performance or disaster recovery related reasons.",source:"@site/docs_versioned_docs/version-v0.9/config-walkthrough/base_override.md",sourceDirName:"config-walkthrough",slug:"/config-walkthrough/base_override",permalink:"/docs/v0.9/config-walkthrough/base_override",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/config-walkthrough/base_override.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"kusion",previous:{title:"KCL Basics",permalink:"/docs/v0.9/config-walkthrough/kcl_basics"},next:{title:"Workload",permalink:"/docs/v0.9/config-walkthrough/workload"}},c={},l=[],p={toc:l};function d(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"base-and-override"},"Base and Override"),(0,o.kt)("p",null,"In practice, what we have observed for production-grade applications is that they usually need to be deployed to a wide range of different targets, be it different environments in the SDLC, or different clouds, regions or runtimes for cost/regulation/performance or disaster recovery related reasons."),(0,o.kt)("p",null,"In that context, we advocate for a pattern where you can leverage some Kusion and KCL features to minimize the amount of duplicate configurations, by separating the common base application configuration and environment-specific ones."),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"The file names in the below examples don't matter as long as they are called out and appear in the correct order in the ",(0,o.kt)("inlineCode",{parentName:"p"},"entries")," field (the field is a list) in ",(0,o.kt)("inlineCode",{parentName:"p"},"kcl.mod"),". The files with common configurations should appear first in the list and stack-specific ones last. The latter one takes precedence."),(0,o.kt)("p",{parentName:"admonition"},"The configurations also don't have be placed into a single ",(0,o.kt)("inlineCode",{parentName:"p"},".k")," file. For complex projects, they can be broken down into smaller organized ",(0,o.kt)("inlineCode",{parentName:"p"},".k")," files for better readability. ")),(0,o.kt)("p",null,"Base configuration defined in ",(0,o.kt)("inlineCode",{parentName:"p"},"base/base.k"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.network as n\nimport catalog.models.schema.v1.workload.container as c\n\nmyapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: ""\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n}\n')),(0,o.kt)("p",null,"Environment-specific configuration defined in ",(0,o.kt)("inlineCode",{parentName:"p"},"dev/main.k"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\n\n# main.k declares customized configurations for dev stack.\nmyapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n # dev stack has different app configuration from the base\n image = "gcr.io/google-samples/gb-frontend:v5"\n resources = {\n "cpu": "250m"\n "memory": "256Mi"\n }\n }\n }\n replicas = 2\n }\n}\n')),(0,o.kt)("p",null,"Alternatively, you could locate a specific property (in this case below, the ",(0,o.kt)("inlineCode",{parentName:"p"},"Container")," object) in the ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," object using the dot selector shorthand(such as ",(0,o.kt)("inlineCode",{parentName:"p"},"workload.containers.myapp")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"workload.replicas")," below):"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\n\n# main.k declares customized configurations for dev stack.\nmyapp: ac.AppConfiguration {\n workload.replicas = 2\n workload.containers.myapp: {\n # dev stack has different app configuration\n image = "gcr.io/google-samples/gb-frontend:v5"\n resources = {\n "cpu": "250m"\n "memory": "256Mi"\n }\n }\n}\n')),(0,o.kt)("p",null,"This is especially useful when the application configuration is complex but the override is relatively straightforward."),(0,o.kt)("p",null,"The two examples above are equivalent when overriding the base."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8953171e.a6a9cbaf.js b/assets/js/8953171e.a6a9cbaf.js deleted file mode 100644 index a8fe6d87997..00000000000 --- a/assets/js/8953171e.a6a9cbaf.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6338],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),l=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},p=function(e){var n=l(e.components);return r.createElement(c.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=l(t),m=o,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||a;return t?r.createElement(f,i(i({ref:n},p),{},{components:t})):r.createElement(f,i({ref:n},p))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=u;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=t(87462),o=(t(67294),t(3905));const a={sidebar_position:3},i="Base and Override",s={unversionedId:"config-walkthrough/base_override",id:"version-v0.9/config-walkthrough/base_override",title:"Base and Override",description:"In practice, what we have observed for production-grade applications is that they usually need to be deployed to a wide range of different targets, be it different environments in the SDLC, or different clouds, regions or runtimes for cost/regulation/performance or disaster recovery related reasons.",source:"@site/docs_versioned_docs/version-v0.9/config-walkthrough/base_override.md",sourceDirName:"config-walkthrough",slug:"/config-walkthrough/base_override",permalink:"/docs/v0.9/config-walkthrough/base_override",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/config-walkthrough/base_override.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"kusion",previous:{title:"KCL Basics",permalink:"/docs/v0.9/config-walkthrough/kcl_basics"},next:{title:"Workload",permalink:"/docs/v0.9/config-walkthrough/workload"}},c={},l=[],p={toc:l};function d(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"base-and-override"},"Base and Override"),(0,o.kt)("p",null,"In practice, what we have observed for production-grade applications is that they usually need to be deployed to a wide range of different targets, be it different environments in the SDLC, or different clouds, regions or runtimes for cost/regulation/performance or disaster recovery related reasons."),(0,o.kt)("p",null,"In that context, we advocate for a pattern where you can leverage some Kusion and KCL features to minimize the amount of duplicate configurations, by separating the common base application configuration and environment-specific ones."),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"The file names in the below examples don't matter as long as they are called out and appear in the correct order in the ",(0,o.kt)("inlineCode",{parentName:"p"},"entries")," field (the field is a list) in ",(0,o.kt)("inlineCode",{parentName:"p"},"kcl.mod"),". The files with common configurations should appear first in the list and stack-specific ones last. The latter one takes precedence."),(0,o.kt)("p",{parentName:"admonition"},"The configurations also don't have be placed into a single ",(0,o.kt)("inlineCode",{parentName:"p"},".k")," file. For complex projects, they can be broken down into smaller organized ",(0,o.kt)("inlineCode",{parentName:"p"},".k")," files for better readability. ")),(0,o.kt)("p",null,"Base configuration defined in ",(0,o.kt)("inlineCode",{parentName:"p"},"base/base.k"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.network as n\nimport catalog.models.schema.v1.workload.container as c\n\nmyapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: ""\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n}\n')),(0,o.kt)("p",null,"Environment-specific configuration defined in ",(0,o.kt)("inlineCode",{parentName:"p"},"dev/main.k"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\n\n# main.k declares customized configurations for dev stack.\nmyapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n # dev stack has different app configuration from the base\n image = "gcr.io/google-samples/gb-frontend:v5"\n resources = {\n "cpu": "250m"\n "memory": "256Mi"\n }\n }\n }\n replicas = 2\n }\n}\n')),(0,o.kt)("p",null,"Alternatively, you could locate a specific property (in this case below, the ",(0,o.kt)("inlineCode",{parentName:"p"},"Container")," object) in the ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," object using the dot selector shorthand(such as ",(0,o.kt)("inlineCode",{parentName:"p"},"workload.containers.myapp")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"workload.replicas")," below):"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\n\n# main.k declares customized configurations for dev stack.\nmyapp: ac.AppConfiguration {\n workload.replicas = 2\n workload.containers.myapp: {\n # dev stack has different app configuration\n image = "gcr.io/google-samples/gb-frontend:v5"\n resources = {\n "cpu": "250m"\n "memory": "256Mi"\n }\n }\n}\n')),(0,o.kt)("p",null,"This is especially useful when the application configuration is complex but the override is relatively straightforward."),(0,o.kt)("p",null,"The two examples above are equivalent when overriding the base."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8af73e9a.64f55652.js b/assets/js/8af73e9a.64f55652.js new file mode 100644 index 00000000000..420a5e1d812 --- /dev/null +++ b/assets/js/8af73e9a.64f55652.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[230],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var i=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=i.createContext({}),p=function(e){var t=i.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},c=function(e){var t=p(e.components);return i.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},d=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(n),m=a,k=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return n?i.createElement(k,r(r({ref:t},c),{},{components:n})):i.createElement(k,r({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,r=new Array(o);r[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,r[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>r,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var i=n(87462),a=(n(67294),n(3905));const o={},r="Deploy Application",l={unversionedId:"user-guides/working-with-k8s/deploy-application",id:"version-v0.10/user-guides/working-with-k8s/deploy-application",title:"Deploy Application",description:"This guide shows you how to use Kusion CLIs to complete the deployment of an application running in Kubernetes.",source:"@site/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/1-deploy-application.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/deploy-application",permalink:"/docs/v0.10/user-guides/working-with-k8s/deploy-application",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/1-deploy-application.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{},sidebar:"kusion",previous:{title:"Expose Application Service Deployed on CSP Kubernetes",permalink:"/docs/v0.10/user-guides/cloud-resources/expose-service"},next:{title:"Configure Containers",permalink:"/docs/v0.10/user-guides/working-with-k8s/container"}},s={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Initializing",id:"initializing",level:2},{value:"Initializing workspace configuration",id:"initializing-workspace-configuration",level:2},{value:"Initializing application configuration",id:"initializing-application-configuration",level:2},{value:"kcl.mod",id:"kclmod",level:3},{value:"Building",id:"building",level:2},{value:"Applying",id:"applying",level:2}],c={toc:p};function u(e){let{components:t,...o}=e;return(0,a.kt)("wrapper",(0,i.Z)({},c,o,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"deploy-application"},"Deploy Application"),(0,a.kt)("p",null,"This guide shows you how to use Kusion CLIs to complete the deployment of an application running in Kubernetes.\nWe call the abstraction of application operation and maintenance configuration as ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),", and its instance as ",(0,a.kt)("inlineCode",{parentName:"p"},"Application"),".\nIt is essentially a configuration model that describes an application. The complete definition can be seen ",(0,a.kt)("a",{parentName:"p",href:"../../reference/modules/catalog-models/app-configuration"},"here"),"."),(0,a.kt)("p",null,"In production, the application generally includes minimally several k8s resources:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Namespace"),(0,a.kt)("li",{parentName:"ul"},"Deployment"),(0,a.kt)("li",{parentName:"ul"},"Service")),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"This guide requires you to have a basic understanding of Kubernetes.\nIf you are not familiar with the relevant concepts, please refer to the links below:"),(0,a.kt)("ul",{parentName:"admonition"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/tutorials/kubernetes-basics/"},"Learn Kubernetes Basics")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/"},"Namespace")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/concepts/workloads/controllers/deployment/"},"Deployment")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/concepts/services-networking/service/"},"Service")))),(0,a.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,a.kt)("p",null,"Before we start, we need to complete the following steps:"),(0,a.kt)("p",null,"1\u3001Install Kusion"),(0,a.kt)("p",null,"We recommend using HomeBrew(Mac), Scoop(Windows), or an installation shell script to download and install Kusion.\nSee ",(0,a.kt)("a",{parentName:"p",href:"../../getting-started/install-kusion"},"Download and Install")," for more details."),(0,a.kt)("p",null,"2\u3001Running Kubernetes cluster"),(0,a.kt)("p",null,"There must be a running Kubernetes cluster and a ",(0,a.kt)("a",{parentName:"p",href:"https://Kubernetes.io/docs/tasks/tools/#kubectl"},"kubectl")," command line tool.\nIf you don't have a cluster yet, you can use ",(0,a.kt)("a",{parentName:"p",href:"https://minikube.sigs.k8s.io/docs/tutorials/multi_node/"},"Minikube")," to start one of your own."),(0,a.kt)("h2",{id:"initializing"},"Initializing"),(0,a.kt)("p",null,"This guide is to deploy an app using Kusion, relying on the Kusion CLI and an existing a Kubernetes cluster."),(0,a.kt)("h2",{id:"initializing-workspace-configuration"},"Initializing workspace configuration"),(0,a.kt)("p",null,"In version 0.10.0, we have introduced the new concept of ",(0,a.kt)("a",{parentName:"p",href:"../../concepts/workspace"},"workspaces"),', which is a logical layer whose configurations represent an opinionated set of defaults, often appointed by the platform team. In most cases workspaces are represented with an "environment" in traditional SDLC terms. These workspaces provide a means to separate the concerns between the application developers who wish to focus on business logic, and a group of platform engineers who wish to standardize the applications on the platform.'),(0,a.kt)("p",null,"Driven by the discipline of Platform Engineering, management of the workspaces, including create/updating/deleting workspaces and their configurations should be done by dedicated platform engineers in a large software organizations to facilitate a more mature and scalable collaboration pattern."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"More on the collaboration pattern can be found in the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/design/collaboration/collaboration_paradigm.md"},"design doc"),".")),(0,a.kt)("p",null,"However, if that does NOT apply to your scenario, e.g. if you work in a smaller org without platform engineers or if you are an individual developer, we wish Kusion can still be a value tool to have when delivering an application. In this guide, we are NOT distinctively highlighting the different roles or what the best practices entails (the design doc above has all that) but rather the steps needed to get Kusion tool to work."),(0,a.kt)("p",null,"As of version 0.10.0, workspace configurations in Kusion are managed on the local filesystem and their values are sourced from YAML files. Remotely-managed workspaces will be supported in future versions."),(0,a.kt)("p",null,"To initialize the workspace configuration:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"~/playground$ touch ~/dev.yaml\n~/playground$ kusion workspace create dev -f ~/dev.yaml\ncreate workspace dev successfully\n")),(0,a.kt)("p",null,"To verify the workspace has been created properly:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"~/playground$ kusion workspace list\n- dev\n~/playground$ kusion workspace show dev\n{}\n")),(0,a.kt)("p",null,"Note that ",(0,a.kt)("inlineCode",{parentName:"p"},"show")," command tells us the workspace configuration is currently empty, which is expected because we created the ",(0,a.kt)("inlineCode",{parentName:"p"},"dev")," workspace with an empty YAML file. An empty workspace configuration will suffice in some cases, where no platform configurations are needed."),(0,a.kt)("p",null,"We will progressively add more workspace configurations throughout this user guide."),(0,a.kt)("h2",{id:"initializing-application-configuration"},"Initializing application configuration"),(0,a.kt)("p",null,"Now that workspaces are properly initialized, we can begin by initializing the application configuration:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kusion init\n")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init")," command will prompt you to enter required parameters, such as project name, project description, image address, etc.\nYou can keep pressing ",(0,a.kt)("em",{parentName:"p"},"Enter")," all the way to use the default values."),(0,a.kt)("p",null,"The output is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"\u2714 single-stack-sample A minimal kusion project of single stack\nThis command will walk you through creating a new kusion project.\n\nEnter a value or leave blank to accept the (default), and press .\nPress ^C at any time to quit.\n\nProject Config:\n\u2714 Project Name: simple-service\n\u2714 AppName: helloworld\n\u2714 ProjectName: simple-service\nStack Config: dev\n\u2714 Image: gcr.io/google-samples/gb-frontend:v4\nCreated project 'simple-service'\n")),(0,a.kt)("p",null,"Now, we have successfully initialized a project ",(0,a.kt)("inlineCode",{parentName:"p"},"simple-service")," using the ",(0,a.kt)("inlineCode",{parentName:"p"},"single-stack-sample")," template, which contains a ",(0,a.kt)("inlineCode",{parentName:"p"},"dev")," stack. "),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"AppName")," represents the name of the sample application, which is recorded in the generated ",(0,a.kt)("inlineCode",{parentName:"li"},"main.k")," as the name of the ",(0,a.kt)("inlineCode",{parentName:"li"},"AppConfiguration")," instance."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"ProjectName")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"Project Name")," represent the name of the sample project, which is used as the generated folder name and then recorded in the generated ",(0,a.kt)("inlineCode",{parentName:"li"},"project.yaml"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Image")," represents the image address of the application container.")),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"See ",(0,a.kt)("a",{parentName:"p",href:"../../concepts/project/overview"},"Project")," and ",(0,a.kt)("a",{parentName:"p",href:"../../concepts/stack/overview"},"Stack")," for more details about Project and Stack.")),(0,a.kt)("p",null,"The directory structure is as follows:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"simple-service/\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod.lock\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n\n2 directories, 6 files\n")),(0,a.kt)("p",null,"The project directory has the following files that are automatically generated:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"README.md")," contains the generated README from a template."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"project.yaml")," represents project-level configurations."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dev")," directory stores the customized stack configuration:",(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dev/main.k")," stores configurations in the ",(0,a.kt)("inlineCode",{parentName:"li"},"dev")," stack."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dev/stack.yaml")," stores stack-level configurations."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dev/kcl.mod")," stores stack-level dependencies."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dev/kcl.mod.lock")," stores version-sensitive dependencies.")))),(0,a.kt)("p",null,"In general, the ",(0,a.kt)("inlineCode",{parentName:"p"},".k")," files are the KCL source code that represents the application configuration, and the ",(0,a.kt)("inlineCode",{parentName:"p"},".yaml")," is the static configuration file that describes behavior at the project or stack level."),(0,a.kt)("h3",{id:"kclmod"},"kcl.mod"),(0,a.kt)("p",null,"There should be a ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file generated automatically under the project directory. The ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file describes the dependency for the current project or stack. By default, it should contain a reference to the official ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},(0,a.kt)("inlineCode",{parentName:"a"},"catalog")," repository")," which holds some common model definitions that fits best practices. You can also create your own models library and reference that."),(0,a.kt)("h2",{id:"building"},"Building"),(0,a.kt)("p",null,"At this point, the project has been initialized with the Kusion built-in template.\nThe configuration is written in KCL, not JSON/YAML which Kubernetes recognizes, so it needs to be built to get the final output."),(0,a.kt)("p",null,"Enter stack dir ",(0,a.kt)("inlineCode",{parentName:"p"},"simple-service/dev")," and build:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cd simple-service/dev && kusion build\n")),(0,a.kt)("p",null,"The output is printed to ",(0,a.kt)("inlineCode",{parentName:"p"},"stdout")," by default. You can save it to a file using the ",(0,a.kt)("inlineCode",{parentName:"p"},"-o/--output")," flag when running ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion build"),"."),(0,a.kt)("p",null,"The output of ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion build")," is the ",(0,a.kt)("a",{parentName:"p",href:"../../concepts/intent"},"intent")," format."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"For instructions on the kusion command line tool, execute ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion -h"),", or refer to the tool's online ",(0,a.kt)("a",{parentName:"p",href:"../../reference/commands"},"documentation"),".")),(0,a.kt)("h2",{id:"applying"},"Applying"),(0,a.kt)("p",null,"Build is now completed. We can apply the configuration as the next step. In the output from ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion build"),", you can see 3 resources:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"a Namespace named ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service")),(0,a.kt)("li",{parentName:"ul"},"a Deployment named ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service-dev-helloworld")," in the ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service")," namespace"),(0,a.kt)("li",{parentName:"ul"},"a Service named ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service-dev-helloworld-private")," in the ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service")," namespace")),(0,a.kt)("p",null,"Execute command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kusion apply\n")),(0,a.kt)("p",null,"The output is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"}," \u2714\ufe0e Generating Intent in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service Create\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private Create\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Create\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS Create v1:Namespace:simple-service success \n SUCCESS Create v1:Service:simple-service:simple-service-dev-helloworld-private success \n SUCCESS Create apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \nCreate apps/v1:Deployment:simple-service:simple-service-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 3 created, 0 updated, 0 deleted.\n")),(0,a.kt)("p",null,"After the configuration applying successfully, you can use the ",(0,a.kt)("inlineCode",{parentName:"p"},"kubectl")," to check the actual status of these resources."),(0,a.kt)("p",null,"1\u3001 Check Namespace"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get ns\n")),(0,a.kt)("p",null,"The output is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"NAME STATUS AGE\ndefault Active 117d\nsimple-service Active 38s\nkube-system Active 117d\n...\n")),(0,a.kt)("p",null,"2\u3001Check Deployment"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get deploy -n simple-service\n")),(0,a.kt)("p",null,"The output is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"NAME READY UP-TO-DATE AVAILABLE AGE\nsimple-service-dev-helloworld 1/1 1 1 59s\n")),(0,a.kt)("p",null,"3\u3001Check Service"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get svc -n simple-service\n")),(0,a.kt)("p",null,"The output is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\nsimple-service-dev-helloworld-private ClusterIP 10.98.89.104 80/TCP 79s\n")),(0,a.kt)("p",null,"4\u3001Validate app"),(0,a.kt)("p",null,"Using the ",(0,a.kt)("inlineCode",{parentName:"p"},"kubectl")," tool, forward native port ",(0,a.kt)("inlineCode",{parentName:"p"},"30000")," to the service port ",(0,a.kt)("inlineCode",{parentName:"p"},"80"),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl port-forward svc/simple-service-dev-helloworld-private -n simple-service 30000:80\n")),(0,a.kt)("p",null,"Open browser and visit ",(0,a.kt)("a",{parentName:"p",href:"http://127.0.0.1:30000"},"http://127.0.0.1:30000"),"\uff1a"),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"app-preview",src:n(92287).Z,width:"1830",height:"330"})))}u.isMDXComponent=!0},92287:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/app-preview-de5274f4267fa725d2a65099e47c6c2c.png"}}]); \ No newline at end of file diff --git a/assets/js/8af73e9a.e866ca18.js b/assets/js/8af73e9a.e866ca18.js deleted file mode 100644 index cbb161d014d..00000000000 --- a/assets/js/8af73e9a.e866ca18.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[230],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var i=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=i.createContext({}),p=function(e){var t=i.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},c=function(e){var t=p(e.components);return i.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},d=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(n),m=a,k=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return n?i.createElement(k,r(r({ref:t},c),{},{components:n})):i.createElement(k,r({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,r=new Array(o);r[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,r[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>r,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var i=n(87462),a=(n(67294),n(3905));const o={},r="Deploy Application",l={unversionedId:"user-guides/working-with-k8s/deploy-application",id:"version-v0.10/user-guides/working-with-k8s/deploy-application",title:"Deploy Application",description:"This guide shows you how to use Kusion CLIs to complete the deployment of an application running in Kubernetes.",source:"@site/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/1-deploy-application.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/deploy-application",permalink:"/docs/v0.10/user-guides/working-with-k8s/deploy-application",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/1-deploy-application.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{},sidebar:"kusion",previous:{title:"Expose Application Service Deployed on CSP Kubernetes",permalink:"/docs/v0.10/user-guides/cloud-resources/expose-service"},next:{title:"Configure Containers",permalink:"/docs/v0.10/user-guides/working-with-k8s/container"}},s={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Initializing",id:"initializing",level:2},{value:"Initializing workspace configuration",id:"initializing-workspace-configuration",level:2},{value:"Initializing application configuration",id:"initializing-application-configuration",level:2},{value:"kcl.mod",id:"kclmod",level:3},{value:"Building",id:"building",level:2},{value:"Applying",id:"applying",level:2}],c={toc:p};function u(e){let{components:t,...o}=e;return(0,a.kt)("wrapper",(0,i.Z)({},c,o,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"deploy-application"},"Deploy Application"),(0,a.kt)("p",null,"This guide shows you how to use Kusion CLIs to complete the deployment of an application running in Kubernetes.\nWe call the abstraction of application operation and maintenance configuration as ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),", and its instance as ",(0,a.kt)("inlineCode",{parentName:"p"},"Application"),".\nIt is essentially a configuration model that describes an application. The complete definition can be seen ",(0,a.kt)("a",{parentName:"p",href:"../../reference/modules/catalog-models/app-configuration"},"here"),"."),(0,a.kt)("p",null,"In production, the application generally includes minimally several k8s resources:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Namespace"),(0,a.kt)("li",{parentName:"ul"},"Deployment"),(0,a.kt)("li",{parentName:"ul"},"Service")),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"This guide requires you to have a basic understanding of Kubernetes.\nIf you are not familiar with the relevant concepts, please refer to the links below:"),(0,a.kt)("ul",{parentName:"admonition"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/tutorials/kubernetes-basics/"},"Learn Kubernetes Basics")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/"},"Namespace")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/concepts/workloads/controllers/deployment/"},"Deployment")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/concepts/services-networking/service/"},"Service")))),(0,a.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,a.kt)("p",null,"Before we start, we need to complete the following steps:"),(0,a.kt)("p",null,"1\u3001Install Kusion"),(0,a.kt)("p",null,"We recommend using HomeBrew(Mac), Scoop(Windows), or an installation shell script to download and install Kusion.\nSee ",(0,a.kt)("a",{parentName:"p",href:"../../getting-started/install-kusion"},"Download and Install")," for more details."),(0,a.kt)("p",null,"2\u3001Running Kubernetes cluster"),(0,a.kt)("p",null,"There must be a running Kubernetes cluster and a ",(0,a.kt)("a",{parentName:"p",href:"https://Kubernetes.io/docs/tasks/tools/#kubectl"},"kubectl")," command line tool.\nIf you don't have a cluster yet, you can use ",(0,a.kt)("a",{parentName:"p",href:"https://minikube.sigs.k8s.io/docs/tutorials/multi_node/"},"Minikube")," to start one of your own."),(0,a.kt)("h2",{id:"initializing"},"Initializing"),(0,a.kt)("p",null,"This guide is to deploy an app using Kusion, relying on the Kusion CLI and an existing a Kubernetes cluster."),(0,a.kt)("h2",{id:"initializing-workspace-configuration"},"Initializing workspace configuration"),(0,a.kt)("p",null,"In version 0.10.0, we have introduced the new concept of ",(0,a.kt)("a",{parentName:"p",href:"../../concepts/workspace"},"workspaces"),', which is a logical layer whose configurations represent an opinionated set of defaults, often appointed by the platform team. In most cases workspaces are represented with an "environment" in traditional SDLC terms. These workspaces provide a means to separate the concerns between the application developers who wish to focus on business logic, and a group of platform engineers who wish to standardize the applications on the platform.'),(0,a.kt)("p",null,"Driven by the discipline of Platform Engineering, management of the workspaces, including create/updating/deleting workspaces and their configurations should be done by dedicated platform engineers in a large software organizations to facilitate a more mature and scalable collaboration pattern."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"More on the collaboration pattern can be found in the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/design/collaboration/collaboration_paradigm.md"},"design doc"),".")),(0,a.kt)("p",null,"However, if that does NOT apply to your scenario, e.g. if you work in a smaller org without platform engineers or if you are an individual developer, we wish Kusion can still be a value tool to have when delivering an application. In this guide, we are NOT distinctively highlighting the different roles or what the best practices entails (the design doc above has all that) but rather the steps needed to get Kusion tool to work."),(0,a.kt)("p",null,"As of version 0.10.0, workspace configurations in Kusion are managed on the local filesystem and their values are sourced from YAML files. Remotely-managed workspaces will be supported in future versions."),(0,a.kt)("p",null,"To initialize the workspace configuration:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"~/playground$ touch ~/dev.yaml\n~/playground$ kusion workspace create dev -f ~/dev.yaml\ncreate workspace dev successfully\n")),(0,a.kt)("p",null,"To verify the workspace has been created properly:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"~/playground$ kusion workspace list\n- dev\n~/playground$ kusion workspace show dev\n{}\n")),(0,a.kt)("p",null,"Note that ",(0,a.kt)("inlineCode",{parentName:"p"},"show")," command tells us the workspace configuration is currently empty, which is expected because we created the ",(0,a.kt)("inlineCode",{parentName:"p"},"dev")," workspace with an empty YAML file. An empty workspace configuration will suffice in some cases, where no platform configurations are needed."),(0,a.kt)("p",null,"We will progressively add more workspace configurations throughout this user guide."),(0,a.kt)("h2",{id:"initializing-application-configuration"},"Initializing application configuration"),(0,a.kt)("p",null,"Now that workspaces are properly initialized, we can begin by initializing the application configuration:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kusion init\n")),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init")," command will prompt you to enter required parameters, such as project name, project description, image address, etc.\nYou can keep pressing ",(0,a.kt)("em",{parentName:"p"},"Enter")," all the way to use the default values."),(0,a.kt)("p",null,"The output is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"\u2714 single-stack-sample A minimal kusion project of single stack\nThis command will walk you through creating a new kusion project.\n\nEnter a value or leave blank to accept the (default), and press .\nPress ^C at any time to quit.\n\nProject Config:\n\u2714 Project Name: simple-service\n\u2714 AppName: helloworld\n\u2714 ProjectName: simple-service\nStack Config: dev\n\u2714 Image: gcr.io/google-samples/gb-frontend:v4\nCreated project 'simple-service'\n")),(0,a.kt)("p",null,"Now, we have successfully initialized a project ",(0,a.kt)("inlineCode",{parentName:"p"},"simple-service")," using the ",(0,a.kt)("inlineCode",{parentName:"p"},"single-stack-sample")," template, which contains a ",(0,a.kt)("inlineCode",{parentName:"p"},"dev")," stack. "),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"AppName")," represents the name of the sample application, which is recorded in the generated ",(0,a.kt)("inlineCode",{parentName:"li"},"main.k")," as the name of the ",(0,a.kt)("inlineCode",{parentName:"li"},"AppConfiguration")," instance."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"ProjectName")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"Project Name")," represent the name of the sample project, which is used as the generated folder name and then recorded in the generated ",(0,a.kt)("inlineCode",{parentName:"li"},"project.yaml"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"Image")," represents the image address of the application container.")),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"See ",(0,a.kt)("a",{parentName:"p",href:"../../concepts/project/overview"},"Project")," and ",(0,a.kt)("a",{parentName:"p",href:"../../concepts/stack/overview"},"Stack")," for more details about Project and Stack.")),(0,a.kt)("p",null,"The directory structure is as follows:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"simple-service/\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod.lock\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n\n2 directories, 6 files\n")),(0,a.kt)("p",null,"The project directory has the following files that are automatically generated:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"README.md")," contains the generated README from a template."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"project.yaml")," represents project-level configurations."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dev")," directory stores the customized stack configuration:",(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dev/main.k")," stores configurations in the ",(0,a.kt)("inlineCode",{parentName:"li"},"dev")," stack."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dev/stack.yaml")," stores stack-level configurations."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dev/kcl.mod")," stores stack-level dependencies."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dev/kcl.mod.lock")," stores version-sensitive dependencies.")))),(0,a.kt)("p",null,"In general, the ",(0,a.kt)("inlineCode",{parentName:"p"},".k")," files are the KCL source code that represents the application configuration, and the ",(0,a.kt)("inlineCode",{parentName:"p"},".yaml")," is the static configuration file that describes behavior at the project or stack level."),(0,a.kt)("h3",{id:"kclmod"},"kcl.mod"),(0,a.kt)("p",null,"There should be a ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file generated automatically under the project directory. The ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file describes the dependency for the current project or stack. By default, it should contain a reference to the official ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},(0,a.kt)("inlineCode",{parentName:"a"},"catalog")," repository")," which holds some common model definitions that fits best practices. You can also create your own models library and reference that."),(0,a.kt)("h2",{id:"building"},"Building"),(0,a.kt)("p",null,"At this point, the project has been initialized with the Kusion built-in template.\nThe configuration is written in KCL, not JSON/YAML which Kubernetes recognizes, so it needs to be built to get the final output."),(0,a.kt)("p",null,"Enter stack dir ",(0,a.kt)("inlineCode",{parentName:"p"},"simple-service/dev")," and build:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"cd simple-service/dev && kusion build\n")),(0,a.kt)("p",null,"The output is printed to ",(0,a.kt)("inlineCode",{parentName:"p"},"stdout")," by default. You can save it to a file using the ",(0,a.kt)("inlineCode",{parentName:"p"},"-o/--output")," flag when running ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion build"),"."),(0,a.kt)("p",null,"The output of ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion build")," is the ",(0,a.kt)("a",{parentName:"p",href:"../../concepts/intent"},"intent")," format."),(0,a.kt)("admonition",{type:"tip"},(0,a.kt)("p",{parentName:"admonition"},"For instructions on the kusion command line tool, execute ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion -h"),", or refer to the tool's online ",(0,a.kt)("a",{parentName:"p",href:"../../reference/commands"},"documentation"),".")),(0,a.kt)("h2",{id:"applying"},"Applying"),(0,a.kt)("p",null,"Build is now completed. We can apply the configuration as the next step. In the output from ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion build"),", you can see 3 resources:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"a Namespace named ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service")),(0,a.kt)("li",{parentName:"ul"},"a Deployment named ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service-dev-helloworld")," in the ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service")," namespace"),(0,a.kt)("li",{parentName:"ul"},"a Service named ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service-dev-helloworld-private")," in the ",(0,a.kt)("inlineCode",{parentName:"li"},"simple-service")," namespace")),(0,a.kt)("p",null,"Execute command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kusion apply\n")),(0,a.kt)("p",null,"The output is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"}," \u2714\ufe0e Generating Intent in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service Create\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private Create\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Create\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS Create v1:Namespace:simple-service success \n SUCCESS Create v1:Service:simple-service:simple-service-dev-helloworld-private success \n SUCCESS Create apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \nCreate apps/v1:Deployment:simple-service:simple-service-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 3 created, 0 updated, 0 deleted.\n")),(0,a.kt)("p",null,"After the configuration applying successfully, you can use the ",(0,a.kt)("inlineCode",{parentName:"p"},"kubectl")," to check the actual status of these resources."),(0,a.kt)("p",null,"1\u3001 Check Namespace"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get ns\n")),(0,a.kt)("p",null,"The output is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"NAME STATUS AGE\ndefault Active 117d\nsimple-service Active 38s\nkube-system Active 117d\n...\n")),(0,a.kt)("p",null,"2\u3001Check Deployment"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get deploy -n simple-service\n")),(0,a.kt)("p",null,"The output is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"NAME READY UP-TO-DATE AVAILABLE AGE\nsimple-service-dev-helloworld 1/1 1 1 59s\n")),(0,a.kt)("p",null,"3\u3001Check Service"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get svc -n simple-service\n")),(0,a.kt)("p",null,"The output is similar to:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\nsimple-service-dev-helloworld-private ClusterIP 10.98.89.104 80/TCP 79s\n")),(0,a.kt)("p",null,"4\u3001Validate app"),(0,a.kt)("p",null,"Using the ",(0,a.kt)("inlineCode",{parentName:"p"},"kubectl")," tool, forward native port ",(0,a.kt)("inlineCode",{parentName:"p"},"30000")," to the service port ",(0,a.kt)("inlineCode",{parentName:"p"},"80"),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl port-forward svc/simple-service-dev-helloworld-private -n simple-service 30000:80\n")),(0,a.kt)("p",null,"Open browser and visit ",(0,a.kt)("a",{parentName:"p",href:"http://127.0.0.1:30000"},"http://127.0.0.1:30000"),"\uff1a"),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"app-preview",src:n(92287).Z,width:"1830",height:"330"})))}u.isMDXComponent=!0},92287:(e,t,n)=>{n.d(t,{Z:()=>i});const i=n.p+"assets/images/app-preview-de5274f4267fa725d2a65099e47c6c2c.png"}}]); \ No newline at end of file diff --git a/assets/js/8b16a1f6.b2db6316.js b/assets/js/8b16a1f6.b2db6316.js new file mode 100644 index 00000000000..11f2ce46fb2 --- /dev/null +++ b/assets/js/8b16a1f6.b2db6316.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7531],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>u});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),m=l(n),u=a,f=m["".concat(c,".").concat(u)]||m[u]||d[u]||o;return n?r.createElement(f,i(i({ref:t},s),{},{components:n})):r.createElement(f,i({ref:t},s))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=m;var p={};for(var c in t)hasOwnProperty.call(t,c)&&(p[c]=t[c]);p.originalType=e,p.mdxType="string"==typeof e?e:a,i[1]=p;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>p,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const o={id:"configuration",sidebar_label:"Project file reference"},i="Kusion project file reference",p={unversionedId:"concepts/project/configuration",id:"version-v0.11/concepts/project/configuration",title:"Kusion project file reference",description:"Every Kusion project has a project file, project.yaml, which specifies metadata about your project, such as the project name and project description. The project file must begin with lowercase project and have an extension of either .yaml or .yml.",source:"@site/docs_versioned_docs/version-v0.11/3-concepts/1-project/2-configuration.md",sourceDirName:"3-concepts/1-project",slug:"/concepts/project/configuration",permalink:"/docs/concepts/project/configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/3-concepts/1-project/2-configuration.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"configuration",sidebar_label:"Project file reference"},sidebar:"kusion",previous:{title:"Overview",permalink:"/docs/concepts/project/overview"},next:{title:"Overview",permalink:"/docs/concepts/stack/overview"}},c={},l=[{value:"Attributes",id:"attributes",level:2},{value:"Extensions",id:"extensions",level:3},{value:"kubernetesNamespace",id:"kubernetesnamespace",level:4}],s={toc:l};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"kusion-project-file-reference"},"Kusion project file reference"),(0,a.kt)("p",null,"Every Kusion project has a project file, ",(0,a.kt)("inlineCode",{parentName:"p"},"project.yaml"),", which specifies metadata about your project, such as the project name and project description. The project file must begin with lowercase ",(0,a.kt)("inlineCode",{parentName:"p"},"project")," and have an extension of either ",(0,a.kt)("inlineCode",{parentName:"p"},".yaml")," or ",(0,a.kt)("inlineCode",{parentName:"p"},".yml"),"."),(0,a.kt)("h2",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Required"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Description"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Options"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"name")),(0,a.kt)("td",{parentName:"tr",align:"left"},"required"),(0,a.kt)("td",{parentName:"tr",align:"left"},"Name of the project containing alphanumeric characters, hyphens, underscores."),(0,a.kt)("td",{parentName:"tr",align:"left"},"None")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"description")),(0,a.kt)("td",{parentName:"tr",align:"left"},"optional"),(0,a.kt)("td",{parentName:"tr",align:"left"},"A brief description of the project."),(0,a.kt)("td",{parentName:"tr",align:"left"},"None")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"extensions")),(0,a.kt)("td",{parentName:"tr",align:"left"},"optional"),(0,a.kt)("td",{parentName:"tr",align:"left"},"List of extensions on the project."),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("a",{parentName:"td",href:"#extensions"},"See blow"))))),(0,a.kt)("h3",{id:"extensions"},"Extensions"),(0,a.kt)("p",null,"Extensions allow you to customize how resources are generated or customized as part of release."),(0,a.kt)("h4",{id:"kubernetesnamespace"},"kubernetesNamespace"),(0,a.kt)("p",null,"The Kubernetes namespace extension allows you to customize namespace within your application generate Kubernetes resources. "),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Key"),(0,a.kt)("th",{parentName:"tr",align:"center"},"Required"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Description"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Example"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},"kind"),(0,a.kt)("td",{parentName:"tr",align:"center"},"y"),(0,a.kt)("td",{parentName:"tr",align:"left"},"The kind of extension being used. Must be 'kubernetesNamespace'"),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"kubernetesNamespace"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},"namespace"),(0,a.kt)("td",{parentName:"tr",align:"center"},"y"),(0,a.kt)("td",{parentName:"tr",align:"left"},"The namespace where all application-scoped resources generate Kubernetes objects."),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"default"))))))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8b16a1f6.c902b5e1.js b/assets/js/8b16a1f6.c902b5e1.js deleted file mode 100644 index d6411935236..00000000000 --- a/assets/js/8b16a1f6.c902b5e1.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7531],{3905:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>u});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},s=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),m=l(r),u=a,f=m["".concat(c,".").concat(u)]||m[u]||d[u]||o;return r?n.createElement(f,i(i({ref:t},s),{},{components:r})):n.createElement(f,i({ref:t},s))}));function u(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=m;var p={};for(var c in t)hasOwnProperty.call(t,c)&&(p[c]=t[c]);p.originalType=e,p.mdxType="string"==typeof e?e:a,i[1]=p;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>p,toc:()=>l});var n=r(87462),a=(r(67294),r(3905));const o={id:"configuration",sidebar_label:"Project file reference"},i="Kusion project file reference",p={unversionedId:"concepts/project/configuration",id:"version-v0.11/concepts/project/configuration",title:"Kusion project file reference",description:"Every Kusion project has a project file, project.yaml, which specifies metadata about your project, such as the project name and project description. The project file must begin with lowercase project and have an extension of either .yaml or .yml.",source:"@site/docs_versioned_docs/version-v0.11/3-concepts/1-project/2-configuration.md",sourceDirName:"3-concepts/1-project",slug:"/concepts/project/configuration",permalink:"/docs/concepts/project/configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/3-concepts/1-project/2-configuration.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"configuration",sidebar_label:"Project file reference"},sidebar:"kusion",previous:{title:"Overview",permalink:"/docs/concepts/project/overview"},next:{title:"Overview",permalink:"/docs/concepts/stack/overview"}},c={},l=[{value:"Attributes",id:"attributes",level:2},{value:"Extensions",id:"extensions",level:3},{value:"kubernetesNamespace",id:"kubernetesnamespace",level:4}],s={toc:l};function d(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"kusion-project-file-reference"},"Kusion project file reference"),(0,a.kt)("p",null,"Every Kusion project has a project file, ",(0,a.kt)("inlineCode",{parentName:"p"},"project.yaml"),", which specifies metadata about your project, such as the project name and project description. The project file must begin with lowercase ",(0,a.kt)("inlineCode",{parentName:"p"},"project")," and have an extension of either ",(0,a.kt)("inlineCode",{parentName:"p"},".yaml")," or ",(0,a.kt)("inlineCode",{parentName:"p"},".yml"),"."),(0,a.kt)("h2",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Required"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Description"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Options"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"name")),(0,a.kt)("td",{parentName:"tr",align:"left"},"required"),(0,a.kt)("td",{parentName:"tr",align:"left"},"Name of the project containing alphanumeric characters, hyphens, underscores."),(0,a.kt)("td",{parentName:"tr",align:"left"},"None")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"description")),(0,a.kt)("td",{parentName:"tr",align:"left"},"optional"),(0,a.kt)("td",{parentName:"tr",align:"left"},"A brief description of the project."),(0,a.kt)("td",{parentName:"tr",align:"left"},"None")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"extensions")),(0,a.kt)("td",{parentName:"tr",align:"left"},"optional"),(0,a.kt)("td",{parentName:"tr",align:"left"},"List of extensions on the project."),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("a",{parentName:"td",href:"#extensions"},"See blow"))))),(0,a.kt)("h3",{id:"extensions"},"Extensions"),(0,a.kt)("p",null,"Extensions allow you to customize how resources are generated or customized as part of release."),(0,a.kt)("h4",{id:"kubernetesnamespace"},"kubernetesNamespace"),(0,a.kt)("p",null,"The Kubernetes namespace extension allows you to customize namespace within your application generate Kubernetes resources. "),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Key"),(0,a.kt)("th",{parentName:"tr",align:"center"},"Required"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Description"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Example"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},"kind"),(0,a.kt)("td",{parentName:"tr",align:"center"},"y"),(0,a.kt)("td",{parentName:"tr",align:"left"},"The kind of extension being used. Must be 'kubernetesNamespace'"),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"kubernetesNamespace"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},"namespace"),(0,a.kt)("td",{parentName:"tr",align:"center"},"y"),(0,a.kt)("td",{parentName:"tr",align:"left"},"The namespace where all application-scoped resources generate Kubernetes objects."),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"default"))))))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8b66fb2a.570bd90e.js b/assets/js/8b66fb2a.570bd90e.js deleted file mode 100644 index 49628bdf3f7..00000000000 --- a/assets/js/8b66fb2a.570bd90e.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4499],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>d});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=o.createContext({}),l=function(e){var t=o.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=l(e.components);return o.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,s=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),m=l(n),d=r,f=m["".concat(s,".").concat(d)]||m[d]||c[d]||a;return n?o.createElement(f,i(i({ref:t},u),{},{components:n})):o.createElement(f,i({ref:t},u))}));function d(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,i=new Array(a);i[0]=m;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p.mdxType="string"==typeof e?e:r,i[1]=p;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>c,frontMatter:()=>a,metadata:()=>p,toc:()=>l});var o=n(87462),r=(n(67294),n(3905));const a={},i="Application Monitoring",p={unversionedId:"configuration-walkthrough/monitoring",id:"version-v0.10/configuration-walkthrough/monitoring",title:"Application Monitoring",description:"The monitoring attribute in the AppConfiguration instance is used to describe the specification for the collection of monitoring requirements for the application.",source:"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/8-monitoring.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/monitoring",permalink:"/docs/v0.10/configuration-walkthrough/monitoring",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/8-monitoring.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:8,frontMatter:{},sidebar:"kusion",previous:{title:"Secrets",permalink:"/docs/v0.10/configuration-walkthrough/secret"},next:{title:"Operational Rules",permalink:"/docs/v0.10/configuration-walkthrough/operational-rules"}},s={},l=[{value:"Import",id:"import",level:2},{value:"Workspace configurations",id:"workspace-configurations",level:2},{value:"Managing Scraping Configuration",id:"managing-scraping-configuration",level:2},{value:"Default values",id:"default-values",level:2}],u={toc:l};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,o.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"application-monitoring"},"Application Monitoring"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," attribute in the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance is used to describe the specification for the collection of monitoring requirements for the application."),(0,r.kt)("p",null,"As of version 0.10.0, Kusion supports integration with Prometheus by managing scraping behaviors in the configuration file."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"The ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," attribute requires the target cluster to have installed Prometheus correctly, either as a Kubernetes operator or a server/agent."),(0,r.kt)("p",{parentName:"admonition"},"More about how to set up Prometheus can be found in the ",(0,r.kt)("a",{parentName:"p",href:"../user-guides/observability/prometheus"},"Prometheus User Guide for Kusion"))),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"catalog")," package. For more details on KCL package import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.monitoring as m\n")),(0,r.kt)("h2",{id:"workspace-configurations"},"Workspace configurations"),(0,r.kt)("p",null,"In addition to the KCL configuration file, there are also workspace-level configurations that should be set first. In an ideal scenario, this step is done by the platform engineers. "),(0,r.kt)("p",null,"In the event that they do not exist for you or your organization, e.g. if you are an individual developer, you can either do it yourself or use the ",(0,r.kt)("a",{parentName:"p",href:"#default-values"},"default values")," provided by the KusionStack team. The steps to do this yourself can be found in the ",(0,r.kt)("a",{parentName:"p",href:"../user-guides/observability/prometheus#setting-up-workspace-configs"},"Prometheus User Guide for Kusion"),"."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"For more details on how workspaces work, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"/docs/v0.10/concepts/workspace"},"workspace concept"))),(0,r.kt)("p",null,"By separating configurations that the developers are interested in and those that platform owners are interested in, we can reduce the cognitive complexity of the application configuration and achieve separation of concern."),(0,r.kt)("h2",{id:"managing-scraping-configuration"},"Managing Scraping Configuration"),(0,r.kt)("p",null,"To manage scrape configuration for the application:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n monitoring: m.Prometheus{\n path: "/metrics"\n port: "web"\n }\n}\n')),(0,r.kt)("p",null,"The example above will instruct the Prometheus job to scrape metrics from the ",(0,r.kt)("inlineCode",{parentName:"p"},"/metrics")," endpoint of the application on the port named ",(0,r.kt)("inlineCode",{parentName:"p"},"web"),"."),(0,r.kt)("p",null,"To instruct Prometheus to scrape from ",(0,r.kt)("inlineCode",{parentName:"p"},"/actuator/metrics")," on port ",(0,r.kt)("inlineCode",{parentName:"p"},"9099")," instead:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n monitoring: m.Prometheus{\n path: "/actuator/metrics"\n port: "9099"\n }\n}\n')),(0,r.kt)("p",null,"Note that numbered ports only work when your Prometheus is not running as an operator. "),(0,r.kt)("p",null,"Neither ",(0,r.kt)("inlineCode",{parentName:"p"},"path")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"port")," are required fields if Prometheus runs as an operator. If omitted, ",(0,r.kt)("inlineCode",{parentName:"p"},"path")," defaults to ",(0,r.kt)("inlineCode",{parentName:"p"},"/metrics"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"port")," defaults to the container port or service port, depending on which resource is being monitored. If Prometheus does not run as an operator, both fields are required."),(0,r.kt)("p",null,"Scraping scheme, interval and timeout are considered platform-managed configurations and are therefore managed as part of the ",(0,r.kt)("a",{parentName:"p",href:"../user-guides/observability/prometheus#setting-up-workspace-configs"},"workspace configurations"),"."),(0,r.kt)("p",null,"More details about how the Prometheus integration works can be found in the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/prometheus.md"},"design documentation"),"."),(0,r.kt)("h2",{id:"default-values"},"Default values"),(0,r.kt)("p",null,"If no workspace configurations are found, the default values provided by the KusionStack team are:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Scraping interval defaults to 30 seconds"),(0,r.kt)("li",{parentName:"ul"},"Scraping timeout defaults to 15 seconds"),(0,r.kt)("li",{parentName:"ul"},"Scraping scheme defaults to http"),(0,r.kt)("li",{parentName:"ul"},"Defaults to NOT running as an operator")),(0,r.kt)("p",null,"If any of the default values does not meet your need, you can change them by ",(0,r.kt)("a",{parentName:"p",href:"../user-guides/observability/prometheus#setting-up-workspace-configs"},"setting up the workspace configuration"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8b66fb2a.c2a7076e.js b/assets/js/8b66fb2a.c2a7076e.js new file mode 100644 index 00000000000..36393f19855 --- /dev/null +++ b/assets/js/8b66fb2a.c2a7076e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4499],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>d});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=o.createContext({}),l=function(e){var t=o.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=l(e.components);return o.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,s=e.parentName,u=p(e,["components","mdxType","originalType","parentName"]),m=l(n),d=r,f=m["".concat(s,".").concat(d)]||m[d]||c[d]||a;return n?o.createElement(f,i(i({ref:t},u),{},{components:n})):o.createElement(f,i({ref:t},u))}));function d(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,i=new Array(a);i[0]=m;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p.mdxType="string"==typeof e?e:r,i[1]=p;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>c,frontMatter:()=>a,metadata:()=>p,toc:()=>l});var o=n(87462),r=(n(67294),n(3905));const a={},i="Application Monitoring",p={unversionedId:"configuration-walkthrough/monitoring",id:"version-v0.10/configuration-walkthrough/monitoring",title:"Application Monitoring",description:"The monitoring attribute in the AppConfiguration instance is used to describe the specification for the collection of monitoring requirements for the application.",source:"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/8-monitoring.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/monitoring",permalink:"/docs/v0.10/configuration-walkthrough/monitoring",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/8-monitoring.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:8,frontMatter:{},sidebar:"kusion",previous:{title:"Secrets",permalink:"/docs/v0.10/configuration-walkthrough/secret"},next:{title:"Operational Rules",permalink:"/docs/v0.10/configuration-walkthrough/operational-rules"}},s={},l=[{value:"Import",id:"import",level:2},{value:"Workspace configurations",id:"workspace-configurations",level:2},{value:"Managing Scraping Configuration",id:"managing-scraping-configuration",level:2},{value:"Default values",id:"default-values",level:2}],u={toc:l};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,o.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"application-monitoring"},"Application Monitoring"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," attribute in the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance is used to describe the specification for the collection of monitoring requirements for the application."),(0,r.kt)("p",null,"As of version 0.10.0, Kusion supports integration with Prometheus by managing scraping behaviors in the configuration file."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"The ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," attribute requires the target cluster to have installed Prometheus correctly, either as a Kubernetes operator or a server/agent."),(0,r.kt)("p",{parentName:"admonition"},"More about how to set up Prometheus can be found in the ",(0,r.kt)("a",{parentName:"p",href:"../user-guides/observability/prometheus"},"Prometheus User Guide for Kusion"))),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"catalog")," package. For more details on KCL package import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.monitoring as m\n")),(0,r.kt)("h2",{id:"workspace-configurations"},"Workspace configurations"),(0,r.kt)("p",null,"In addition to the KCL configuration file, there are also workspace-level configurations that should be set first. In an ideal scenario, this step is done by the platform engineers. "),(0,r.kt)("p",null,"In the event that they do not exist for you or your organization, e.g. if you are an individual developer, you can either do it yourself or use the ",(0,r.kt)("a",{parentName:"p",href:"#default-values"},"default values")," provided by the KusionStack team. The steps to do this yourself can be found in the ",(0,r.kt)("a",{parentName:"p",href:"../user-guides/observability/prometheus#setting-up-workspace-configs"},"Prometheus User Guide for Kusion"),"."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"For more details on how workspaces work, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"/docs/v0.10/concepts/workspace"},"workspace concept"))),(0,r.kt)("p",null,"By separating configurations that the developers are interested in and those that platform owners are interested in, we can reduce the cognitive complexity of the application configuration and achieve separation of concern."),(0,r.kt)("h2",{id:"managing-scraping-configuration"},"Managing Scraping Configuration"),(0,r.kt)("p",null,"To manage scrape configuration for the application:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n monitoring: m.Prometheus{\n path: "/metrics"\n port: "web"\n }\n}\n')),(0,r.kt)("p",null,"The example above will instruct the Prometheus job to scrape metrics from the ",(0,r.kt)("inlineCode",{parentName:"p"},"/metrics")," endpoint of the application on the port named ",(0,r.kt)("inlineCode",{parentName:"p"},"web"),"."),(0,r.kt)("p",null,"To instruct Prometheus to scrape from ",(0,r.kt)("inlineCode",{parentName:"p"},"/actuator/metrics")," on port ",(0,r.kt)("inlineCode",{parentName:"p"},"9099")," instead:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n monitoring: m.Prometheus{\n path: "/actuator/metrics"\n port: "9099"\n }\n}\n')),(0,r.kt)("p",null,"Note that numbered ports only work when your Prometheus is not running as an operator. "),(0,r.kt)("p",null,"Neither ",(0,r.kt)("inlineCode",{parentName:"p"},"path")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"port")," are required fields if Prometheus runs as an operator. If omitted, ",(0,r.kt)("inlineCode",{parentName:"p"},"path")," defaults to ",(0,r.kt)("inlineCode",{parentName:"p"},"/metrics"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"port")," defaults to the container port or service port, depending on which resource is being monitored. If Prometheus does not run as an operator, both fields are required."),(0,r.kt)("p",null,"Scraping scheme, interval and timeout are considered platform-managed configurations and are therefore managed as part of the ",(0,r.kt)("a",{parentName:"p",href:"../user-guides/observability/prometheus#setting-up-workspace-configs"},"workspace configurations"),"."),(0,r.kt)("p",null,"More details about how the Prometheus integration works can be found in the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/prometheus.md"},"design documentation"),"."),(0,r.kt)("h2",{id:"default-values"},"Default values"),(0,r.kt)("p",null,"If no workspace configurations are found, the default values provided by the KusionStack team are:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Scraping interval defaults to 30 seconds"),(0,r.kt)("li",{parentName:"ul"},"Scraping timeout defaults to 15 seconds"),(0,r.kt)("li",{parentName:"ul"},"Scraping scheme defaults to http"),(0,r.kt)("li",{parentName:"ul"},"Defaults to NOT running as an operator")),(0,r.kt)("p",null,"If any of the default values does not meet your need, you can change them by ",(0,r.kt)("a",{parentName:"p",href:"../user-guides/observability/prometheus#setting-up-workspace-configs"},"setting up the workspace configuration"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8c906d29.e6affb24.js b/assets/js/8c906d29.479eb620.js similarity index 81% rename from assets/js/8c906d29.e6affb24.js rename to assets/js/8c906d29.479eb620.js index ae43f548ee2..b05d44bf254 100644 --- a/assets/js/8c906d29.e6affb24.js +++ b/assets/js/8c906d29.479eb620.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1436],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>d});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),f=l(r),d=o,m=f["".concat(s,".").concat(d)]||f[d]||u[d]||a;return r?n.createElement(m,i(i({ref:t},p),{},{components:r})):n.createElement(m,i({ref:t},p))}));function d(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:o,i[1]=c;for(var l=2;l{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:2},i="KCL",c={unversionedId:"faq/kcl",id:"version-v0.10/faq/kcl",title:"KCL",description:"Visit the KCL website for more documents.",source:"@site/docs_versioned_docs/version-v0.10/7-faq/2-kcl.md",sourceDirName:"7-faq",slug:"/faq/kcl",permalink:"/docs/v0.10/faq/kcl",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/7-faq/2-kcl.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"kusion",previous:{title:"Installation",permalink:"/docs/v0.10/faq/install-error"}},s={},l=[],p={toc:l};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kcl"},"KCL"),(0,o.kt)("p",null,"Visit the ",(0,o.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/user_docs/support/faq-kcl"},"KCL website")," for more documents."))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1436],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>d});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),f=l(r),d=o,m=f["".concat(s,".").concat(d)]||f[d]||u[d]||a;return r?n.createElement(m,i(i({ref:t},p),{},{components:r})):n.createElement(m,i({ref:t},p))}));function d(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:o,i[1]=c;for(var l=2;l{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:2},i="KCL",c={unversionedId:"faq/kcl",id:"version-v0.10/faq/kcl",title:"KCL",description:"Visit the KCL website for more documents.",source:"@site/docs_versioned_docs/version-v0.10/7-faq/2-kcl.md",sourceDirName:"7-faq",slug:"/faq/kcl",permalink:"/docs/v0.10/faq/kcl",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/7-faq/2-kcl.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"kusion",previous:{title:"Installation",permalink:"/docs/v0.10/faq/install-error"}},s={},l=[],p={toc:l};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kcl"},"KCL"),(0,o.kt)("p",null,"Visit the ",(0,o.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/user_docs/support/faq-kcl"},"KCL website")," for more documents."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8cadf11f.0432a380.js b/assets/js/8cadf11f.0432a380.js new file mode 100644 index 00000000000..e0b6005967f --- /dev/null +++ b/assets/js/8cadf11f.0432a380.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[824],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>f});var o=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var c=o.createContext({}),l=function(e){var t=o.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},u=function(e){var t=l(e.components);return o.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,c=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=l(n),f=i,h=d["".concat(c,".").concat(f)]||d[f]||p[f]||r;return n?o.createElement(h,a(a({ref:t},u),{},{components:n})):o.createElement(h,a({ref:t},u))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,a=new Array(r);a[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:i,a[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>p,frontMatter:()=>r,metadata:()=>s,toc:()=>l});var o=n(87462),i=(n(67294),n(3905));const r={},a="Intent",s={unversionedId:"concepts/intent",id:"version-v0.9/concepts/intent",title:"Intent",description:"The Intent represents the operational intentions that you aim to deliver using Kusion. These intentions are expected to contain all components throughout the software development lifecycle (SDLC), including resources (workload, database, load balancer, etc.), dependencies, and policies. The Kusion module generators are responsible for converting all AppConfigurations and environment configurations into the Intent. Once the Intent is generated, the Kusion Engine takes charge of updating the actual infrastructures to match the Intent.",source:"@site/docs_versioned_docs/version-v0.9/concepts/intent.md",sourceDirName:"concepts",slug:"/concepts/intent",permalink:"/docs/v0.9/concepts/intent",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/concepts/intent.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"AppConfiguration",permalink:"/docs/v0.9/concepts/appconfiguration"},next:{title:"Configuration File Overview",permalink:"/docs/v0.9/config-walkthrough/overview"}},c={},l=[{value:"Purpose",id:"purpose",level:2},{value:"Single Source of Truth",id:"single-source-of-truth",level:3},{value:"Consistency",id:"consistency",level:3},{value:"Rollback and Disaster Recovery",id:"rollback-and-disaster-recovery",level:3}],u={toc:l};function p(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,o.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"intent"},"Intent"),(0,i.kt)("p",null,"The Intent represents the operational intentions that you aim to deliver using Kusion. These intentions are expected to contain all components throughout the software development lifecycle (SDLC), including resources (workload, database, load balancer, etc.), dependencies, and policies. The Kusion module generators are responsible for converting all AppConfigurations and environment configurations into the Intent. Once the Intent is generated, the Kusion Engine takes charge of updating the actual infrastructures to match the Intent."),(0,i.kt)("h2",{id:"purpose"},"Purpose"),(0,i.kt)("h3",{id:"single-source-of-truth"},"Single Source of Truth"),(0,i.kt)("p",null,"In Kusion's workflow, platform engineer build Kusion modules and provide environment configurations, application developers choose Kusion modules they need and deploy operational intentions to an environment with related environment configurations. They can also input dynamic paramters like the container image when execute the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion build")," command. So the final operational intentions includes configuratins written by application developers, environment configurations and dynamic inputs. Due to this reason, we introduce ",(0,i.kt)("strong",{parentName:"p"},"Intent")," to represent the SSoT(Single Source of Truth) of Kusion. It is the result of ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion build")," which contains all operational intentions from different sources."),(0,i.kt)("h3",{id:"consistency"},"Consistency"),(0,i.kt)("p",null,"Delivering an application to different environments with identical configurations is a common practice, especially for applications that require scalable distribution. In such cases, an immutable configuration package is helpful. By utilizing the Intent, all configurations and changes are stored in a single file. As the Intent is the input of Kusion, it ensures consistency across different environments whenever you execute Kusion with the same Intent file."),(0,i.kt)("h3",{id:"rollback-and-disaster-recovery"},"Rollback and Disaster Recovery"),(0,i.kt)("p",null,"The ability to roll back is crucial in reducing incident duration. Rolling back the system to previously validated version is much faster compared to attempting to fix it during an outage. We regard a validated Intent as a snapshot of the system and recommend to sotre the Intent in a version control systems like Git. This enables better change management practices and makes it simpler to roll back to previous versions if needed. In case of a failure or outage, having a validated Intent simplifies the rollback process, ensuring that the system can be quickly recovered."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8cadf11f.0d5f1f3d.js b/assets/js/8cadf11f.0d5f1f3d.js deleted file mode 100644 index a03f881d631..00000000000 --- a/assets/js/8cadf11f.0d5f1f3d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[824],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>f});var o=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var c=o.createContext({}),l=function(e){var t=o.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},u=function(e){var t=l(e.components);return o.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,c=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=l(n),f=i,h=d["".concat(c,".").concat(f)]||d[f]||p[f]||r;return n?o.createElement(h,a(a({ref:t},u),{},{components:n})):o.createElement(h,a({ref:t},u))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,a=new Array(r);a[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:i,a[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>p,frontMatter:()=>r,metadata:()=>s,toc:()=>l});var o=n(87462),i=(n(67294),n(3905));const r={},a="Intent",s={unversionedId:"concepts/intent",id:"version-v0.9/concepts/intent",title:"Intent",description:"The Intent represents the operational intentions that you aim to deliver using Kusion. These intentions are expected to contain all components throughout the software development lifecycle (SDLC), including resources (workload, database, load balancer, etc.), dependencies, and policies. The Kusion module generators are responsible for converting all AppConfigurations and environment configurations into the Intent. Once the Intent is generated, the Kusion Engine takes charge of updating the actual infrastructures to match the Intent.",source:"@site/docs_versioned_docs/version-v0.9/concepts/intent.md",sourceDirName:"concepts",slug:"/concepts/intent",permalink:"/docs/v0.9/concepts/intent",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/concepts/intent.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"AppConfiguration",permalink:"/docs/v0.9/concepts/appconfiguration"},next:{title:"Configuration File Overview",permalink:"/docs/v0.9/config-walkthrough/overview"}},c={},l=[{value:"Purpose",id:"purpose",level:2},{value:"Single Source of Truth",id:"single-source-of-truth",level:3},{value:"Consistency",id:"consistency",level:3},{value:"Rollback and Disaster Recovery",id:"rollback-and-disaster-recovery",level:3}],u={toc:l};function p(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,o.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"intent"},"Intent"),(0,i.kt)("p",null,"The Intent represents the operational intentions that you aim to deliver using Kusion. These intentions are expected to contain all components throughout the software development lifecycle (SDLC), including resources (workload, database, load balancer, etc.), dependencies, and policies. The Kusion module generators are responsible for converting all AppConfigurations and environment configurations into the Intent. Once the Intent is generated, the Kusion Engine takes charge of updating the actual infrastructures to match the Intent."),(0,i.kt)("h2",{id:"purpose"},"Purpose"),(0,i.kt)("h3",{id:"single-source-of-truth"},"Single Source of Truth"),(0,i.kt)("p",null,"In Kusion's workflow, platform engineer build Kusion modules and provide environment configurations, application developers choose Kusion modules they need and deploy operational intentions to an environment with related environment configurations. They can also input dynamic paramters like the container image when execute the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion build")," command. So the final operational intentions includes configuratins written by application developers, environment configurations and dynamic inputs. Due to this reason, we introduce ",(0,i.kt)("strong",{parentName:"p"},"Intent")," to represent the SSoT(Single Source of Truth) of Kusion. It is the result of ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion build")," which contains all operational intentions from different sources."),(0,i.kt)("h3",{id:"consistency"},"Consistency"),(0,i.kt)("p",null,"Delivering an application to different environments with identical configurations is a common practice, especially for applications that require scalable distribution. In such cases, an immutable configuration package is helpful. By utilizing the Intent, all configurations and changes are stored in a single file. As the Intent is the input of Kusion, it ensures consistency across different environments whenever you execute Kusion with the same Intent file."),(0,i.kt)("h3",{id:"rollback-and-disaster-recovery"},"Rollback and Disaster Recovery"),(0,i.kt)("p",null,"The ability to roll back is crucial in reducing incident duration. Rolling back the system to previously validated version is much faster compared to attempting to fix it during an outage. We regard a validated Intent as a snapshot of the system and recommend to sotre the Intent in a version control systems like Git. This enables better change management practices and makes it simpler to roll back to previous versions if needed. In case of a failure or outage, having a validated Intent simplifies the rollback process, ensuring that the system can be quickly recovered."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8cc3f780.fe64d87c.js b/assets/js/8cc3f780.3792f34a.js similarity index 59% rename from assets/js/8cc3f780.fe64d87c.js rename to assets/js/8cc3f780.3792f34a.js index 8a57c3d3e2a..d5c0dc0e64b 100644 --- a/assets/js/8cc3f780.fe64d87c.js +++ b/assets/js/8cc3f780.3792f34a.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4224],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),s=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},p=function(e){var t=s(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=s(r),m=a,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||o;return r?n.createElement(f,l(l({ref:t},p),{},{components:r})):n.createElement(f,l({ref:t},p))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var s=2;s{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>s});var n=r(87462),a=(r(67294),r(3905));const o={},l="opsrule",i={unversionedId:"reference/model/catalog_models/trait/doc_opsrule",id:"version-v0.9/reference/model/catalog_models/trait/doc_opsrule",title:"opsrule",description:"Schema OpsRule",source:"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/trait/doc_opsrule.md",sourceDirName:"reference/model/catalog_models/trait",slug:"/reference/model/catalog_models/trait/doc_opsrule",permalink:"/docs/v0.9/reference/model/catalog_models/trait/doc_opsrule",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/catalog_models/trait/doc_opsrule.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"prometheus",permalink:"/docs/v0.9/reference/model/catalog_models/monitoring/doc_prometheus"},next:{title:"container",permalink:"/docs/v0.9/reference/model/catalog_models/internal/container/doc_container"}},c={},s=[{value:"Schema OpsRule",id:"schema-opsrule",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:s};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"opsrule"},"opsrule"),(0,a.kt)("h2",{id:"schema-opsrule"},"Schema OpsRule"),(0,a.kt)("p",null,"OpsRule describes operation rules for various Day-2 Operations. Once declared, these",(0,a.kt)("br",null),"operation rules will be checked before any Day-2 operations."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"maxUnavailable"),(0,a.kt)("br",null),"The maximum percentage of the total pod instances in the component that can be",(0,a.kt)("br",null),"simultaneously unhealthy."),(0,a.kt)("td",{parentName:"tr",align:null},"int ","|"," str"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.component.trait as t\n\nopsRule = t.OpsRule {\n maxUnavailable: "30%"\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4224],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),s=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},p=function(e){var t=s(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=s(r),m=a,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||o;return r?n.createElement(f,l(l({ref:t},p),{},{components:r})):n.createElement(f,l({ref:t},p))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var s=2;s{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>s});var n=r(87462),a=(r(67294),r(3905));const o={},l="opsrule",i={unversionedId:"reference/model/catalog_models/trait/doc_opsrule",id:"version-v0.9/reference/model/catalog_models/trait/doc_opsrule",title:"opsrule",description:"Schema OpsRule",source:"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/trait/doc_opsrule.md",sourceDirName:"reference/model/catalog_models/trait",slug:"/reference/model/catalog_models/trait/doc_opsrule",permalink:"/docs/v0.9/reference/model/catalog_models/trait/doc_opsrule",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/catalog_models/trait/doc_opsrule.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"prometheus",permalink:"/docs/v0.9/reference/model/catalog_models/monitoring/doc_prometheus"},next:{title:"container",permalink:"/docs/v0.9/reference/model/catalog_models/internal/container/doc_container"}},c={},s=[{value:"Schema OpsRule",id:"schema-opsrule",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:s};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"opsrule"},"opsrule"),(0,a.kt)("h2",{id:"schema-opsrule"},"Schema OpsRule"),(0,a.kt)("p",null,"OpsRule describes operation rules for various Day-2 Operations. Once declared, these",(0,a.kt)("br",null),"operation rules will be checked before any Day-2 operations."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"maxUnavailable"),(0,a.kt)("br",null),"The maximum percentage of the total pod instances in the component that can be",(0,a.kt)("br",null),"simultaneously unhealthy."),(0,a.kt)("td",{parentName:"tr",align:null},"int ","|"," str"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.component.trait as t\n\nopsRule = t.OpsRule {\n maxUnavailable: "30%"\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8dc01f00.4350e041.js b/assets/js/8dc01f00.4350e041.js deleted file mode 100644 index 073ac7be1e7..00000000000 --- a/assets/js/8dc01f00.4350e041.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2285],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>u});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),p=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(i.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),m=p(n),u=r,g=m["".concat(i,".").concat(u)]||m[u]||c[u]||o;return n?a.createElement(g,l(l({ref:t},d),{},{components:n})):a.createElement(g,l({ref:t},d))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=m;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:r,l[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var a=n(87462),r=(n(67294),n(3905));const o={},l="postgres",s={unversionedId:"reference/modules/developer-schemas/database/postgres",id:"reference/modules/developer-schemas/database/postgres",title:"postgres",description:"Schema PostgreSQL",source:"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/database/postgres.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/database",slug:"/reference/modules/developer-schemas/database/postgres",permalink:"/docs/next/reference/modules/developer-schemas/database/postgres",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/1-developer-schemas/database/postgres.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"mysql",permalink:"/docs/next/reference/modules/developer-schemas/database/mysql"},next:{title:"common",permalink:"/docs/next/reference/modules/developer-schemas/internal/common"}},i={},p=[{value:"Schema PostgreSQL",id:"schema-postgresql",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Credentials and Connectivity",id:"credentials-and-connectivity",level:3}],d={toc:p};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"postgres"},"postgres"),(0,r.kt)("h2",{id:"schema-postgresql"},"Schema PostgreSQL"),(0,r.kt)("p",null,"PostgreSQL describes the attributes to locally deploy or create a cloud provider",(0,r.kt)("br",null),"managed postgresql database instance for the workload. "),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},'"local"'),(0,r.kt)("td",{parentName:"tr",align:null},'"cloud"'),(0,r.kt)("td",{parentName:"tr",align:null},"Type defines whether the postgresql database is deployed locally or provided by",(0,r.kt)("br",null),"cloud vendor.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"version")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Version defines the postgres version to use."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'#Instantiate a local postgresql database with image version of 14.0. \n\nimport postgres as postgres\n\naccessories: {\n "postgres": postgres.PostgreSQL {\n type: "local"\n version: "14.0"\n }\n}\n')),(0,r.kt)("h3",{id:"credentials-and-connectivity"},"Credentials and Connectivity"),(0,r.kt)("p",null,"For sensitive information such as the ",(0,r.kt)("strong",{parentName:"p"},"host"),", ",(0,r.kt)("strong",{parentName:"p"},"username")," and ",(0,r.kt)("strong",{parentName:"p"},"password")," for the database instance, Kusion will automatically inject them into the application container for users through environment variables. The relevant environment variables are listed in the table below. "),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Explanation"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","HOST","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Host address for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","USERNAME","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Account username for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","PASSWORD","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Account password for accessing the database instance")))),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"databaseName")," can be declared in ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/reference/modules/workspace-configs/database/postgres"},"workspace configs of postgres"),", and Kusion will automatically concatenate the ",(0,r.kt)("inlineCode",{parentName:"p"},""),", ",(0,r.kt)("inlineCode",{parentName:"p"},""),", ",(0,r.kt)("inlineCode",{parentName:"p"},"")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"postgres")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"-")," if not specified. When injecting the credentials into containers' environment variables, Kusion will convert the ",(0,r.kt)("inlineCode",{parentName:"p"},"databaseName")," to uppercase, and replace ",(0,r.kt)("inlineCode",{parentName:"p"},"-")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"_"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8dc01f00.7181f8a5.js b/assets/js/8dc01f00.7181f8a5.js new file mode 100644 index 00000000000..dda4edfd013 --- /dev/null +++ b/assets/js/8dc01f00.7181f8a5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2285],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>u});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),p=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(i.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,i=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),m=p(n),u=r,g=m["".concat(i,".").concat(u)]||m[u]||c[u]||o;return n?a.createElement(g,l(l({ref:t},d),{},{components:n})):a.createElement(g,l({ref:t},d))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=m;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:r,l[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var a=n(87462),r=(n(67294),n(3905));const o={},l="postgres",s={unversionedId:"reference/modules/developer-schemas/database/postgres",id:"reference/modules/developer-schemas/database/postgres",title:"postgres",description:"Schema PostgreSQL",source:"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/database/postgres.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/database",slug:"/reference/modules/developer-schemas/database/postgres",permalink:"/docs/next/reference/modules/developer-schemas/database/postgres",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/1-developer-schemas/database/postgres.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"mysql",permalink:"/docs/next/reference/modules/developer-schemas/database/mysql"},next:{title:"common",permalink:"/docs/next/reference/modules/developer-schemas/internal/common"}},i={},p=[{value:"Schema PostgreSQL",id:"schema-postgresql",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Credentials and Connectivity",id:"credentials-and-connectivity",level:3}],d={toc:p};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"postgres"},"postgres"),(0,r.kt)("h2",{id:"schema-postgresql"},"Schema PostgreSQL"),(0,r.kt)("p",null,"PostgreSQL describes the attributes to locally deploy or create a cloud provider",(0,r.kt)("br",null),"managed postgresql database instance for the workload. "),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},'"local"'),(0,r.kt)("td",{parentName:"tr",align:null},'"cloud"'),(0,r.kt)("td",{parentName:"tr",align:null},"Type defines whether the postgresql database is deployed locally or provided by",(0,r.kt)("br",null),"cloud vendor.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"version")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Version defines the postgres version to use."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'#Instantiate a local postgresql database with image version of 14.0. \n\nimport postgres as postgres\n\naccessories: {\n "postgres": postgres.PostgreSQL {\n type: "local"\n version: "14.0"\n }\n}\n')),(0,r.kt)("h3",{id:"credentials-and-connectivity"},"Credentials and Connectivity"),(0,r.kt)("p",null,"For sensitive information such as the ",(0,r.kt)("strong",{parentName:"p"},"host"),", ",(0,r.kt)("strong",{parentName:"p"},"username")," and ",(0,r.kt)("strong",{parentName:"p"},"password")," for the database instance, Kusion will automatically inject them into the application container for users through environment variables. The relevant environment variables are listed in the table below. "),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Explanation"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","HOST","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Host address for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","USERNAME","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Account username for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","PASSWORD","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Account password for accessing the database instance")))),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"databaseName")," can be declared in ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/reference/modules/workspace-configs/database/postgres"},"workspace configs of postgres"),", and Kusion will automatically concatenate the ",(0,r.kt)("inlineCode",{parentName:"p"},""),", ",(0,r.kt)("inlineCode",{parentName:"p"},""),", ",(0,r.kt)("inlineCode",{parentName:"p"},"")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"postgres")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"-")," if not specified. When injecting the credentials into containers' environment variables, Kusion will convert the ",(0,r.kt)("inlineCode",{parentName:"p"},"databaseName")," to uppercase, and replace ",(0,r.kt)("inlineCode",{parentName:"p"},"-")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"_"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8e8efec7.58572336.js b/assets/js/8e8efec7.58572336.js new file mode 100644 index 00000000000..6eea7f73c5f --- /dev/null +++ b/assets/js/8e8efec7.58572336.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7600],{3905:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),c=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},s=function(e){var t=c(e.components);return n.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),u=c(r),m=a,k=u["".concat(p,".").concat(m)]||u[m]||d[m]||o;return r?n.createElement(k,l(l({ref:t},s),{},{components:r})):n.createElement(k,l({ref:t},s))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=u;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var c=2;c{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>d,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const o={},l="port",i={unversionedId:"reference/modules/catalog-models/internal/network/port",id:"version-v0.10/reference/modules/catalog-models/internal/network/port",title:"port",description:"Schema Port",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/network/port.md",sourceDirName:"6-reference/2-modules/1-catalog-models/internal/network",slug:"/reference/modules/catalog-models/internal/network/port",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/network/port",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/network/port.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"probe",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/container/probe/"},next:{title:"secret",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/secret/"}},p={},c=[{value:"Schema Port",id:"schema-port",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],s={toc:c};function d(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"port"},"port"),(0,a.kt)("h2",{id:"schema-port"},"Schema Port"),(0,a.kt)("p",null,"Port defines the exposed port of Service, which can be used to describe how the Service",(0,a.kt)("br",null),"get accessed."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"port"),(0,a.kt)("br",null),"The exposed port of the Service."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"80"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"targetPort"),(0,a.kt)("br",null),"The backend container port. If empty, set it the same as the port."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"protocol"),(0,a.kt)("br",null),"The protocol to access the port."),(0,a.kt)("td",{parentName:"tr",align:null},'"TCP" ',"|",' "UDP"'),(0,a.kt)("td",{parentName:"tr",align:null},'"TCP"'),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"public"),(0,a.kt)("br",null),"Public defines whether the port can be accessed through Internet."),(0,a.kt)("td",{parentName:"tr",align:null},"bool"),(0,a.kt)("td",{parentName:"tr",align:null},"False"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.network as n\n\nport = n.Port {\n port: 80\n targetPort: 8080\n protocol: "TCP"\n public: True\n}\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8e8efec7.dc28db82.js b/assets/js/8e8efec7.dc28db82.js deleted file mode 100644 index 75ead79d591..00000000000 --- a/assets/js/8e8efec7.dc28db82.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7600],{3905:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),c=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},s=function(e){var t=c(e.components);return n.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),u=c(r),m=a,k=u["".concat(p,".").concat(m)]||u[m]||d[m]||o;return r?n.createElement(k,l(l({ref:t},s),{},{components:r})):n.createElement(k,l({ref:t},s))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=u;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var c=2;c{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>d,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const o={},l="port",i={unversionedId:"reference/modules/catalog-models/internal/network/port",id:"version-v0.10/reference/modules/catalog-models/internal/network/port",title:"port",description:"Schema Port",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/network/port.md",sourceDirName:"6-reference/2-modules/1-catalog-models/internal/network",slug:"/reference/modules/catalog-models/internal/network/port",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/network/port",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/network/port.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"probe",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/container/probe/"},next:{title:"secret",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/secret/"}},p={},c=[{value:"Schema Port",id:"schema-port",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],s={toc:c};function d(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"port"},"port"),(0,a.kt)("h2",{id:"schema-port"},"Schema Port"),(0,a.kt)("p",null,"Port defines the exposed port of Service, which can be used to describe how the Service",(0,a.kt)("br",null),"get accessed."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"port"),(0,a.kt)("br",null),"The exposed port of the Service."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"80"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"targetPort"),(0,a.kt)("br",null),"The backend container port. If empty, set it the same as the port."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"protocol"),(0,a.kt)("br",null),"The protocol to access the port."),(0,a.kt)("td",{parentName:"tr",align:null},'"TCP" ',"|",' "UDP"'),(0,a.kt)("td",{parentName:"tr",align:null},'"TCP"'),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"public"),(0,a.kt)("br",null),"Public defines whether the port can be accessed through Internet."),(0,a.kt)("td",{parentName:"tr",align:null},"bool"),(0,a.kt)("td",{parentName:"tr",align:null},"False"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.network as n\n\nport = n.Port {\n port: 80\n targetPort: 8080\n protocol: "TCP"\n public: True\n}\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8ed9d5b5.8d7dd474.js b/assets/js/8ed9d5b5.8d7dd474.js new file mode 100644 index 00000000000..1c41f17b4d2 --- /dev/null +++ b/assets/js/8ed9d5b5.8d7dd474.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[308],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>k});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),c=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},p=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=c(n),k=i,m=u["".concat(s,".").concat(k)]||u[k]||d[k]||o;return n?a.createElement(m,r(r({ref:t},p),{},{components:n})):a.createElement(m,r({ref:t},p))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,r=new Array(o);r[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>r,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var a=n(87462),i=(n(67294),n(3905));const o={id:"deliver-quickstart"},r="Run Your First App on Kubernetes with Kusion",l={unversionedId:"getting-started/deliver-quickstart",id:"getting-started/deliver-quickstart",title:"Run Your First App on Kubernetes with Kusion",description:"In this tutorial, we will walk through how to deploy a quickstart application on Kubernetes with Kusion. The demo application can interact with a locally deployed MySQL database, which is declared as an accessory in the config codes and will be automatically created and managed by Kusion.",source:"@site/docs/kusion/2-getting-started/2-deliver-quickstart.md",sourceDirName:"2-getting-started",slug:"/getting-started/deliver-quickstart",permalink:"/docs/next/getting-started/deliver-quickstart",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/2-getting-started/2-deliver-quickstart.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"deliver-quickstart"},sidebar:"kusion",previous:{title:"Install Kusion",permalink:"/docs/next/getting-started/install-kusion"},next:{title:"Overview",permalink:"/docs/next/concepts/project/overview"}},s={},c=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Initialize Project",id:"initialize-project",level:2},{value:"Review Configuration Files",id:"review-configuration-files",level:3},{value:"Application Delivery",id:"application-delivery",level:2},{value:"Add MySQL Accessory",id:"add-mysql-accessory",level:2},{value:"Delete Application",id:"delete-application",level:2}],p={toc:c};function d(e){let{components:t,...o}=e;return(0,i.kt)("wrapper",(0,a.Z)({},p,o,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"run-your-first-app-on-kubernetes-with-kusion"},"Run Your First App on Kubernetes with Kusion"),(0,i.kt)("p",null,"In this tutorial, we will walk through how to deploy a quickstart application on Kubernetes with Kusion. The demo application can interact with a locally deployed MySQL database, which is declared as an accessory in the config codes and will be automatically created and managed by Kusion. "),(0,i.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,i.kt)("p",null,"Before we start to play with this example, we need to have the Kusion CLI installed and run an accessible Kubernetes cluster. Here are some helpful documents: "),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Install ",(0,i.kt)("a",{parentName:"li",href:"/docs/next/getting-started/install-kusion"},"Kusion CLI"),". "),(0,i.kt)("li",{parentName:"ul"},"Run a ",(0,i.kt)("a",{parentName:"li",href:"https://kubernetes.io"},"Kubernetes")," cluster. Some light and convenient options for Kubernetes local deployment include ",(0,i.kt)("a",{parentName:"li",href:"https://docs.k3s.io/quick-start"},"k3s"),", ",(0,i.kt)("a",{parentName:"li",href:"https://k3d.io/v5.4.4/#installation"},"k3d"),", and ",(0,i.kt)("a",{parentName:"li",href:"https://minikube.sigs.k8s.io/docs/tutorials/multi_node"},"MiniKube"),". ")),(0,i.kt)("h2",{id:"initialize-project"},"Initialize Project"),(0,i.kt)("p",null,"We can start by initializing this tutorial project with ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," cmd. "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"# Create a new directory and navigate into it. \nmkdir quickstart && cd quickstart\n\n# Initialize the demo project with the name of the current directory. \nkusion init\n")),(0,i.kt)("p",null,"The created project structure looks like below: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"tree\n.\n\u251c\u2500\u2500 default\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n\n2 directories, 4 files\n")),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"More details about the project and stack structure can be found in ",(0,i.kt)("a",{parentName:"p",href:"/docs/next/concepts/project/overview"},"Project")," and ",(0,i.kt)("a",{parentName:"p",href:"/docs/next/concepts/stack/overview"},"Stack"),". ")),(0,i.kt)("h3",{id:"review-configuration-files"},"Review Configuration Files"),(0,i.kt)("p",null,"Now let's have a glance at the configuration codes of ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," stack: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"cat default/main.k\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\n\n# main.k declares the customized configuration codes for default stack.\nquickstart: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n quickstart: c.Container {\n image: "kusionstack/kusion-quickstart:latest"\n }\n }\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 8080\n }\n ]\n }\n }\n}\n')),(0,i.kt)("p",null,"The configuration file ",(0,i.kt)("inlineCode",{parentName:"p"},"main.k"),", usually written by the ",(0,i.kt)("strong",{parentName:"p"},"App Developers"),", declares the customized configuration codes for ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," stack, including an ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance with the name of ",(0,i.kt)("inlineCode",{parentName:"p"},"quickstart"),". The ",(0,i.kt)("inlineCode",{parentName:"p"},"quickstart")," application consists of a ",(0,i.kt)("inlineCode",{parentName:"p"},"Workload")," with the type of ",(0,i.kt)("inlineCode",{parentName:"p"},"kam.v1.workload.Service"),", which runs a container named ",(0,i.kt)("inlineCode",{parentName:"p"},"quickstart")," using the image of ",(0,i.kt)("inlineCode",{parentName:"p"},"kusionstack/kusion-quickstart:latest"),". "),(0,i.kt)("p",null,"Besides, it declares a ",(0,i.kt)("strong",{parentName:"p"},"Kusion Module")," with the type of ",(0,i.kt)("inlineCode",{parentName:"p"},"network.Network"),", exposing ",(0,i.kt)("inlineCode",{parentName:"p"},"8080")," port to be accessed for the long-running service. "),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model can hide the major complexity of Kubernetes resources such as ",(0,i.kt)("inlineCode",{parentName:"p"},"Namespace"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Deployment"),", and ",(0,i.kt)("inlineCode",{parentName:"p"},"Service")," which will be created and managed by Kusion, providing the concepts that are ",(0,i.kt)("strong",{parentName:"p"},"application-centric")," and ",(0,i.kt)("strong",{parentName:"p"},"infrastructure-agnostic")," for a more developer-friendly experience. "),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"More details about the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model and built-in Kusion Module can be found in ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kam"},"kam")," and ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"catalog"),". ")),(0,i.kt)("p",null,"The declaration of the dependency packages can be found in ",(0,i.kt)("inlineCode",{parentName:"p"},"default/kcl.mod"),": "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"cat default/kcl.mod\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},'[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\n')),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"More details about the application model and module dependency declaration can be found in ",(0,i.kt)("a",{parentName:"p",href:"/docs/next/concepts/kusion-module/app-dev-guide"},"Kusion Module guide for app dev"),". ")),(0,i.kt)("h2",{id:"application-delivery"},"Application Delivery"),(0,i.kt)("p",null,"Use the following command to deliver the quickstart application in ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," stack on your accessible Kubernetes cluster, while watching the resource creation and automatically port-forwarding the specified port (8080) from local to the Kubernetes Service of the application. We can check the details of the resource preview results before we confirm to apply the diffs. "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"cd default && kusion apply --watch --port-forward 8080\n")),(0,i.kt)("p",null,(0,i.kt)("img",{src:n(41542).Z,width:"1886",height:"1296"})),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"During the first apply, the models and modules that the application depends on will be downloaded, so it may take some time (usually within one minute). You can take a break and have a cup of coffee. ")),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"Kusion by default will create the Kubernetes resources of the application in the namespace the same as the project name. If you want to customize the namespace, please refer to ",(0,i.kt)("strong",{parentName:"p"},"[T.B.D]"),". ")),(0,i.kt)("p",null,"Now we can visit ",(0,i.kt)("a",{parentName:"p",href:"http://localhost:8080"},"http://localhost:8080")," in our browser and play with the demo application! "),(0,i.kt)("p",null,(0,i.kt)("img",{src:n(58104).Z,width:"2872",height:"1318"})),(0,i.kt)("h2",{id:"add-mysql-accessory"},"Add MySQL Accessory"),(0,i.kt)("p",null,"As you can see, the demo application page indicates that the MySQL database is not ready yet. Hence, we will now add a MySQL database as an accessory for the workload. "),(0,i.kt)("p",null,"We can add the Kusion-provided built-in dependency in the ",(0,i.kt)("inlineCode",{parentName:"p"},"default/kcl.mod"),", so that we can use the ",(0,i.kt)("inlineCode",{parentName:"p"},"MySQL")," module in the configuration codes. "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},'[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\nmysql = { oci = "oci://ghcr.io/kusionstack/mysql", tag = "0.1.0" }\n')),(0,i.kt)("p",null,"We can update the ",(0,i.kt)("inlineCode",{parentName:"p"},"default/main.k")," with the following configuration codes: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-python"},'# The configuration codes in the perspective of developers. \nimport kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\nimport mysql\n\nquickstart: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n quickstart: c.Container {\n image: "kusionstack/kusion-quickstart:latest"\n env: {\n "DB_HOST": "$(KUSION_DB_HOST_QUICKSTART_DEFAULT_QUICKSTART_MYSQL)"\n "DB_USERNAME": "$(KUSION_DB_USERNAME_QUICKSTART_DEFAULT_QUICKSTART_MYSQL)"\n "DB_PASSWORD": "$(KUSION_DB_PASSWORD_QUICKSTART_DEFAULT_QUICKSTART_MYSQL)"\n }\n }\n }\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 8080\n }\n ]\n }\n "mysql": mysql.MySQL {\n type: "local"\n version: "8.0"\n }\n }\n}\n')),(0,i.kt)("p",null,"The configuration codes above declare a local ",(0,i.kt)("inlineCode",{parentName:"p"},"mysql.MySQL")," with the engine version of ",(0,i.kt)("inlineCode",{parentName:"p"},"8.0")," as an accessory for the application workload. The necessary Kubernetes resources for deploying and using the local MySQL database will be generated and users can get the ",(0,i.kt)("inlineCode",{parentName:"p"},"host"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"username")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"password")," of the database through the ",(0,i.kt)("a",{parentName:"p",href:"/docs/next/reference/modules/developer-schemas/database/mysql#credentials-and-connectivity"},"MySQL Credentials And Connectivity")," of Kusion in application containers. "),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"For more information about the naming convention of Kusion built-in MySQL module, you can refer to ",(0,i.kt)("a",{parentName:"p",href:"/docs/next/reference/modules/naming-conventions"},"Module Naming Convention"),". ")),(0,i.kt)("p",null,"After that, we can re-apply the application: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"kusion apply --watch --port-forward 8080\n")),(0,i.kt)("p",null,(0,i.kt)("img",{src:n(97361).Z,width:"1886",height:"1296"})),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"You may wait another minute to download the MySQL Module. ")),(0,i.kt)("p",null,"Let's visit ",(0,i.kt)("a",{parentName:"p",href:"http://localhost:8080"},"http://localhost:8080")," in our browser, and we can find that the application has successfully connected to the MySQL database. The connection information is also printed on the page. "),(0,i.kt)("p",null,(0,i.kt)("img",{src:n(48968).Z,width:"2876",height:"1556"})),(0,i.kt)("p",null,"Now please feel free to enjoy the demo application!"),(0,i.kt)("p",null,(0,i.kt)("img",{src:n(73398).Z,width:"2874",height:"1566"})),(0,i.kt)("h2",{id:"delete-application"},"Delete Application"),(0,i.kt)("p",null,"We can delete the quickstart demo workload and related accessory resources with the following cmd: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"kusion destroy --yes\n")),(0,i.kt)("p",null,(0,i.kt)("img",{src:n(61788).Z,width:"1886",height:"1298"})))}d.isMDXComponent=!0},41542:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/kusion_apply_quickstart-cb45ebe5dd7e2839261fb19b7715d5cd.gif"},61788:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/kusion_destroy_quickstart-50eb4898c1c96fc4d3914c32cec371ad.gif"},97361:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/kusion_re_apply_quickstart-5e95c1b3ed6f6d69444d4c720c31790d.gif"},73398:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/quickstart_mysql_validation-d34684107fe5c9914b783c19d949f460.gif"},58104:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/quickstart_page-6487ce3284b33db5234a96241ef72bf7.png"},48968:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/quickstart_page_with_mysql-1900976723fa14db1d29797d882d1382.png"}}]); \ No newline at end of file diff --git a/assets/js/8ed9d5b5.d4f98026.js b/assets/js/8ed9d5b5.d4f98026.js deleted file mode 100644 index b0d174f59fb..00000000000 --- a/assets/js/8ed9d5b5.d4f98026.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[308],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>k});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),c=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},p=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=c(n),k=i,m=u["".concat(s,".").concat(k)]||u[k]||d[k]||o;return n?a.createElement(m,r(r({ref:t},p),{},{components:n})):a.createElement(m,r({ref:t},p))}));function k(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,r=new Array(o);r[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>r,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var a=n(87462),i=(n(67294),n(3905));const o={id:"deliver-quickstart"},r="Run Your First App on Kubernetes with Kusion",l={unversionedId:"getting-started/deliver-quickstart",id:"getting-started/deliver-quickstart",title:"Run Your First App on Kubernetes with Kusion",description:"In this tutorial, we will walk through how to deploy a quickstart application on Kubernetes with Kusion. The demo application can interact with a locally deployed MySQL database, which is declared as an accessory in the config codes and will be automatically created and managed by Kusion.",source:"@site/docs/kusion/2-getting-started/2-deliver-quickstart.md",sourceDirName:"2-getting-started",slug:"/getting-started/deliver-quickstart",permalink:"/docs/next/getting-started/deliver-quickstart",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/2-getting-started/2-deliver-quickstart.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"deliver-quickstart"},sidebar:"kusion",previous:{title:"Install Kusion",permalink:"/docs/next/getting-started/install-kusion"},next:{title:"Overview",permalink:"/docs/next/concepts/project/overview"}},s={},c=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Initialize Project",id:"initialize-project",level:2},{value:"Review Configuration Files",id:"review-configuration-files",level:3},{value:"Application Delivery",id:"application-delivery",level:2},{value:"Add MySQL Accessory",id:"add-mysql-accessory",level:2},{value:"Delete Application",id:"delete-application",level:2}],p={toc:c};function d(e){let{components:t,...o}=e;return(0,i.kt)("wrapper",(0,a.Z)({},p,o,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"run-your-first-app-on-kubernetes-with-kusion"},"Run Your First App on Kubernetes with Kusion"),(0,i.kt)("p",null,"In this tutorial, we will walk through how to deploy a quickstart application on Kubernetes with Kusion. The demo application can interact with a locally deployed MySQL database, which is declared as an accessory in the config codes and will be automatically created and managed by Kusion. "),(0,i.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,i.kt)("p",null,"Before we start to play with this example, we need to have the Kusion CLI installed and run an accessible Kubernetes cluster. Here are some helpful documents: "),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"Install ",(0,i.kt)("a",{parentName:"li",href:"/docs/next/getting-started/install-kusion"},"Kusion CLI"),". "),(0,i.kt)("li",{parentName:"ul"},"Run a ",(0,i.kt)("a",{parentName:"li",href:"https://kubernetes.io"},"Kubernetes")," cluster. Some light and convenient options for Kubernetes local deployment include ",(0,i.kt)("a",{parentName:"li",href:"https://docs.k3s.io/quick-start"},"k3s"),", ",(0,i.kt)("a",{parentName:"li",href:"https://k3d.io/v5.4.4/#installation"},"k3d"),", and ",(0,i.kt)("a",{parentName:"li",href:"https://minikube.sigs.k8s.io/docs/tutorials/multi_node"},"MiniKube"),". ")),(0,i.kt)("h2",{id:"initialize-project"},"Initialize Project"),(0,i.kt)("p",null,"We can start by initializing this tutorial project with ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," cmd. "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"# Create a new directory and navigate into it. \nmkdir quickstart && cd quickstart\n\n# Initialize the demo project with the name of the current directory. \nkusion init\n")),(0,i.kt)("p",null,"The created project structure looks like below: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"tree\n.\n\u251c\u2500\u2500 default\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n\n2 directories, 4 files\n")),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"More details about the project and stack structure can be found in ",(0,i.kt)("a",{parentName:"p",href:"/docs/next/concepts/project/overview"},"Project")," and ",(0,i.kt)("a",{parentName:"p",href:"/docs/next/concepts/stack/overview"},"Stack"),". ")),(0,i.kt)("h3",{id:"review-configuration-files"},"Review Configuration Files"),(0,i.kt)("p",null,"Now let's have a glance at the configuration codes of ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," stack: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"cat default/main.k\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\n\n# main.k declares the customized configuration codes for default stack.\nquickstart: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n quickstart: c.Container {\n image: "kusionstack/kusion-quickstart:latest"\n }\n }\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 8080\n }\n ]\n }\n }\n}\n')),(0,i.kt)("p",null,"The configuration file ",(0,i.kt)("inlineCode",{parentName:"p"},"main.k"),", usually written by the ",(0,i.kt)("strong",{parentName:"p"},"App Developers"),", declares the customized configuration codes for ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," stack, including an ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance with the name of ",(0,i.kt)("inlineCode",{parentName:"p"},"quickstart"),". The ",(0,i.kt)("inlineCode",{parentName:"p"},"quickstart")," application consists of a ",(0,i.kt)("inlineCode",{parentName:"p"},"Workload")," with the type of ",(0,i.kt)("inlineCode",{parentName:"p"},"kam.v1.workload.Service"),", which runs a container named ",(0,i.kt)("inlineCode",{parentName:"p"},"quickstart")," using the image of ",(0,i.kt)("inlineCode",{parentName:"p"},"kusionstack/kusion-quickstart:latest"),". "),(0,i.kt)("p",null,"Besides, it declares a ",(0,i.kt)("strong",{parentName:"p"},"Kusion Module")," with the type of ",(0,i.kt)("inlineCode",{parentName:"p"},"network.Network"),", exposing ",(0,i.kt)("inlineCode",{parentName:"p"},"8080")," port to be accessed for the long-running service. "),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model can hide the major complexity of Kubernetes resources such as ",(0,i.kt)("inlineCode",{parentName:"p"},"Namespace"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Deployment"),", and ",(0,i.kt)("inlineCode",{parentName:"p"},"Service")," which will be created and managed by Kusion, providing the concepts that are ",(0,i.kt)("strong",{parentName:"p"},"application-centric")," and ",(0,i.kt)("strong",{parentName:"p"},"infrastructure-agnostic")," for a more developer-friendly experience. "),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"More details about the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model and built-in Kusion Module can be found in ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kam"},"kam")," and ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"catalog"),". ")),(0,i.kt)("p",null,"The declaration of the dependency packages can be found in ",(0,i.kt)("inlineCode",{parentName:"p"},"default/kcl.mod"),": "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"cat default/kcl.mod\n")),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},'[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\n')),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"More details about the application model and module dependency declaration can be found in ",(0,i.kt)("a",{parentName:"p",href:"/docs/next/concepts/kusion-module/app-dev-guide"},"Kusion Module guide for app dev"),". ")),(0,i.kt)("h2",{id:"application-delivery"},"Application Delivery"),(0,i.kt)("p",null,"Use the following command to deliver the quickstart application in ",(0,i.kt)("inlineCode",{parentName:"p"},"default")," stack on your accessible Kubernetes cluster, while watching the resource creation and automatically port-forwarding the specified port (8080) from local to the Kubernetes Service of the application. We can check the details of the resource preview results before we confirm to apply the diffs. "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"cd default && kusion apply --watch --port-forward 8080\n")),(0,i.kt)("p",null,(0,i.kt)("img",{src:n(41542).Z,width:"1886",height:"1296"})),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"During the first apply, the models and modules that the application depends on will be downloaded, so it may take some time (usually within one minute). You can take a break and have a cup of coffee. ")),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"Kusion by default will create the Kubernetes resources of the application in the namespace the same as the project name. If you want to customize the namespace, please refer to ",(0,i.kt)("strong",{parentName:"p"},"[T.B.D]"),". ")),(0,i.kt)("p",null,"Now we can visit ",(0,i.kt)("a",{parentName:"p",href:"http://localhost:8080"},"http://localhost:8080")," in our browser and play with the demo application! "),(0,i.kt)("p",null,(0,i.kt)("img",{src:n(58104).Z,width:"2872",height:"1318"})),(0,i.kt)("h2",{id:"add-mysql-accessory"},"Add MySQL Accessory"),(0,i.kt)("p",null,"As you can see, the demo application page indicates that the MySQL database is not ready yet. Hence, we will now add a MySQL database as an accessory for the workload. "),(0,i.kt)("p",null,"We can add the Kusion-provided built-in dependency in the ",(0,i.kt)("inlineCode",{parentName:"p"},"default/kcl.mod"),", so that we can use the ",(0,i.kt)("inlineCode",{parentName:"p"},"MySQL")," module in the configuration codes. "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},'[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\nmysql = { oci = "oci://ghcr.io/kusionstack/mysql", tag = "0.1.0" }\n')),(0,i.kt)("p",null,"We can update the ",(0,i.kt)("inlineCode",{parentName:"p"},"default/main.k")," with the following configuration codes: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-python"},'# The configuration codes in the perspective of developers. \nimport kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\nimport mysql\n\nquickstart: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n quickstart: c.Container {\n image: "kusionstack/kusion-quickstart:latest"\n env: {\n "DB_HOST": "$(KUSION_DB_HOST_QUICKSTART_DEFAULT_QUICKSTART_MYSQL)"\n "DB_USERNAME": "$(KUSION_DB_USERNAME_QUICKSTART_DEFAULT_QUICKSTART_MYSQL)"\n "DB_PASSWORD": "$(KUSION_DB_PASSWORD_QUICKSTART_DEFAULT_QUICKSTART_MYSQL)"\n }\n }\n }\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 8080\n }\n ]\n }\n "mysql": mysql.MySQL {\n type: "local"\n version: "8.0"\n }\n }\n}\n')),(0,i.kt)("p",null,"The configuration codes above declare a local ",(0,i.kt)("inlineCode",{parentName:"p"},"mysql.MySQL")," with the engine version of ",(0,i.kt)("inlineCode",{parentName:"p"},"8.0")," as an accessory for the application workload. The necessary Kubernetes resources for deploying and using the local MySQL database will be generated and users can get the ",(0,i.kt)("inlineCode",{parentName:"p"},"host"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"username")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"password")," of the database through the ",(0,i.kt)("a",{parentName:"p",href:"/docs/next/reference/modules/developer-schemas/database/mysql#credentials-and-connectivity"},"MySQL Credentials And Connectivity")," of Kusion in application containers. "),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"For more information about the naming convention of Kusion built-in MySQL module, you can refer to ",(0,i.kt)("a",{parentName:"p",href:"/docs/next/reference/modules/naming-conventions"},"Module Naming Convention"),". ")),(0,i.kt)("p",null,"After that, we can re-apply the application: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"kusion apply --watch --port-forward 8080\n")),(0,i.kt)("p",null,(0,i.kt)("img",{src:n(97361).Z,width:"1886",height:"1296"})),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"You may wait another minute to download the MySQL Module. ")),(0,i.kt)("p",null,"Let's visit ",(0,i.kt)("a",{parentName:"p",href:"http://localhost:8080"},"http://localhost:8080")," in our browser, and we can find that the application has successfully connected to the MySQL database. The connection information is also printed on the page. "),(0,i.kt)("p",null,(0,i.kt)("img",{src:n(48968).Z,width:"2876",height:"1556"})),(0,i.kt)("p",null,"Now please feel free to enjoy the demo application!"),(0,i.kt)("p",null,(0,i.kt)("img",{src:n(73398).Z,width:"2874",height:"1566"})),(0,i.kt)("h2",{id:"delete-application"},"Delete Application"),(0,i.kt)("p",null,"We can delete the quickstart demo workload and related accessory resources with the following cmd: "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"kusion destroy --yes\n")),(0,i.kt)("p",null,(0,i.kt)("img",{src:n(61788).Z,width:"1886",height:"1298"})))}d.isMDXComponent=!0},41542:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/kusion_apply_quickstart-cb45ebe5dd7e2839261fb19b7715d5cd.gif"},61788:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/kusion_destroy_quickstart-50eb4898c1c96fc4d3914c32cec371ad.gif"},97361:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/kusion_re_apply_quickstart-5e95c1b3ed6f6d69444d4c720c31790d.gif"},73398:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/quickstart_mysql_validation-d34684107fe5c9914b783c19d949f460.gif"},58104:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/quickstart_page-6487ce3284b33db5234a96241ef72bf7.png"},48968:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/quickstart_page_with_mysql-1900976723fa14db1d29797d882d1382.png"}}]); \ No newline at end of file diff --git a/assets/js/8fcded8c.8eb56230.js b/assets/js/8fcded8c.8eb56230.js new file mode 100644 index 00000000000..6382dde35bf --- /dev/null +++ b/assets/js/8fcded8c.8eb56230.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9803],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=s(n),m=i,k=d["".concat(p,".").concat(m)]||d[m]||c[m]||r;return n?a.createElement(k,o(o({ref:t},u),{},{components:n})):a.createElement(k,o({ref:t},u))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,o=new Array(r);o[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:i,o[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>c,frontMatter:()=>r,metadata:()=>l,toc:()=>s});var a=n(87462),i=(n(67294),n(3905));const r={id:"set-up-operational-rules"},o="Set up Operational Rules",l={unversionedId:"user-guides/working-with-k8s/set-up-operational-rules",id:"user-guides/working-with-k8s/set-up-operational-rules",title:"Set up Operational Rules",description:"You can set up operational rules in the AppConfiguration model with the opsrule accessory and corresponding platform configurations in the workspace directory. The opsrule is the collection of operational rule requirements for the application that are used as a preemptive measure to police and stop any unwanted changes.",source:"@site/docs/kusion/5-user-guides/2-working-with-k8s/6-set-up-operational-rules.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/set-up-operational-rules",permalink:"/docs/next/user-guides/working-with-k8s/set-up-operational-rules",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/5-user-guides/2-working-with-k8s/6-set-up-operational-rules.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:6,frontMatter:{id:"set-up-operational-rules"},sidebar:"kusion",previous:{title:"Configure Resource Specification",permalink:"/docs/next/user-guides/working-with-k8s/resource-spec"},next:{title:"Schedule a Job",permalink:"/docs/next/user-guides/working-with-k8s/job"}},p={},s=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],u={toc:s};function c(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"set-up-operational-rules"},"Set up Operational Rules"),(0,i.kt)("p",null,"You can set up operational rules in the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model with the ",(0,i.kt)("inlineCode",{parentName:"p"},"opsrule")," accessory and corresponding platform configurations in the workspace directory. The ",(0,i.kt)("inlineCode",{parentName:"p"},"opsrule")," is the collection of operational rule requirements for the application that are used as a preemptive measure to police and stop any unwanted changes."),(0,i.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,i.kt)("p",null,"Please refer to the ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,i.kt)("p",null,"The example below also requires you to have ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,i.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,i.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,i.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,i.kt)("p",null,"However, if you (or the platform team) would like to set default values for the opsrule to standardize the behavior of applications, you can do so by updating the ",(0,i.kt)("inlineCode",{parentName:"p"},"~/dev.yaml"),".\nNote that the platform engineers should set the default workload to ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/operating"},"Kusion Operation CollaSet")," and installed the Kusion Operation controllers properly, the ",(0,i.kt)("inlineCode",{parentName:"p"},"opsrules")," module will generate a ",(0,i.kt)("a",{parentName:"p",href:"https://www.kusionstack.io/docs/operating/manuals/podtransitionrule"},"PodTransitionRule")," instead of updating the ",(0,i.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," value in the deployment:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n service:\n default:\n type: CollaSet\n kusionstack/opsrule@0.1.0:\n default:\n maxUnavailable: 30%\n")),(0,i.kt)("p",null,"Please note that the ",(0,i.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," in the workspace configuration only works as a default value and will be overridden by the value set in the application configuration."),(0,i.kt)("p",null,"The workspace configuration need to be updated with the command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace update dev -f ~/dev.yaml\n")),(0,i.kt)("h2",{id:"example"},"Example"),(0,i.kt)("p",null,"Add the ",(0,i.kt)("inlineCode",{parentName:"p"},"opsrule")," module dependency to ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod"),": "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},'[package]\nname = "simple-service"\nversion = "0.1.0"\n\n[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\nopsrule = { oci = "oci://ghcr.io/kusionstack/opsrule", tag = "0.1.0" }\n\n[profile]\nentries = ["main.k"]\n')),(0,i.kt)("p",null,"Add the ",(0,i.kt)("inlineCode",{parentName:"p"},"opsrule")," snippet to the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," in ",(0,i.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-py"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport opsrule\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Service {\n ...\n }\n # Configure the maxUnavailable rule\n accessories: {\n "opsrule": opsrule.OpsRule {\n "maxUnavailable": 50%\n }\n }\n}\n')),(0,i.kt)("h2",{id:"applying"},"Applying"),(0,i.kt)("p",null,"Re-run steps in ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", resource scaling is completed."),(0,i.kt)("h2",{id:"validation"},"Validation"),(0,i.kt)("p",null,"We can verify the application deployment strategy now has the updated attributes ",(0,i.kt)("inlineCode",{parentName:"p"},"maxUnavailable: 50%")," in the container configuration."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8fcded8c.b2a5625d.js b/assets/js/8fcded8c.b2a5625d.js deleted file mode 100644 index 09571321144..00000000000 --- a/assets/js/8fcded8c.b2a5625d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9803],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=s(n),m=i,k=d["".concat(p,".").concat(m)]||d[m]||c[m]||r;return n?a.createElement(k,o(o({ref:t},u),{},{components:n})):a.createElement(k,o({ref:t},u))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,o=new Array(r);o[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:i,o[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>c,frontMatter:()=>r,metadata:()=>l,toc:()=>s});var a=n(87462),i=(n(67294),n(3905));const r={id:"set-up-operational-rules"},o="Set up Operational Rules",l={unversionedId:"user-guides/working-with-k8s/set-up-operational-rules",id:"user-guides/working-with-k8s/set-up-operational-rules",title:"Set up Operational Rules",description:"You can set up operational rules in the AppConfiguration model with the opsrule accessory and corresponding platform configurations in the workspace directory. The opsrule is the collection of operational rule requirements for the application that are used as a preemptive measure to police and stop any unwanted changes.",source:"@site/docs/kusion/5-user-guides/2-working-with-k8s/6-set-up-operational-rules.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/set-up-operational-rules",permalink:"/docs/next/user-guides/working-with-k8s/set-up-operational-rules",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/5-user-guides/2-working-with-k8s/6-set-up-operational-rules.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:6,frontMatter:{id:"set-up-operational-rules"},sidebar:"kusion",previous:{title:"Configure Resource Specification",permalink:"/docs/next/user-guides/working-with-k8s/resource-spec"},next:{title:"Schedule a Job",permalink:"/docs/next/user-guides/working-with-k8s/job"}},p={},s=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],u={toc:s};function c(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"set-up-operational-rules"},"Set up Operational Rules"),(0,i.kt)("p",null,"You can set up operational rules in the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model with the ",(0,i.kt)("inlineCode",{parentName:"p"},"opsrule")," accessory and corresponding platform configurations in the workspace directory. The ",(0,i.kt)("inlineCode",{parentName:"p"},"opsrule")," is the collection of operational rule requirements for the application that are used as a preemptive measure to police and stop any unwanted changes."),(0,i.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,i.kt)("p",null,"Please refer to the ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,i.kt)("p",null,"The example below also requires you to have ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,i.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,i.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,i.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,i.kt)("p",null,"However, if you (or the platform team) would like to set default values for the opsrule to standardize the behavior of applications, you can do so by updating the ",(0,i.kt)("inlineCode",{parentName:"p"},"~/dev.yaml"),".\nNote that the platform engineers should set the default workload to ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/operating"},"Kusion Operation CollaSet")," and installed the Kusion Operation controllers properly, the ",(0,i.kt)("inlineCode",{parentName:"p"},"opsrules")," module will generate a ",(0,i.kt)("a",{parentName:"p",href:"https://www.kusionstack.io/docs/operating/manuals/podtransitionrule"},"PodTransitionRule")," instead of updating the ",(0,i.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," value in the deployment:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n service:\n default:\n type: CollaSet\n kusionstack/opsrule@0.1.0:\n default:\n maxUnavailable: 30%\n")),(0,i.kt)("p",null,"Please note that the ",(0,i.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," in the workspace configuration only works as a default value and will be overridden by the value set in the application configuration."),(0,i.kt)("p",null,"The workspace configuration need to be updated with the command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace update dev -f ~/dev.yaml\n")),(0,i.kt)("h2",{id:"example"},"Example"),(0,i.kt)("p",null,"Add the ",(0,i.kt)("inlineCode",{parentName:"p"},"opsrule")," module dependency to ",(0,i.kt)("inlineCode",{parentName:"p"},"kcl.mod"),": "),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},'[package]\nname = "simple-service"\nversion = "0.1.0"\n\n[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\nopsrule = { oci = "oci://ghcr.io/kusionstack/opsrule", tag = "0.1.0" }\n\n[profile]\nentries = ["main.k"]\n')),(0,i.kt)("p",null,"Add the ",(0,i.kt)("inlineCode",{parentName:"p"},"opsrule")," snippet to the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," in ",(0,i.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-py"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport opsrule\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Service {\n ...\n }\n # Configure the maxUnavailable rule\n accessories: {\n "opsrule": opsrule.OpsRule {\n "maxUnavailable": 50%\n }\n }\n}\n')),(0,i.kt)("h2",{id:"applying"},"Applying"),(0,i.kt)("p",null,"Re-run steps in ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", resource scaling is completed."),(0,i.kt)("h2",{id:"validation"},"Validation"),(0,i.kt)("p",null,"We can verify the application deployment strategy now has the updated attributes ",(0,i.kt)("inlineCode",{parentName:"p"},"maxUnavailable: 50%")," in the container configuration."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/90c4e188.5499a4f1.js b/assets/js/90c4e188.08e509b3.js similarity index 51% rename from assets/js/90c4e188.5499a4f1.js rename to assets/js/90c4e188.08e509b3.js index afcc748e5fe..9c36a756d68 100644 --- a/assets/js/90c4e188.5499a4f1.js +++ b/assets/js/90c4e188.08e509b3.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4397],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=s(n),m=r,f=d["".concat(p,".").concat(m)]||d[m]||c[m]||o;return n?a.createElement(f,i(i({ref:t},u),{},{components:n})):a.createElement(f,i({ref:t},u))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>c,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var a=n(87462),r=(n(67294),n(3905));const o={id:"operational-rules"},i="Operational Rules",l={unversionedId:"configuration-walkthrough/operational-rules",id:"version-v0.10/configuration-walkthrough/operational-rules",title:"Operational Rules",description:"The opsRule attribute in the AppConfiguration instance is used to describe the specification for the collection of operational rule requirements for the application. Operational rules are used as a preemptive measure to police and stop any unwanted changes.",source:"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/9-operational-rules.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/operational-rules",permalink:"/docs/v0.10/configuration-walkthrough/operational-rules",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/9-operational-rules.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:9,frontMatter:{id:"operational-rules"},sidebar:"kusion",previous:{title:"Application Monitoring",permalink:"/docs/v0.10/configuration-walkthrough/monitoring"},next:{title:"Deliver the WordPress Application with Cloud RDS",permalink:"/docs/v0.10/user-guides/cloud-resources/database"}},p={},s=[{value:"Import",id:"import",level:2},{value:"Max Unavailable Replicas",id:"max-unavailable-replicas",level:2}],u={toc:s};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"operational-rules"},"Operational Rules"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"opsRule")," attribute in the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance is used to describe the specification for the collection of operational rule requirements for the application. Operational rules are used as a preemptive measure to police and stop any unwanted changes."),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"catalog")," package. For more details on KCL package import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.trait as t\n")),(0,r.kt)("h2",{id:"max-unavailable-replicas"},"Max Unavailable Replicas"),(0,r.kt)("p",null,"Currently, ",(0,r.kt)("inlineCode",{parentName:"p"},"OpsRule")," supports setting a ",(0,r.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," parameter, which specifies the maximum number of pods that can be rendered unavailable at any time. It can be either a fraction of the total pods for the current application or a fixed number. This operational rule is particularly helpful against unexpected changes or deletes to the workloads. It can also prevent too many workloads from going down during an application upgrade."),(0,r.kt)("p",null,"More rules will be available in future versions of Kusion."),(0,r.kt)("p",null,"To set ",(0,r.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," to a percentage of pods:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n # ...\n }\n }\n opsRule: t.OpsRule {\n maxUnavailable: "30%"\n }\n}\n')),(0,r.kt)("p",null,"To set ",(0,r.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," to a fixed number of pods:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n opsRule: t.OpsRule {\n maxUnavailable: 2\n }\n}\n")))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4397],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=s(n),m=r,f=d["".concat(p,".").concat(m)]||d[m]||c[m]||o;return n?a.createElement(f,i(i({ref:t},u),{},{components:n})):a.createElement(f,i({ref:t},u))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>c,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var a=n(87462),r=(n(67294),n(3905));const o={id:"operational-rules"},i="Operational Rules",l={unversionedId:"configuration-walkthrough/operational-rules",id:"version-v0.10/configuration-walkthrough/operational-rules",title:"Operational Rules",description:"The opsRule attribute in the AppConfiguration instance is used to describe the specification for the collection of operational rule requirements for the application. Operational rules are used as a preemptive measure to police and stop any unwanted changes.",source:"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/9-operational-rules.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/operational-rules",permalink:"/docs/v0.10/configuration-walkthrough/operational-rules",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/9-operational-rules.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:9,frontMatter:{id:"operational-rules"},sidebar:"kusion",previous:{title:"Application Monitoring",permalink:"/docs/v0.10/configuration-walkthrough/monitoring"},next:{title:"Deliver the WordPress Application with Cloud RDS",permalink:"/docs/v0.10/user-guides/cloud-resources/database"}},p={},s=[{value:"Import",id:"import",level:2},{value:"Max Unavailable Replicas",id:"max-unavailable-replicas",level:2}],u={toc:s};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"operational-rules"},"Operational Rules"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"opsRule")," attribute in the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance is used to describe the specification for the collection of operational rule requirements for the application. Operational rules are used as a preemptive measure to police and stop any unwanted changes."),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"catalog")," package. For more details on KCL package import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.trait as t\n")),(0,r.kt)("h2",{id:"max-unavailable-replicas"},"Max Unavailable Replicas"),(0,r.kt)("p",null,"Currently, ",(0,r.kt)("inlineCode",{parentName:"p"},"OpsRule")," supports setting a ",(0,r.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," parameter, which specifies the maximum number of pods that can be rendered unavailable at any time. It can be either a fraction of the total pods for the current application or a fixed number. This operational rule is particularly helpful against unexpected changes or deletes to the workloads. It can also prevent too many workloads from going down during an application upgrade."),(0,r.kt)("p",null,"More rules will be available in future versions of Kusion."),(0,r.kt)("p",null,"To set ",(0,r.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," to a percentage of pods:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n # ...\n }\n }\n opsRule: t.OpsRule {\n maxUnavailable: "30%"\n }\n}\n')),(0,r.kt)("p",null,"To set ",(0,r.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," to a fixed number of pods:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n opsRule: t.OpsRule {\n maxUnavailable: 2\n }\n}\n")))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/914bff86.0ff03e69.js b/assets/js/914bff86.0ff03e69.js deleted file mode 100644 index 02fb7576b35..00000000000 --- a/assets/js/914bff86.0ff03e69.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3310],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>f});var o=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var c=o.createContext({}),l=function(e){var t=o.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},u=function(e){var t=l(e.components);return o.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,c=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=l(n),f=i,h=d["".concat(c,".").concat(f)]||d[f]||p[f]||r;return n?o.createElement(h,a(a({ref:t},u),{},{components:n})):o.createElement(h,a({ref:t},u))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,a=new Array(r);a[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:i,a[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>p,frontMatter:()=>r,metadata:()=>s,toc:()=>l});var o=n(87462),i=(n(67294),n(3905));const r={id:"intent",sidebar_label:"Intent"},a="Intent",s={unversionedId:"concepts/intent",id:"version-v0.10/concepts/intent",title:"Intent",description:"The Intent represents the operational intentions that you aim to deliver using Kusion. These intentions are expected to contain all components throughout the software development lifecycle (SDLC), including resources (workload, database, load balancer, etc.), dependencies, and policies. The Kusion module generators are responsible for converting all AppConfigurations and environment configurations into the Intent. Once the Intent is generated, the Kusion Engine takes charge of updating the actual infrastructures to match the Intent.",source:"@site/docs_versioned_docs/version-v0.10/3-concepts/6-intent.md",sourceDirName:"3-concepts",slug:"/concepts/intent",permalink:"/docs/v0.10/concepts/intent",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/3-concepts/6-intent.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:6,frontMatter:{id:"intent",sidebar_label:"Intent"},sidebar:"kusion",previous:{title:"AppConfiguration",permalink:"/docs/v0.10/concepts/app-configuration"},next:{title:"Backend Configuration",permalink:"/docs/v0.10/concepts/backend-configuration"}},c={},l=[{value:"Purpose",id:"purpose",level:2},{value:"Single Source of Truth",id:"single-source-of-truth",level:3},{value:"Consistency",id:"consistency",level:3},{value:"Rollback and Disaster Recovery",id:"rollback-and-disaster-recovery",level:3}],u={toc:l};function p(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,o.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"intent"},"Intent"),(0,i.kt)("p",null,"The Intent represents the operational intentions that you aim to deliver using Kusion. These intentions are expected to contain all components throughout the software development lifecycle (SDLC), including resources (workload, database, load balancer, etc.), dependencies, and policies. The Kusion module generators are responsible for converting all AppConfigurations and environment configurations into the Intent. Once the Intent is generated, the Kusion Engine takes charge of updating the actual infrastructures to match the Intent."),(0,i.kt)("h2",{id:"purpose"},"Purpose"),(0,i.kt)("h3",{id:"single-source-of-truth"},"Single Source of Truth"),(0,i.kt)("p",null,"In Kusion's workflow, the platform engineer builds Kusion modules and provides environment configurations, application developers choose Kusion modules they need and deploy operational intentions to an environment with related environment configurations. They can also input dynamic parameters like the container image when executing the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion build")," command. So the final operational intentions include configurations written by application developers, environment configurations and dynamic inputs. Due to this reason, we introduce ",(0,i.kt)("strong",{parentName:"p"},"Intent")," to represent the SSoT(Single Source of Truth) of Kusion. It is the result of ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion build")," which contains all operational intentions from different sources."),(0,i.kt)("h3",{id:"consistency"},"Consistency"),(0,i.kt)("p",null,"Delivering an application to different environments with identical configurations is a common practice, especially for applications that require scalable distribution. In such cases, an immutable configuration package is helpful. By utilizing the Intent, all configurations and changes are stored in a single file. As the Intent is the input of Kusion, it ensures consistency across different environments whenever you execute Kusion with the same Intent file."),(0,i.kt)("h3",{id:"rollback-and-disaster-recovery"},"Rollback and Disaster Recovery"),(0,i.kt)("p",null,"The ability to roll back is crucial in reducing incident duration. Rolling back the system to a previously validated version is much faster compared to attempting to fix it during an outage. We regard a validated Intent as a snapshot of the system and recommend storing the Intent in a version control system like Git. This enables better change management practices and makes it simpler to roll back to previous versions if needed. In case of a failure or outage, having a validated Intent simplifies the rollback process, ensuring that the system can be quickly recovered."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/914bff86.64064a50.js b/assets/js/914bff86.64064a50.js new file mode 100644 index 00000000000..f9a6d7b8a64 --- /dev/null +++ b/assets/js/914bff86.64064a50.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3310],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>f});var o=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var c=o.createContext({}),l=function(e){var t=o.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},u=function(e){var t=l(e.components);return o.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,c=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=l(n),f=i,h=d["".concat(c,".").concat(f)]||d[f]||p[f]||r;return n?o.createElement(h,a(a({ref:t},u),{},{components:n})):o.createElement(h,a({ref:t},u))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,a=new Array(r);a[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:i,a[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>p,frontMatter:()=>r,metadata:()=>s,toc:()=>l});var o=n(87462),i=(n(67294),n(3905));const r={id:"intent",sidebar_label:"Intent"},a="Intent",s={unversionedId:"concepts/intent",id:"version-v0.10/concepts/intent",title:"Intent",description:"The Intent represents the operational intentions that you aim to deliver using Kusion. These intentions are expected to contain all components throughout the software development lifecycle (SDLC), including resources (workload, database, load balancer, etc.), dependencies, and policies. The Kusion module generators are responsible for converting all AppConfigurations and environment configurations into the Intent. Once the Intent is generated, the Kusion Engine takes charge of updating the actual infrastructures to match the Intent.",source:"@site/docs_versioned_docs/version-v0.10/3-concepts/6-intent.md",sourceDirName:"3-concepts",slug:"/concepts/intent",permalink:"/docs/v0.10/concepts/intent",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/3-concepts/6-intent.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:6,frontMatter:{id:"intent",sidebar_label:"Intent"},sidebar:"kusion",previous:{title:"AppConfiguration",permalink:"/docs/v0.10/concepts/app-configuration"},next:{title:"Backend Configuration",permalink:"/docs/v0.10/concepts/backend-configuration"}},c={},l=[{value:"Purpose",id:"purpose",level:2},{value:"Single Source of Truth",id:"single-source-of-truth",level:3},{value:"Consistency",id:"consistency",level:3},{value:"Rollback and Disaster Recovery",id:"rollback-and-disaster-recovery",level:3}],u={toc:l};function p(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,o.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"intent"},"Intent"),(0,i.kt)("p",null,"The Intent represents the operational intentions that you aim to deliver using Kusion. These intentions are expected to contain all components throughout the software development lifecycle (SDLC), including resources (workload, database, load balancer, etc.), dependencies, and policies. The Kusion module generators are responsible for converting all AppConfigurations and environment configurations into the Intent. Once the Intent is generated, the Kusion Engine takes charge of updating the actual infrastructures to match the Intent."),(0,i.kt)("h2",{id:"purpose"},"Purpose"),(0,i.kt)("h3",{id:"single-source-of-truth"},"Single Source of Truth"),(0,i.kt)("p",null,"In Kusion's workflow, the platform engineer builds Kusion modules and provides environment configurations, application developers choose Kusion modules they need and deploy operational intentions to an environment with related environment configurations. They can also input dynamic parameters like the container image when executing the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion build")," command. So the final operational intentions include configurations written by application developers, environment configurations and dynamic inputs. Due to this reason, we introduce ",(0,i.kt)("strong",{parentName:"p"},"Intent")," to represent the SSoT(Single Source of Truth) of Kusion. It is the result of ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion build")," which contains all operational intentions from different sources."),(0,i.kt)("h3",{id:"consistency"},"Consistency"),(0,i.kt)("p",null,"Delivering an application to different environments with identical configurations is a common practice, especially for applications that require scalable distribution. In such cases, an immutable configuration package is helpful. By utilizing the Intent, all configurations and changes are stored in a single file. As the Intent is the input of Kusion, it ensures consistency across different environments whenever you execute Kusion with the same Intent file."),(0,i.kt)("h3",{id:"rollback-and-disaster-recovery"},"Rollback and Disaster Recovery"),(0,i.kt)("p",null,"The ability to roll back is crucial in reducing incident duration. Rolling back the system to a previously validated version is much faster compared to attempting to fix it during an outage. We regard a validated Intent as a snapshot of the system and recommend storing the Intent in a version control system like Git. This enables better change management practices and makes it simpler to roll back to previous versions if needed. In case of a failure or outage, having a validated Intent simplifies the rollback process, ensuring that the system can be quickly recovered."))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9218050e.a11620aa.js b/assets/js/9218050e.a11620aa.js deleted file mode 100644 index 81431dca0fe..00000000000 --- a/assets/js/9218050e.a11620aa.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5692],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=c(r),m=a,k=d["".concat(s,".").concat(m)]||d[m]||u[m]||l;return r?n.createElement(k,o(o({ref:t},p),{},{components:r})):n.createElement(k,o({ref:t},p))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var c=2;c{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>l,metadata:()=>i,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const l={},o="service",i={unversionedId:"reference/modules/workspace-configs/workload/service",id:"version-v0.11/reference/modules/workspace-configs/workload/service",title:"service",description:"service can be used to define workspace-level service configuration.",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/workload/service.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/workload",slug:"/reference/modules/workspace-configs/workload/service",permalink:"/docs/reference/modules/workspace-configs/workload/service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/workload/service.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"job",permalink:"/docs/reference/modules/workspace-configs/workload/job"},next:{title:"Resource Naming Conventions",permalink:"/docs/reference/modules/naming-conventions"}},s={},c=[{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:c};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"service"},"service"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"service")," can be used to define workspace-level service configuration."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"replicas"),(0,a.kt)("br",null),"Number of container replicas based on this configuration that should be ran."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"2"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels"),(0,a.kt)("br",null),"Labels are key/value pairs that are attached to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations"),(0,a.kt)("br",null),"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"type"),(0,a.kt)("br",null),"Type represents the type of workload used by this Service. Currently, it supports several",(0,a.kt)("br",null),"types, including Deployment and CollaSet."),(0,a.kt)("td",{parentName:"tr",align:null},'"Deployment" ',"|",' "CollaSet"'),(0,a.kt)("td",{parentName:"tr",align:null},"Deployment"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n service:\n default:\n replicas: 3\n labels:\n label-key: label-value\n annotations:\n annotation-key: annotation-value\n type: CollaSet\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9218050e.aa0e81f8.js b/assets/js/9218050e.aa0e81f8.js new file mode 100644 index 00000000000..1fae25c8ace --- /dev/null +++ b/assets/js/9218050e.aa0e81f8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5692],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=c(r),m=a,k=d["".concat(s,".").concat(m)]||d[m]||u[m]||l;return r?n.createElement(k,o(o({ref:t},p),{},{components:r})):n.createElement(k,o({ref:t},p))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var c=2;c{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>l,metadata:()=>i,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const l={},o="service",i={unversionedId:"reference/modules/workspace-configs/workload/service",id:"version-v0.11/reference/modules/workspace-configs/workload/service",title:"service",description:"service can be used to define workspace-level service configuration.",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/workload/service.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/workload",slug:"/reference/modules/workspace-configs/workload/service",permalink:"/docs/reference/modules/workspace-configs/workload/service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/workload/service.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"job",permalink:"/docs/reference/modules/workspace-configs/workload/job"},next:{title:"Resource Naming Conventions",permalink:"/docs/reference/modules/naming-conventions"}},s={},c=[{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:c};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"service"},"service"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"service")," can be used to define workspace-level service configuration."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"replicas"),(0,a.kt)("br",null),"Number of container replicas based on this configuration that should be ran."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"2"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels"),(0,a.kt)("br",null),"Labels are key/value pairs that are attached to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations"),(0,a.kt)("br",null),"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"type"),(0,a.kt)("br",null),"Type represents the type of workload used by this Service. Currently, it supports several",(0,a.kt)("br",null),"types, including Deployment and CollaSet."),(0,a.kt)("td",{parentName:"tr",align:null},'"Deployment" ',"|",' "CollaSet"'),(0,a.kt)("td",{parentName:"tr",align:null},"Deployment"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n service:\n default:\n replicas: 3\n labels:\n label-key: label-value\n annotations:\n annotation-key: annotation-value\n type: CollaSet\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/926125d1.1f30f9d3.js b/assets/js/926125d1.1f30f9d3.js new file mode 100644 index 00000000000..08b69cd06a7 --- /dev/null +++ b/assets/js/926125d1.1f30f9d3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8503],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),d=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=d(e.components);return r.createElement(i.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),p=d(n),m=a,f=p["".concat(i,".").concat(m)]||p[m]||c[m]||l;return n?r.createElement(f,o(o({ref:t},u),{},{components:n})):r.createElement(f,o({ref:t},u))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,o=new Array(l);o[0]=p;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var d=2;d{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>c,frontMatter:()=>l,metadata:()=>s,toc:()=>d});var r=n(87462),a=(n(67294),n(3905));const l={},o="mysql",s={unversionedId:"reference/modules/workspace-configs/database/mysql",id:"version-v0.10/reference/modules/workspace-configs/database/mysql",title:"mysql",description:"Module MySQL",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/database/mysql.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/database",slug:"/reference/modules/workspace-configs/database/mysql",permalink:"/docs/v0.10/reference/modules/workspace-configs/database/mysql",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/database/mysql.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"service",permalink:"/docs/v0.10/reference/modules/catalog-models/workload/service"},next:{title:"postgres",permalink:"/docs/v0.10/reference/modules/workspace-configs/database/postgres"}},i={},d=[{value:"Module MySQL",id:"module-mysql",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],u={toc:d};function c(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"mysql"},"mysql"),(0,a.kt)("h2",{id:"module-mysql"},"Module MySQL"),(0,a.kt)("p",null,"MySQL describes the attributes to locally deploy or create a cloud provider managed mysql database instance for the workload. "),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"cloud"),(0,a.kt)("br",null),"Cloud specifies the type of the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},'"aws" ',"|",' "alicloud"'),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"username"),(0,a.kt)("br",null),"Username specifies the operation account for the mysql database."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},'"root"'),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"category"),(0,a.kt)("br",null),"Category specifies the edition of the mysql instance provided by the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},'"Basic"'),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"securityIPs"),(0,a.kt)("br",null),"SecurityIPs specifies the list of IP addresses allowed to access the mysql instance provided by the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},"[str]"),(0,a.kt)("td",{parentName:"tr",align:null},'["0.0.0.0/0"]'),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"privateRouting"),(0,a.kt)("br",null),"PrivateRouting specifies whether the host address of the cloud mysql instance for the workload to connect with is via public network or private network of the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},"bool"),(0,a.kt)("td",{parentName:"tr",align:null},"true"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"size"),(0,a.kt)("br",null),"Size specifies the allocated storage size of the mysql instance."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"10"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"subnetID"),(0,a.kt)("br",null),"SubnetID specifies the virtual subnet ID associated with the VPC that the cloud mysql instance will be created in."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"suffix"),(0,a.kt)("br",null),"Suffix specifies the suffix of the database name."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n aws: \n version: 5.0.1\n source: hashicorp/aws\n region: us-east-1\n\n# MySQL workspace configs for AWS RDS\nmodules: \n mysql: \n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n privateRouting: false\n suffix: "-mysql"\n')),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n alicloud: \n version: 1.209.1\n source: aliyun/alicloud\n region: cn-beijing\n\n# MySQL workspace configs for Alicloud RDS\nmodules: \n mysql: \n default: \n cloud: alicloud\n size: 20\n instanceType: mysql.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n suffix: "-mysql"\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/926125d1.6aa425a8.js b/assets/js/926125d1.6aa425a8.js deleted file mode 100644 index 3cf24af5e51..00000000000 --- a/assets/js/926125d1.6aa425a8.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8503],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),d=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=d(e.components);return r.createElement(i.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},p=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),p=d(n),m=a,f=p["".concat(i,".").concat(m)]||p[m]||c[m]||l;return n?r.createElement(f,o(o({ref:t},u),{},{components:n})):r.createElement(f,o({ref:t},u))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,o=new Array(l);o[0]=p;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var d=2;d{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>c,frontMatter:()=>l,metadata:()=>s,toc:()=>d});var r=n(87462),a=(n(67294),n(3905));const l={},o="mysql",s={unversionedId:"reference/modules/workspace-configs/database/mysql",id:"version-v0.10/reference/modules/workspace-configs/database/mysql",title:"mysql",description:"Module MySQL",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/database/mysql.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/database",slug:"/reference/modules/workspace-configs/database/mysql",permalink:"/docs/v0.10/reference/modules/workspace-configs/database/mysql",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/database/mysql.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"service",permalink:"/docs/v0.10/reference/modules/catalog-models/workload/service"},next:{title:"postgres",permalink:"/docs/v0.10/reference/modules/workspace-configs/database/postgres"}},i={},d=[{value:"Module MySQL",id:"module-mysql",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],u={toc:d};function c(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"mysql"},"mysql"),(0,a.kt)("h2",{id:"module-mysql"},"Module MySQL"),(0,a.kt)("p",null,"MySQL describes the attributes to locally deploy or create a cloud provider managed mysql database instance for the workload. "),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"cloud"),(0,a.kt)("br",null),"Cloud specifies the type of the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},'"aws" ',"|",' "alicloud"'),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"username"),(0,a.kt)("br",null),"Username specifies the operation account for the mysql database."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},'"root"'),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"category"),(0,a.kt)("br",null),"Category specifies the edition of the mysql instance provided by the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},'"Basic"'),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"securityIPs"),(0,a.kt)("br",null),"SecurityIPs specifies the list of IP addresses allowed to access the mysql instance provided by the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},"[str]"),(0,a.kt)("td",{parentName:"tr",align:null},'["0.0.0.0/0"]'),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"privateRouting"),(0,a.kt)("br",null),"PrivateRouting specifies whether the host address of the cloud mysql instance for the workload to connect with is via public network or private network of the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},"bool"),(0,a.kt)("td",{parentName:"tr",align:null},"true"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"size"),(0,a.kt)("br",null),"Size specifies the allocated storage size of the mysql instance."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"10"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"subnetID"),(0,a.kt)("br",null),"SubnetID specifies the virtual subnet ID associated with the VPC that the cloud mysql instance will be created in."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"suffix"),(0,a.kt)("br",null),"Suffix specifies the suffix of the database name."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n aws: \n version: 5.0.1\n source: hashicorp/aws\n region: us-east-1\n\n# MySQL workspace configs for AWS RDS\nmodules: \n mysql: \n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n privateRouting: false\n suffix: "-mysql"\n')),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n alicloud: \n version: 1.209.1\n source: aliyun/alicloud\n region: cn-beijing\n\n# MySQL workspace configs for Alicloud RDS\nmodules: \n mysql: \n default: \n cloud: alicloud\n size: 20\n instanceType: mysql.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n suffix: "-mysql"\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9333a297.255e30a6.js b/assets/js/9333a297.30a3ec3c.js similarity index 57% rename from assets/js/9333a297.255e30a6.js rename to assets/js/9333a297.30a3ec3c.js index 456edf7a617..0368362c6ef 100644 --- a/assets/js/9333a297.255e30a6.js +++ b/assets/js/9333a297.30a3ec3c.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[798],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>d});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),i=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},c=function(e){var t=i(e.components);return n.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),m=i(r),d=a,f=m["".concat(p,".").concat(d)]||m[d]||u[d]||o;return r?n.createElement(f,l(l({ref:t},c),{},{components:r})):n.createElement(f,l({ref:t},c))}));function d(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=m;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:a,l[1]=s;for(var i=2;i{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>i});var n=r(87462),a=(r(67294),r(3905));const o={},l="opsrule",s={unversionedId:"reference/modules/developer-schemas/opsrule/opsrule",id:"version-v0.11/reference/modules/developer-schemas/opsrule/opsrule",title:"opsrule",description:"Schema OpsRule",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/opsrule/opsrule.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/opsrule",slug:"/reference/modules/developer-schemas/opsrule/",permalink:"/docs/reference/modules/developer-schemas/opsrule/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/opsrule/opsrule.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"network",permalink:"/docs/reference/modules/developer-schemas/network/"},next:{title:"job",permalink:"/docs/reference/modules/developer-schemas/workload/job"}},p={},i=[{value:"Schema OpsRule",id:"schema-opsrule",level:2},{value:"Attributes",id:"attributes",level:3}],c={toc:i};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"opsrule"},"opsrule"),(0,a.kt)("h2",{id:"schema-opsrule"},"Schema OpsRule"),(0,a.kt)("p",null,"OpsRule describes operation rules for various Day-2 Operations. Once declared, these",(0,a.kt)("br",null),"operation rules will be checked before any Day-2 operations."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"maxUnavailable")),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"The maximum percentage of the total pod instances in the component that can be",(0,a.kt)("br",null),"simultaneously unhealthy.")))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import opsrule as o\nimport kam.v1.app_configuration\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\n\nhelloworld : ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "nginx": c.Container {\n image: "nginx:v1"\n }\n }\n }\n accessories: {\n "opsrule" : o.OpsRule {\n maxUnavailable: "30%"\n }\n }\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[798],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>d});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),i=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},c=function(e){var t=i(e.components);return n.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),m=i(r),d=a,f=m["".concat(p,".").concat(d)]||m[d]||u[d]||o;return r?n.createElement(f,l(l({ref:t},c),{},{components:r})):n.createElement(f,l({ref:t},c))}));function d(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=m;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:a,l[1]=s;for(var i=2;i{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>i});var n=r(87462),a=(r(67294),r(3905));const o={},l="opsrule",s={unversionedId:"reference/modules/developer-schemas/opsrule/opsrule",id:"version-v0.11/reference/modules/developer-schemas/opsrule/opsrule",title:"opsrule",description:"Schema OpsRule",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/opsrule/opsrule.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/opsrule",slug:"/reference/modules/developer-schemas/opsrule/",permalink:"/docs/reference/modules/developer-schemas/opsrule/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/opsrule/opsrule.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"network",permalink:"/docs/reference/modules/developer-schemas/network/"},next:{title:"job",permalink:"/docs/reference/modules/developer-schemas/workload/job"}},p={},i=[{value:"Schema OpsRule",id:"schema-opsrule",level:2},{value:"Attributes",id:"attributes",level:3}],c={toc:i};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"opsrule"},"opsrule"),(0,a.kt)("h2",{id:"schema-opsrule"},"Schema OpsRule"),(0,a.kt)("p",null,"OpsRule describes operation rules for various Day-2 Operations. Once declared, these",(0,a.kt)("br",null),"operation rules will be checked before any Day-2 operations."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"maxUnavailable")),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"The maximum percentage of the total pod instances in the component that can be",(0,a.kt)("br",null),"simultaneously unhealthy.")))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import opsrule as o\nimport kam.v1.app_configuration\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\n\nhelloworld : ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "nginx": c.Container {\n image: "nginx:v1"\n }\n }\n }\n accessories: {\n "opsrule" : o.OpsRule {\n maxUnavailable: "30%"\n }\n }\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9437cc2c.c3c3a0d2.js b/assets/js/9437cc2c.c3c3a0d2.js new file mode 100644 index 00000000000..7eaaf5bbea6 --- /dev/null +++ b/assets/js/9437cc2c.c3c3a0d2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6472],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var i=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=i.createContext({}),p=function(e){var t=i.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},c=function(e){var t=p(e.components);return i.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},d=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(n),m=a,k=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return n?i.createElement(k,r(r({ref:t},c),{},{components:n})):i.createElement(k,r({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,r=new Array(o);r[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,r[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>r,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var i=n(87462),a=(n(67294),n(3905));const o={id:"overview"},r="Configuration File Overview",l={unversionedId:"configuration-walkthrough/overview",id:"version-v0.11/configuration-walkthrough/overview",title:"Configuration File Overview",description:"Kusion consumes one or more declarative configuration files (written in KCL) that describe the application, and delivers intent to the target runtime including Kubernetes, clouds, or on-prem infrastructure.",source:"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/1-overview.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/overview",permalink:"/docs/configuration-walkthrough/overview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/1-overview.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"overview"},sidebar:"kusion",previous:{title:"How Kusion Works?",permalink:"/docs/concepts/how-kusion-works"},next:{title:"KCL Basics",permalink:"/docs/configuration-walkthrough/kcl-basics"}},s={},p=[{value:"Table of Content",id:"table-of-content",level:2},{value:"Directory Structure",id:"directory-structure",level:2},{value:"AppConfiguration Model",id:"appconfiguration-model",level:2},{value:"Authoring Configuration Files",id:"authoring-configuration-files",level:2},{value:"Identifying KCL file",id:"identifying-kcl-file",level:3},{value:"KCL Schemas and KAM",id:"kcl-schemas-and-kam",level:3},{value:"Kusion Modules",id:"kusion-modules",level:3},{value:"Import Statements",id:"import-statements",level:3},{value:"Understanding kcl.mod",id:"understanding-kclmod",level:3},{value:"Building Blocks",id:"building-blocks",level:3},{value:"Instantiating an application",id:"instantiating-an-application",level:3},{value:"Using kusion init",id:"using-kusion-init",level:3},{value:"Using references",id:"using-references",level:3}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,i.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"configuration-file-overview"},"Configuration File Overview"),(0,a.kt)("p",null,"Kusion consumes one or more declarative configuration files (written in KCL) that describe the application, and delivers intent to the target runtime including Kubernetes, clouds, or on-prem infrastructure."),(0,a.kt)("p",null,"This documentation series walks you through the odds and ends of managing such configuration files."),(0,a.kt)("h2",{id:"table-of-content"},"Table of Content"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#configuration-file-overview"},"Configuration File Overview"),(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#table-of-content"},"Table of Content")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#directory-structure"},"Directory Structure")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#appconfiguration-model"},"AppConfiguration Model")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#authoring-configuration-files"},"Authoring Configuration Files"),(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#identifying-kcl-file"},"Identifying KCL file")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#kcl-schemas-and-kam"},"KCL Schemas and KAM")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#kusion-modules"},"Kusion Modules")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#import-statements"},"Import Statements")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#understanding-kclmod"},"Understanding kcl.mod")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#building-blocks"},"Building Blocks")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#instantiating-an-application"},"Instantiating an application")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#using-kusion-init"},"Using ",(0,a.kt)("inlineCode",{parentName:"a"},"kusion init"))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#using-references"},"Using references"))))))),(0,a.kt)("h2",{id:"directory-structure"},"Directory Structure"),(0,a.kt)("p",null,"Kusion expects the configuration file to be placed in a certain directory structure because it might need some metadata (that is not stored in the application configuration itself) in order to proceed."),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"See ",(0,a.kt)("a",{parentName:"p",href:"../concepts/project/overview"},"Project")," and ",(0,a.kt)("a",{parentName:"p",href:"../concepts/stack/overview"},"Stack")," for more details about Project and Stack.")),(0,a.kt)("p",null,"A sample multi-stack directory structure looks like the following:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"~/playground$ tree multi-stack-project/\nmulti-stack-project/\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 base\n\u2502\xa0\xa0 \u2514\u2500\u2500 base.k\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u251c\u2500\u2500 prod\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n")),(0,a.kt)("p",null,"In general, the directory structure follows a hierarchy where the top-level is the project configurations, and the sub-directories represent stack-level configurations."),(0,a.kt)("p",null,"You may notice there is a ",(0,a.kt)("inlineCode",{parentName:"p"},"base")," directory besides all the stacks. The ",(0,a.kt)("inlineCode",{parentName:"p"},"base")," directory is not mandatory, but rather a place to store common configurations between different stacks. A common pattern we observed is to use stacks to represent different stages (dev, stage, prod, etc.) in the software development lifecycle, and/or different deployment targets (azure-eastus, aws-us-east-1, etc). A project can have as many stacks as needed."),(0,a.kt)("p",null,"In practice, the applications deployed into dev and prod might very likely end up with a similar set of configurations except a few fields such as the application image (dev might be on newer versions), resource requirements (prod might require more resources), etc."),(0,a.kt)("p",null,"As a general best practice, we recommend managing the common configurations in ",(0,a.kt)("inlineCode",{parentName:"p"},"base.k")," as much as possible to minimize duplicate code. We will cover how override works in ",(0,a.kt)("a",{parentName:"p",href:"base-override"},"Base and Override"),"."),(0,a.kt)("h2",{id:"appconfiguration-model"},"AppConfiguration Model"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," is the out-of-the-box model we build that describes an application. It serves as the declarative intent for a given application."),(0,a.kt)("p",null,"The schema for ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," is defined in the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kam/blob/main/v1/app_configuration.k"},"KusionStack/kam")," repository. It is designed as a unified, application-centric model that encapsulates the comprehensive configuration details and in the meantime, hides the complexity of the infrastructure as much as possible."),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," consists of multiple sub-components that each represent either the application workload itself, its dependencies (in the form of ",(0,a.kt)("a",{parentName:"p",href:"../concepts/kusion-module/overview"},"Kusion Modules"),"), relevant workflows or operational expectations. We will deep dive into the details on how to author each of these elements in this upcoming documentation series."),(0,a.kt)("p",null,"For more details on the ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),", please refer to the ",(0,a.kt)("a",{parentName:"p",href:"../concepts/app-configuration"},"design documentation"),"."),(0,a.kt)("h2",{id:"authoring-configuration-files"},"Authoring Configuration Files"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://kcl-lang.io/"},"KCL")," is the choice of configuration language consumed by Kusion. KCL is an open-source constraint-based record and functional language. KCL works well with a large number of complex configurations via modern programming language technology and practice, and is committed to provide better modularity, scalability, stability and extensibility."),(0,a.kt)("h3",{id:"identifying-kcl-file"},"Identifying KCL file"),(0,a.kt)("p",null,"KCL files are identified with ",(0,a.kt)("inlineCode",{parentName:"p"},".k")," suffix in the filename."),(0,a.kt)("h3",{id:"kcl-schemas-and-kam"},"KCL Schemas and KAM"),(0,a.kt)("p",null,"Similar to most modern General Programming Languages (GPLs), KCL provide packages that are used to organize collections of related KCL source files into modular and re-usable units."),(0,a.kt)("p",null,"In the context of Kusion, we abstracted a core set of KCL Schemas (such as the aforementioned ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"Workload"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"Container"),", etc)that represent the concepts that we believe that are relatively universal and developer-friendly, also known as ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kam"},"Kusion Application Model"),", or KAM."),(0,a.kt)("h3",{id:"kusion-modules"},"Kusion Modules"),(0,a.kt)("p",null,"To extend the capabilities beyond the core KAM model, we use a concept known as ",(0,a.kt)("a",{parentName:"p",href:"../concepts/kusion-module/overview"},"Kusion Modules")," to define components that could best abstract the capabilities during an application delivery. We provide a collection of official out-of-the-box Kusion Modules that represents the most common capabilities. They are maintained in ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/orgs/KusionStack/packages"},"KusionStack's GitHub container registry"),". When authoring an application configuration file, you can simply declare said Kusion Modules as dependencies and import them to declare ship-time capabilities that the application requires."),(0,a.kt)("p",null,"If the modules in the KusionStack container registry does not meet the needs of your applications, Kusion provides the necessary mechanisms to extend with custom-built Kusion Modules. You can always create and publish your own module, then import the new module in your application configuration written in KCL."),(0,a.kt)("p",null,"For the steps to develop your own module, please refer to the Module developer guide."),(0,a.kt)("h3",{id:"import-statements"},"Import Statements"),(0,a.kt)("p",null,"An example of the import looks like the following:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"### import from the official kam package\nimport kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\n\n### import kusion modules\nimport monitoring as m\nimport network.network as n\n")),(0,a.kt)("p",null,"Take ",(0,a.kt)("inlineCode",{parentName:"p"},"import kam.v1.workload as wl")," as an example, the ",(0,a.kt)("inlineCode",{parentName:"p"},".v1.workload")," part after ",(0,a.kt)("inlineCode",{parentName:"p"},"import kam")," represents the relative path of a specific schema to import. In this case, the ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," schema is defined under ",(0,a.kt)("inlineCode",{parentName:"p"},"v1/workload")," directory in the ",(0,a.kt)("inlineCode",{parentName:"p"},"kam")," package."),(0,a.kt)("h3",{id:"understanding-kclmod"},"Understanding kcl.mod"),(0,a.kt)("p",null,"Much similar to the concept of ",(0,a.kt)("inlineCode",{parentName:"p"},"go.mod"),", Kusion uses ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," as the source of truth to manage metadata (such as package name, dependencies, etc.) for the current package. Kusion will also auto-generate a ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod.lock")," as the dependency lock file."),(0,a.kt)("p",null,"The most common usage for ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," is to manage the dependency of your application configuration file. "),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"Please note this ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," will be automatically generated if you are using ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init")," to initialize a project with a template. You will only need to modify this file if you are modifying the project metadata outside the initialization process, such as upgrading the dependency version or adding a new dependency altogether, etc.")),(0,a.kt)("p",null,"There are 3 sections in a ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"package"),", representing the metadata for the current package."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dependencies"),", describing the packages the current package depends on. Supports referencing either a git repository or an OCI artifact."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"profile"),", defining the behavior for Kusion. In the example below, it describes the list of files Kusion should look for when parsing the application configuration.")),(0,a.kt)("p",null,"An example of ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'[package]\nname = "multi-stack-project"\nedition = "0.5.0"\nversion = "0.1.0"\n\n[dependencies]\nmonitoring = { oci = "oci://ghcr.io/kusionstack/monitoring", tag = "0.1.0" }\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\n# Uncomment the line below to use your own modified module\n# my-module = { oci = "oci://ghcr.io/my-repository/my-package", tag = "my-version" }\n\n[profile]\nentries = ["../base/base.k", "main.k"]\n')),(0,a.kt)("h3",{id:"building-blocks"},"Building Blocks"),(0,a.kt)("p",null,"Configuration files consist of building blocks that are made of instances of schemas. An ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance consists of several child schemas, most of which are optional. The only mandatory one is the ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," instance. We will take a closer look in the ",(0,a.kt)("a",{parentName:"p",href:"workload"},"workload walkthrough"),". The order of the building blocks does NOT matter."),(0,a.kt)("p",null,"The major building blocks as of version ",(0,a.kt)("inlineCode",{parentName:"p"},"0.11.0"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {}\n ...\n }\n secrets: {}\n ...\n }\n # optional dependencies, usually expressed in kusion modules\n accessories: {\n ...\n }\n ...\n}\n')),(0,a.kt)("p",null,"We will deep dive into each one of the building blocks in this documentation series."),(0,a.kt)("h3",{id:"instantiating-an-application"},"Instantiating an application"),(0,a.kt)("p",null,"In Kusion's out-of-the-box experience, an application is identified with an instance of ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),". You may have more than one application in the same project or stack."),(0,a.kt)("p",null,"Here's an example of a configuration that can be consumed by Kusion (assuming it is placed inside the proper directory structure that includes project and stack configurations, with a ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," present):"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network.network as n\n\ngocity: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "gocity": c.Container {\n image = "howieyuen/gocity:latest"\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n public: True\n }\n ]\n }\n }\n}\n')),(0,a.kt)("p",null,"Don't worry about what ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"n.Network")," stand for at the moment. We will deep dive into each one of them in this upcoming documentation series."),(0,a.kt)("h3",{id:"using-kusion-init"},"Using ",(0,a.kt)("inlineCode",{parentName:"h3"},"kusion init")),(0,a.kt)("p",null,"Kusion offers a ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init")," sub-command which initializes a new project using some pre-built templates, which saves you from the hassle of manually building the aforementioned directory structure that Kusion expects."),(0,a.kt)("p",null,"There is a built-in template ",(0,a.kt)("inlineCode",{parentName:"p"},"single-stack-sample")," in the Kusion binary that can be used offline. "),(0,a.kt)("p",null,"We also maintain a ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion-templates"},"kusion-templates repository")," that hosts a list of more comprehensive project scaffolds. You can access them via ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init --online")," command which requires connectivity to ",(0,a.kt)("inlineCode",{parentName:"p"},"github.com"),"."),(0,a.kt)("p",null,"The pre-built templates are meant to help you get off the ground quickly with some simple out-of-the-box examples. You can refer to the ",(0,a.kt)("a",{parentName:"p",href:"../getting-started/deliver-quickstart"},"QuickStart documentation")," for some step-by-step tutorials."),(0,a.kt)("h3",{id:"using-references"},"Using references"),(0,a.kt)("p",null,"The reference documentation for the ",(0,a.kt)("inlineCode",{parentName:"p"},"kam")," package and the official Kusion Modules is located in ",(0,a.kt)("a",{parentName:"p",href:"../reference/modules/developer-schemas/app-configuration"},"Reference"),"."),(0,a.kt)("p",null,"If you are using them out of the box, the reference documentation provides a comprehensive view for each schema involved, including all the attribute names and description, their types, default value if any, and whether a particular attribute is required or not. There will also be an example attached to each schema reference."),(0,a.kt)("p",null,"We will also deep dive into some common examples in the upcoming sections."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9437cc2c.ca1a1f53.js b/assets/js/9437cc2c.ca1a1f53.js deleted file mode 100644 index cd791c39bf4..00000000000 --- a/assets/js/9437cc2c.ca1a1f53.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6472],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var i=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=i.createContext({}),p=function(e){var t=i.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},c=function(e){var t=p(e.components);return i.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},d=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(n),m=a,k=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return n?i.createElement(k,r(r({ref:t},c),{},{components:n})):i.createElement(k,r({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,r=new Array(o);r[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,r[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>r,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var i=n(87462),a=(n(67294),n(3905));const o={id:"overview"},r="Configuration File Overview",l={unversionedId:"configuration-walkthrough/overview",id:"version-v0.11/configuration-walkthrough/overview",title:"Configuration File Overview",description:"Kusion consumes one or more declarative configuration files (written in KCL) that describe the application, and delivers intent to the target runtime including Kubernetes, clouds, or on-prem infrastructure.",source:"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/1-overview.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/overview",permalink:"/docs/configuration-walkthrough/overview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/1-overview.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"overview"},sidebar:"kusion",previous:{title:"How Kusion Works?",permalink:"/docs/concepts/how-kusion-works"},next:{title:"KCL Basics",permalink:"/docs/configuration-walkthrough/kcl-basics"}},s={},p=[{value:"Table of Content",id:"table-of-content",level:2},{value:"Directory Structure",id:"directory-structure",level:2},{value:"AppConfiguration Model",id:"appconfiguration-model",level:2},{value:"Authoring Configuration Files",id:"authoring-configuration-files",level:2},{value:"Identifying KCL file",id:"identifying-kcl-file",level:3},{value:"KCL Schemas and KAM",id:"kcl-schemas-and-kam",level:3},{value:"Kusion Modules",id:"kusion-modules",level:3},{value:"Import Statements",id:"import-statements",level:3},{value:"Understanding kcl.mod",id:"understanding-kclmod",level:3},{value:"Building Blocks",id:"building-blocks",level:3},{value:"Instantiating an application",id:"instantiating-an-application",level:3},{value:"Using kusion init",id:"using-kusion-init",level:3},{value:"Using references",id:"using-references",level:3}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,i.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"configuration-file-overview"},"Configuration File Overview"),(0,a.kt)("p",null,"Kusion consumes one or more declarative configuration files (written in KCL) that describe the application, and delivers intent to the target runtime including Kubernetes, clouds, or on-prem infrastructure."),(0,a.kt)("p",null,"This documentation series walks you through the odds and ends of managing such configuration files."),(0,a.kt)("h2",{id:"table-of-content"},"Table of Content"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#configuration-file-overview"},"Configuration File Overview"),(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#table-of-content"},"Table of Content")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#directory-structure"},"Directory Structure")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#appconfiguration-model"},"AppConfiguration Model")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#authoring-configuration-files"},"Authoring Configuration Files"),(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#identifying-kcl-file"},"Identifying KCL file")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#kcl-schemas-and-kam"},"KCL Schemas and KAM")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#kusion-modules"},"Kusion Modules")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#import-statements"},"Import Statements")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#understanding-kclmod"},"Understanding kcl.mod")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#building-blocks"},"Building Blocks")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#instantiating-an-application"},"Instantiating an application")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#using-kusion-init"},"Using ",(0,a.kt)("inlineCode",{parentName:"a"},"kusion init"))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#using-references"},"Using references"))))))),(0,a.kt)("h2",{id:"directory-structure"},"Directory Structure"),(0,a.kt)("p",null,"Kusion expects the configuration file to be placed in a certain directory structure because it might need some metadata (that is not stored in the application configuration itself) in order to proceed."),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"See ",(0,a.kt)("a",{parentName:"p",href:"../concepts/project/overview"},"Project")," and ",(0,a.kt)("a",{parentName:"p",href:"../concepts/stack/overview"},"Stack")," for more details about Project and Stack.")),(0,a.kt)("p",null,"A sample multi-stack directory structure looks like the following:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"~/playground$ tree multi-stack-project/\nmulti-stack-project/\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 base\n\u2502\xa0\xa0 \u2514\u2500\u2500 base.k\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u251c\u2500\u2500 prod\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n")),(0,a.kt)("p",null,"In general, the directory structure follows a hierarchy where the top-level is the project configurations, and the sub-directories represent stack-level configurations."),(0,a.kt)("p",null,"You may notice there is a ",(0,a.kt)("inlineCode",{parentName:"p"},"base")," directory besides all the stacks. The ",(0,a.kt)("inlineCode",{parentName:"p"},"base")," directory is not mandatory, but rather a place to store common configurations between different stacks. A common pattern we observed is to use stacks to represent different stages (dev, stage, prod, etc.) in the software development lifecycle, and/or different deployment targets (azure-eastus, aws-us-east-1, etc). A project can have as many stacks as needed."),(0,a.kt)("p",null,"In practice, the applications deployed into dev and prod might very likely end up with a similar set of configurations except a few fields such as the application image (dev might be on newer versions), resource requirements (prod might require more resources), etc."),(0,a.kt)("p",null,"As a general best practice, we recommend managing the common configurations in ",(0,a.kt)("inlineCode",{parentName:"p"},"base.k")," as much as possible to minimize duplicate code. We will cover how override works in ",(0,a.kt)("a",{parentName:"p",href:"base-override"},"Base and Override"),"."),(0,a.kt)("h2",{id:"appconfiguration-model"},"AppConfiguration Model"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," is the out-of-the-box model we build that describes an application. It serves as the declarative intent for a given application."),(0,a.kt)("p",null,"The schema for ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," is defined in the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kam/blob/main/v1/app_configuration.k"},"KusionStack/kam")," repository. It is designed as a unified, application-centric model that encapsulates the comprehensive configuration details and in the meantime, hides the complexity of the infrastructure as much as possible."),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," consists of multiple sub-components that each represent either the application workload itself, its dependencies (in the form of ",(0,a.kt)("a",{parentName:"p",href:"../concepts/kusion-module/overview"},"Kusion Modules"),"), relevant workflows or operational expectations. We will deep dive into the details on how to author each of these elements in this upcoming documentation series."),(0,a.kt)("p",null,"For more details on the ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),", please refer to the ",(0,a.kt)("a",{parentName:"p",href:"../concepts/app-configuration"},"design documentation"),"."),(0,a.kt)("h2",{id:"authoring-configuration-files"},"Authoring Configuration Files"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://kcl-lang.io/"},"KCL")," is the choice of configuration language consumed by Kusion. KCL is an open-source constraint-based record and functional language. KCL works well with a large number of complex configurations via modern programming language technology and practice, and is committed to provide better modularity, scalability, stability and extensibility."),(0,a.kt)("h3",{id:"identifying-kcl-file"},"Identifying KCL file"),(0,a.kt)("p",null,"KCL files are identified with ",(0,a.kt)("inlineCode",{parentName:"p"},".k")," suffix in the filename."),(0,a.kt)("h3",{id:"kcl-schemas-and-kam"},"KCL Schemas and KAM"),(0,a.kt)("p",null,"Similar to most modern General Programming Languages (GPLs), KCL provide packages that are used to organize collections of related KCL source files into modular and re-usable units."),(0,a.kt)("p",null,"In the context of Kusion, we abstracted a core set of KCL Schemas (such as the aforementioned ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"Workload"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"Container"),", etc)that represent the concepts that we believe that are relatively universal and developer-friendly, also known as ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kam"},"Kusion Application Model"),", or KAM."),(0,a.kt)("h3",{id:"kusion-modules"},"Kusion Modules"),(0,a.kt)("p",null,"To extend the capabilities beyond the core KAM model, we use a concept known as ",(0,a.kt)("a",{parentName:"p",href:"../concepts/kusion-module/overview"},"Kusion Modules")," to define components that could best abstract the capabilities during an application delivery. We provide a collection of official out-of-the-box Kusion Modules that represents the most common capabilities. They are maintained in ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/orgs/KusionStack/packages"},"KusionStack's GitHub container registry"),". When authoring an application configuration file, you can simply declare said Kusion Modules as dependencies and import them to declare ship-time capabilities that the application requires."),(0,a.kt)("p",null,"If the modules in the KusionStack container registry does not meet the needs of your applications, Kusion provides the necessary mechanisms to extend with custom-built Kusion Modules. You can always create and publish your own module, then import the new module in your application configuration written in KCL."),(0,a.kt)("p",null,"For the steps to develop your own module, please refer to the Module developer guide."),(0,a.kt)("h3",{id:"import-statements"},"Import Statements"),(0,a.kt)("p",null,"An example of the import looks like the following:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"### import from the official kam package\nimport kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\n\n### import kusion modules\nimport monitoring as m\nimport network.network as n\n")),(0,a.kt)("p",null,"Take ",(0,a.kt)("inlineCode",{parentName:"p"},"import kam.v1.workload as wl")," as an example, the ",(0,a.kt)("inlineCode",{parentName:"p"},".v1.workload")," part after ",(0,a.kt)("inlineCode",{parentName:"p"},"import kam")," represents the relative path of a specific schema to import. In this case, the ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," schema is defined under ",(0,a.kt)("inlineCode",{parentName:"p"},"v1/workload")," directory in the ",(0,a.kt)("inlineCode",{parentName:"p"},"kam")," package."),(0,a.kt)("h3",{id:"understanding-kclmod"},"Understanding kcl.mod"),(0,a.kt)("p",null,"Much similar to the concept of ",(0,a.kt)("inlineCode",{parentName:"p"},"go.mod"),", Kusion uses ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," as the source of truth to manage metadata (such as package name, dependencies, etc.) for the current package. Kusion will also auto-generate a ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod.lock")," as the dependency lock file."),(0,a.kt)("p",null,"The most common usage for ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," is to manage the dependency of your application configuration file. "),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"Please note this ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," will be automatically generated if you are using ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init")," to initialize a project with a template. You will only need to modify this file if you are modifying the project metadata outside the initialization process, such as upgrading the dependency version or adding a new dependency altogether, etc.")),(0,a.kt)("p",null,"There are 3 sections in a ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"package"),", representing the metadata for the current package."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dependencies"),", describing the packages the current package depends on. Supports referencing either a git repository or an OCI artifact."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"profile"),", defining the behavior for Kusion. In the example below, it describes the list of files Kusion should look for when parsing the application configuration.")),(0,a.kt)("p",null,"An example of ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'[package]\nname = "multi-stack-project"\nedition = "0.5.0"\nversion = "0.1.0"\n\n[dependencies]\nmonitoring = { oci = "oci://ghcr.io/kusionstack/monitoring", tag = "0.1.0" }\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\n# Uncomment the line below to use your own modified module\n# my-module = { oci = "oci://ghcr.io/my-repository/my-package", tag = "my-version" }\n\n[profile]\nentries = ["../base/base.k", "main.k"]\n')),(0,a.kt)("h3",{id:"building-blocks"},"Building Blocks"),(0,a.kt)("p",null,"Configuration files consist of building blocks that are made of instances of schemas. An ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance consists of several child schemas, most of which are optional. The only mandatory one is the ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," instance. We will take a closer look in the ",(0,a.kt)("a",{parentName:"p",href:"workload"},"workload walkthrough"),". The order of the building blocks does NOT matter."),(0,a.kt)("p",null,"The major building blocks as of version ",(0,a.kt)("inlineCode",{parentName:"p"},"0.11.0"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {}\n ...\n }\n secrets: {}\n ...\n }\n # optional dependencies, usually expressed in kusion modules\n accessories: {\n ...\n }\n ...\n}\n')),(0,a.kt)("p",null,"We will deep dive into each one of the building blocks in this documentation series."),(0,a.kt)("h3",{id:"instantiating-an-application"},"Instantiating an application"),(0,a.kt)("p",null,"In Kusion's out-of-the-box experience, an application is identified with an instance of ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),". You may have more than one application in the same project or stack."),(0,a.kt)("p",null,"Here's an example of a configuration that can be consumed by Kusion (assuming it is placed inside the proper directory structure that includes project and stack configurations, with a ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," present):"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network.network as n\n\ngocity: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "gocity": c.Container {\n image = "howieyuen/gocity:latest"\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n public: True\n }\n ]\n }\n }\n}\n')),(0,a.kt)("p",null,"Don't worry about what ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"n.Network")," stand for at the moment. We will deep dive into each one of them in this upcoming documentation series."),(0,a.kt)("h3",{id:"using-kusion-init"},"Using ",(0,a.kt)("inlineCode",{parentName:"h3"},"kusion init")),(0,a.kt)("p",null,"Kusion offers a ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init")," sub-command which initializes a new project using some pre-built templates, which saves you from the hassle of manually building the aforementioned directory structure that Kusion expects."),(0,a.kt)("p",null,"There is a built-in template ",(0,a.kt)("inlineCode",{parentName:"p"},"single-stack-sample")," in the Kusion binary that can be used offline. "),(0,a.kt)("p",null,"We also maintain a ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion-templates"},"kusion-templates repository")," that hosts a list of more comprehensive project scaffolds. You can access them via ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init --online")," command which requires connectivity to ",(0,a.kt)("inlineCode",{parentName:"p"},"github.com"),"."),(0,a.kt)("p",null,"The pre-built templates are meant to help you get off the ground quickly with some simple out-of-the-box examples. You can refer to the ",(0,a.kt)("a",{parentName:"p",href:"../getting-started/deliver-quickstart"},"QuickStart documentation")," for some step-by-step tutorials."),(0,a.kt)("h3",{id:"using-references"},"Using references"),(0,a.kt)("p",null,"The reference documentation for the ",(0,a.kt)("inlineCode",{parentName:"p"},"kam")," package and the official Kusion Modules is located in ",(0,a.kt)("a",{parentName:"p",href:"../reference/modules/developer-schemas/app-configuration"},"Reference"),"."),(0,a.kt)("p",null,"If you are using them out of the box, the reference documentation provides a comprehensive view for each schema involved, including all the attribute names and description, their types, default value if any, and whether a particular attribute is required or not. There will also be an example attached to each schema reference."),(0,a.kt)("p",null,"We will also deep dive into some common examples in the upcoming sections."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/974b9b1f.3ab3fae7.js b/assets/js/974b9b1f.0b4a5b97.js similarity index 54% rename from assets/js/974b9b1f.3ab3fae7.js rename to assets/js/974b9b1f.0b4a5b97.js index cb4bd8a31d6..c42c6f03d3e 100644 --- a/assets/js/974b9b1f.3ab3fae7.js +++ b/assets/js/974b9b1f.0b4a5b97.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4101],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),d=p(r),m=o,k=d["".concat(i,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(k,s(s({ref:t},l),{},{components:r})):n.createElement(k,s({ref:t},l))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=d;var c={};for(var i in t)hasOwnProperty.call(t,i)&&(c[i]=t[i]);c.originalType=e,c.mdxType="string"==typeof e?e:o,s[1]=c;for(var p=2;p{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion workspace switch",c={unversionedId:"reference/commands/kusion-workspace-switch",id:"reference/commands/kusion-workspace-switch",title:"kusion workspace switch",description:"Switch the current workspace",source:"@site/docs/kusion/6-reference/1-commands/kusion-workspace-switch.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-switch",permalink:"/docs/next/reference/commands/kusion-workspace-switch",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-workspace-switch.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace show",permalink:"/docs/next/reference/commands/kusion-workspace-show"},next:{title:"kusion workspace update",permalink:"/docs/next/reference/commands/kusion-workspace-update"}},i={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-switch"},"kusion workspace switch"),(0,o.kt)("p",null,"Switch the current workspace"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command switches the workspace, where the workspace must be created."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace switch\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Switch the current workspace\n kusion workspace switch dev\n \n # Switch the current workspace in a specified backend\n kusion workspace switch prod --backend oss-prod\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string the backend name\n -h, --help help for switch\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4101],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),d=p(r),m=o,k=d["".concat(i,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(k,s(s({ref:t},l),{},{components:r})):n.createElement(k,s({ref:t},l))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=d;var c={};for(var i in t)hasOwnProperty.call(t,i)&&(c[i]=t[i]);c.originalType=e,c.mdxType="string"==typeof e?e:o,s[1]=c;for(var p=2;p{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion workspace switch",c={unversionedId:"reference/commands/kusion-workspace-switch",id:"reference/commands/kusion-workspace-switch",title:"kusion workspace switch",description:"Switch the current workspace",source:"@site/docs/kusion/6-reference/1-commands/kusion-workspace-switch.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-switch",permalink:"/docs/next/reference/commands/kusion-workspace-switch",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-workspace-switch.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace show",permalink:"/docs/next/reference/commands/kusion-workspace-show"},next:{title:"kusion workspace update",permalink:"/docs/next/reference/commands/kusion-workspace-update"}},i={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-switch"},"kusion workspace switch"),(0,o.kt)("p",null,"Switch the current workspace"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command switches the workspace, where the workspace must be created."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace switch\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Switch the current workspace\n kusion workspace switch dev\n \n # Switch the current workspace in a specified backend\n kusion workspace switch prod --backend oss-prod\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string the backend name\n -h, --help help for switch\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/977fdfc4.020c4ba0.js b/assets/js/977fdfc4.020c4ba0.js new file mode 100644 index 00000000000..28e2a1c6944 --- /dev/null +++ b/assets/js/977fdfc4.020c4ba0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[135],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),u=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},c=function(e){var t=u(e.components);return n.createElement(l.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=u(a),m=r,h=d["".concat(l,".").concat(m)]||d[m]||p[m]||o;return a?n.createElement(h,i(i({ref:t},c),{},{components:a})):n.createElement(h,i({ref:t},c))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,i=new Array(o);i[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var u=2;u{a.d(t,{Z:()=>i});var n=a(67294),r=a(86010);const o="tabItem_Ymn6";function i(e){let{children:t,hidden:a,className:i}=e;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(o,i),hidden:a},t)}},74866:(e,t,a)=>{a.d(t,{Z:()=>S});var n=a(87462),r=a(67294),o=a(86010),i=a(12466),s=a(76775),l=a(91980),u=a(67392),c=a(50012);function p(e){return function(e){var t;return(null==(t=r.Children.map(e,(e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})))?void 0:t.filter(Boolean))??[]}(e).map((e=>{let{props:{value:t,label:a,attributes:n,default:r}}=e;return{value:t,label:a,attributes:n,default:r}}))}function d(e){const{values:t,children:a}=e;return(0,r.useMemo)((()=>{const e=t??p(a);return function(e){const t=(0,u.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,a])}function m(e){let{value:t,tabValues:a}=e;return a.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:a}=e;const n=(0,s.k6)(),o=function(e){let{queryString:t=!1,groupId:a}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!a)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return a??null}({queryString:t,groupId:a});return[(0,l._X)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(n.location.search);t.set(o,e),n.replace({...n.location,search:t.toString()})}),[o,n])]}function f(e){const{defaultValue:t,queryString:a=!1,groupId:n}=e,o=d(e),[i,s]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:a}=e;if(0===a.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:a}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${a.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const n=a.find((e=>e.default))??a[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:o}))),[l,u]=h({queryString:a,groupId:n}),[p,f]=function(e){let{groupId:t}=e;const a=function(e){return e?`docusaurus.tab.${e}`:null}(t),[n,o]=(0,c.Nk)(a);return[n,(0,r.useCallback)((e=>{a&&o.set(e)}),[a,o])]}({groupId:n}),k=(()=>{const e=l??p;return m({value:e,tabValues:o})?e:null})();(0,r.useLayoutEffect)((()=>{k&&s(k)}),[k]);return{selectedValue:i,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);s(e),u(e),f(e)}),[u,f,o]),tabValues:o}}var k=a(72389);const g="tabList__CuJ",b="tabItem_LNqP";function y(e){let{className:t,block:a,selectedValue:s,selectValue:l,tabValues:u}=e;const c=[],{blockElementScrollPositionUntilNextRender:p}=(0,i.o5)(),d=e=>{const t=e.currentTarget,a=c.indexOf(t),n=u[a].value;n!==s&&(p(t),l(n))},m=e=>{var t;let a=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=c.indexOf(e.currentTarget)+1;a=c[t]??c[0];break}case"ArrowLeft":{const t=c.indexOf(e.currentTarget)-1;a=c[t]??c[c.length-1];break}}null==(t=a)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":a},t)},u.map((e=>{let{value:t,label:a,attributes:i}=e;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,key:t,ref:e=>c.push(e),onKeyDown:m,onClick:d},i,{className:(0,o.Z)("tabs__item",b,null==i?void 0:i.className,{"tabs__item--active":s===t})}),a??t)})))}function v(e){let{lazy:t,children:a,selectedValue:n}=e;const o=(Array.isArray(a)?a:[a]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===n));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==n}))))}function w(e){const t=f(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",g)},r.createElement(y,(0,n.Z)({},e,t)),r.createElement(v,(0,n.Z)({},e,t)))}function S(e){const t=(0,k.Z)();return r.createElement(w,(0,n.Z)({key:String(t)},e))}},81087:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>s,metadata:()=>u,toc:()=>p});var n=a(87462),r=(a(67294),a(3905)),o=a(74866),i=a(85162);const s={id:"databse"},l="Managed Databases",u={unversionedId:"configuration-walkthrough/databse",id:"configuration-walkthrough/databse",title:"Managed Databases",description:"You could also specify a database needed for the application. That can be achieved via a mysql or a postgres module (or bring-your-own-module) in the accessories field in AppConfiguration to achieve that.",source:"@site/docs/kusion/4-configuration-walkthrough/6-database.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/databse",permalink:"/docs/next/configuration-walkthrough/databse",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/4-configuration-walkthrough/6-database.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:6,frontMatter:{id:"databse"},sidebar:"kusion",previous:{title:"Application Networking",permalink:"/docs/next/configuration-walkthrough/networking"},next:{title:"Secrets",permalink:"/docs/next/configuration-walkthrough/secret"}},c={},p=[{value:"Import",id:"import",level:2},{value:"Types of Database offerings",id:"types-of-database-offerings",level:2},{value:"Cloud Credentials and Permissions",id:"cloud-credentials-and-permissions",level:2},{value:"Configure Database",id:"configure-database",level:2},{value:"Provision a Cloud Database",id:"provision-a-cloud-database",level:3},{value:"AWS RDS Instance",id:"aws-rds-instance",level:4},{value:"AliCloud RDS Instance",id:"alicloud-rds-instance",level:4},{value:"Local Database",id:"local-database",level:3},{value:"Database Credentials",id:"database-credentials",level:2},{value:"Configure Network Access",id:"configure-network-access",level:2},{value:"Subnet ID",id:"subnet-id",level:3},{value:"Private Routing",id:"private-routing",level:3}],d={toc:p};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"managed-databases"},"Managed Databases"),(0,r.kt)("p",null,"You could also specify a database needed for the application. That can be achieved via a ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql")," or a ",(0,r.kt)("inlineCode",{parentName:"p"},"postgres")," module (or bring-your-own-module) in the ",(0,r.kt)("inlineCode",{parentName:"p"},"accessories")," field in ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," to achieve that."),(0,r.kt)("p",null,"You can currently have several databases with ",(0,r.kt)("strong",{parentName:"p"},"different database names")," for an application at the same time."),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"kam")," package and the ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql")," Kusion Module. For more details on KCL package and module import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/configuration-walkthrough/overview#configuration-file-overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport mysql.mysql\nimport postgres.postgres\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"kcl.mod")," must contain reference to the ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql")," module or ",(0,r.kt)("inlineCode",{parentName:"p"},"postgres")," module:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'#...\n\n[dependencies]\nmysql = { oci = "oci://ghcr.io/kusionstack/mysql", tag = "0.1.0" }\npostgres = { oci = "oci://ghcr.io/kusionstack/postgres", tag = "0.1.0" }\n#...\n')),(0,r.kt)("h2",{id:"types-of-database-offerings"},"Types of Database offerings"),(0,r.kt)("p",null,"As of version 0.11.0, Kusion supports the following database offerings on the cloud:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"MySQL and PostgreSQL Relational Database Service (RDS) on ",(0,r.kt)("a",{parentName:"li",href:"https://aws.amazon.com/rds/"},"AWS")),(0,r.kt)("li",{parentName:"ul"},"MySQL and PostgreSQL Relational Database Service (RDS) on ",(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/product/databases"},"AliCloud"))),(0,r.kt)("p",null,"More database types on more cloud vendors will be added in the future."),(0,r.kt)("p",null,"Alternatively, Kusion also supports creating a database at ",(0,r.kt)("inlineCode",{parentName:"p"},"localhost")," for local testing needs. A local database is quicker to stand up and easier to manage. It also eliminates the need for an account and any relevant costs with the cloud providers in the case that a local testing environment is sufficient."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"You do need a local Kubernetes cluster to run the local database workloads. You can refer to ",(0,r.kt)("a",{parentName:"p",href:"https://minikube.sigs.k8s.io/docs/start/"},"Minikube")," or ",(0,r.kt)("a",{parentName:"p",href:"https://kind.sigs.k8s.io/docs/user/quick-start/"},"Kind")," to get started.\nTo see an end-to-end use case for standing up a local testing environment including a local database, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/getting-started/deliver-quickstart"},"Kusion Quickstart"),".")),(0,r.kt)("h2",{id:"cloud-credentials-and-permissions"},"Cloud Credentials and Permissions"),(0,r.kt)("p",null,"Kusion provisions databases on the cloud via ",(0,r.kt)("a",{parentName:"p",href:"https://www.terraform.io/"},"terraform")," providers. For it to create ",(0,r.kt)("em",{parentName:"p"},"any")," cloud resources, it requires a set of credentials that belongs to an account that has the appropriate write access so the terraform provider can be initialized properly."),(0,r.kt)("p",null,"For AWS, the environment variables needed:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'export AWS_ACCESS_KEY_ID="xxxxxxxxxxx" # replace it with your AccessKey\nexport AWS_SECRET_ACCESS_KEY="xxxxxxx" # replace it with your SecretKey\n')),(0,r.kt)("p",null,"For AliCloud, the environment variables needed:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'export ALICLOUD_ACCESS_KEY="xxxxxxxxx" # replace it with your AccessKey\nexport ALICLOUD_SECRET_KEY="xxxxxxxxx" # replace it with your SecretKey\n')),(0,r.kt)("p",null,"The user account that owns these credentials would need to have the proper permission policies attached to create databases and security groups. If you are using the cloud-managed policies, the policies needed to provision a database and configure firewall rules are listed below."),(0,r.kt)("p",null,"For AWS:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AmazonVPCFullAccess")," for creating and managing database firewall rules via security group"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AmazonRDSFullAccess")," for creating and managing RDS instances")),(0,r.kt)("p",null,"For AliCloud:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AliyunVPCFullAccess")," for creating and managing database firewall rules via security group"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AliyunRDSFullAccess")," for creating and managing RDS instances")),(0,r.kt)("p",null,"Alternatively, you can use customer managed policies if the cloud provider built-in policies don't meet your needs. The list of permissions needed are in the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonRDSFullAccess.html#AmazonRDSFullAccess-json"},"AmazonRDSFullAccess Policy Document")," and ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonVPCFullAccess.html"},"AmazonVPCFullAccess Policy Document"),". It will most likely be a subset of the permissions in the policy documents."),(0,r.kt)("h2",{id:"configure-database"},"Configure Database"),(0,r.kt)("h3",{id:"provision-a-cloud-database"},"Provision a Cloud Database"),(0,r.kt)("p",null,"Assuming the steps in the ",(0,r.kt)("a",{parentName:"p",href:"#cloud-credentials-and-permissions"},"Cloud Credentials and Permissions")," section is setup properly, you can now provision cloud databases via Kusion."),(0,r.kt)("h4",{id:"aws-rds-instance"},"AWS RDS Instance"),(0,r.kt)("p",null,"To provision an AWS RDS instance with MySQL v8.0 or PostgreSQL v14.0, you can append the following YAML file to your own workspace configurations and update the corresponding workspace with command ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace update"),". "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n aws: \n version: 5.0.1\n source: hashicorp/aws\n region: us-east-1 # Please replace with your own aws provider region\n\n# MySQL configurations for AWS RDS\nmodules: \n kusionstack/mysql@0.1.0:\n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n securityIPs: \n - 0.0.0.0/0\n suffix: "-mysql"\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n aws: \n version: 5.0.1\n source: hashicorp/aws\n region: us-east-1 # Please replace with your own aws provider region\n\n# PostgreSQL configurations for AWS RDS\nmodules: \n kusionstack/postgres@0.1.0:\n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n securityIPs: \n - 0.0.0.0/0\n suffix: "-postgres"\n')))),(0,r.kt)("p",null,"For KCL configuration file declarations: "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'wordpress: ac.AppConfiguration {\n # ...\n accessories: {\n "mysql": mysql.MySQL {\n type: "cloud"\n version: "8.0"\n }\n }\n}\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'pgadmin: ac.AppConfiguration {\n # ...\n accessories: {\n "postgres": postgres.PostgreSQL {\n type: "cloud"\n version: "14.0"\n }\n }\n}\n')))),(0,r.kt)("p",null,"It's highly recommended to replace ",(0,r.kt)("inlineCode",{parentName:"p"},"0.0.0.0/0")," and closely manage the whitelist of IPs that can access the database for security purposes. The ",(0,r.kt)("inlineCode",{parentName:"p"},"0.0.0.0/0")," in the example above or if ",(0,r.kt)("inlineCode",{parentName:"p"},"securityIPs")," is omitted altogether will allow connections from anywhere which would typically be a security bad practice."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"instanceType")," field determines the computation and memory capacity of the RDS instance. The ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.micro")," instance type in the example above represents the ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3")," instance class with a size of ",(0,r.kt)("inlineCode",{parentName:"p"},"micro"),". In the same ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3")," instance family there are also ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.small"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.medium"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.2xlarge"),", etc."),(0,r.kt)("p",null,"The full list of supported ",(0,r.kt)("inlineCode",{parentName:"p"},"instanceType")," values can be found ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html#Concepts.DBInstanceClass.Support"},"here"),"."),(0,r.kt)("p",null,"You can also adjust the storage capacity for the database instance by changing the ",(0,r.kt)("inlineCode",{parentName:"p"},"size")," field which is storage size measured in gigabytes. The minimum is 20. More details can be found ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#Concepts.Storage.GeneralSSD"},"here"),"."),(0,r.kt)("h4",{id:"alicloud-rds-instance"},"AliCloud RDS Instance"),(0,r.kt)("p",null,"To provision an Alicloud RDS instance with MySQL or PostgreSQL, you can append the following YAML file to your own workspace configurations and update the corresponding workspace with command ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace update"),". Note that AliCloud RDS has several additional fields such as ",(0,r.kt)("inlineCode",{parentName:"p"},"category"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting"),":"),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n alicloud:\n version: 1.209.1\n source: aliyun/alicloud\n region: cn-beijing # Please replace with your own alicloud provider region\n\n# MySQL configurations for Alicloud RDS\nmodules: \n kusionstack/mysql@0.1.0: \n default: \n cloud: alicloud\n size: 20\n instanceType: mysql.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n securityIPs: \n - 0.0.0.0/0\n suffix: "-mysql"\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n alicloud:\n version: 1.209.1\n source: aliyun/alicloud\n region: cn-beijing # Please replace with your own alicloud provider region\n\n# PostgreSQL configurations for Alicloud RDS\nmodules: \n kusionstack/postgres@0.1.0:\n default:\n cloud: alicloud\n size: 20\n instanceType: pg.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n securityIPs: \n - 0.0.0.0/0\n suffix: "-postgres"\n')))),(0,r.kt)("p",null,"For KCL configuration file declarations: "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'wordpress: ac.AppConfiguration {\n # ...\n accessories: {\n "mysql": mysql.MySQL {\n type: "cloud"\n version: "8.0"\n }\n }\n}\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'pgadmin: ac.AppConfiguration {\n # ...\n accessories: {\n "postgres": postgres.PostgreSQL {\n type: "cloud"\n version: "14.0"\n }\n }\n}\n')))),(0,r.kt)("p",null,"We will walkthrough ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting")," in the ",(0,r.kt)("a",{parentName:"p",href:"#configure-network-access"},"Configure Network Access")," section."),(0,r.kt)("p",null,"The full list of supported ",(0,r.kt)("inlineCode",{parentName:"p"},"instanceType")," values can be found in:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/apsaradb-rds-for-mysql/primary-apsaradb-rds-for-mysql-instance-types#concept-2096487"},"MySQL instance types(x86)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/apsaradb-rds-for-postgresql/primary-apsaradb-rds-for-postgresql-instance-types#concept-2096578"},"PostgreSQL instance types"))),(0,r.kt)("h3",{id:"local-database"},"Local Database"),(0,r.kt)("p",null,"To deploy a local database with MySQL v8.0 or PostgreSQL v14.0:"),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'wordpress: ac.AppConfiguration {\n # ...\n accessories: {\n "mysql": mysql.MySQL {\n type: "local"\n version: "8.0"\n }\n }\n}\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'pgadmin: ac.AppConfiguration {\n # ...\n accessories: {\n "postgres": postgres.PostgreSQL {\n type: "local"\n version: "14.0"\n }\n }\n}\n')))),(0,r.kt)("h2",{id:"database-credentials"},"Database Credentials"),(0,r.kt)("p",null,"There is no need to manage the database credentials manually. Kusion will automatically generate a random password, set it as the credential when creating the database, and then inject the hostname, username and password into the application runtime."),(0,r.kt)("p",null,"You have the option to BYO (Bring Your Own) username for the database credential by specifying the ",(0,r.kt)("inlineCode",{parentName:"p"},"username")," attribute in the ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n kusionstack/mysql@0.1.0:\n default:\n # ...\n username: "my_username"\n')),(0,r.kt)("p",null,"You ",(0,r.kt)("strong",{parentName:"p"},"cannot")," bring your own password. The password will always be managed by Kusion automatically."),(0,r.kt)("p",null,"The database credentials are injected into the environment variables of the application container. You can access them via the following env vars:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"# env | grep KUSION_DB\nKUSION_DB_HOST_WORDPRESS_MYSQL=wordpress.xxxxxxxx.us-east-1.rds.amazonaws.com\nKUSION_DB_USERNAME_WORDPRESS_MYSQL=xxxxxxxxx\nKUSION_DB_PASSWORD_WORDPRESS_MYSQL=xxxxxxxxx\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about the environment of database credentials injected by Kusion can be found at ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/reference/modules/developer-schemas/database/mysql#credentials-and-connectivity"},"mysql credentials and connectivity")," and ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/reference/modules/developer-schemas/database/postgres#credentials-and-connectivity"},"postgres credentials and connectivity"))),(0,r.kt)("p",null,"You can use these environment variables out of the box. Or most likely, your application might retrieve the connection details from a different set of environment variables. In that case, you can map the kusion environment variables to the ones expected by your application using the ",(0,r.kt)("inlineCode",{parentName:"p"},"$()")," expression. "),(0,r.kt)("p",null,"This example below will assign the value of ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_HOST_WORDPRESS_MYSQL")," into ",(0,r.kt)("inlineCode",{parentName:"p"},"WORDPRESS_DB_HOST"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_USERNAME_WORDPRESS_MYSQL")," into ",(0,r.kt)("inlineCode",{parentName:"p"},"WORDPRESS_DB_USER"),", likewise for ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_PASSWORD_WORDPRESS_MYSQL")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"WORDPRESS_DB_PASSWORD"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'wordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n wordpress: c.Container {\n image = "wordpress:6.3-apache"\n env: {\n "WORDPRESS_DB_HOST": "$(KUSION_DB_HOST_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD_WORDPRESS_MYSQL)"\n }\n # ...\n }\n }\n # ...\n }\n accessories: {\n # ...\n }\n}\n')),(0,r.kt)("h2",{id:"configure-network-access"},"Configure Network Access"),(0,r.kt)("p",null,"You can also optionally configure the network access to the database as part of the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),". This is highly recommended because it dramatically increases the security posture of your cloud environment in the means of least privilege principle."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"securityIPs")," field in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Database")," schema declares the list of network addresses that are allowed to access the database. The network addresses are in the ",(0,r.kt)("a",{parentName:"p",href:"https://aws.amazon.com/what-is/cidr/"},"CIDR notation")," and can be either a private IP range (",(0,r.kt)("a",{parentName:"p",href:"https://datatracker.ietf.org/doc/html/rfc1918"},"RFC-1918")," and ",(0,r.kt)("a",{parentName:"p",href:"https://datatracker.ietf.org/doc/html/rfc6598"},"RFC-6598")," address) or a public one."),(0,r.kt)("p",null,"If the database need to be accessed from a public location (which should most likely not be the case in a production environment), ",(0,r.kt)("inlineCode",{parentName:"p"},"securityIPs")," need to include the public IP address of the traffic source (For instance, if the RDS database needs to be accessed from your computer)."),(0,r.kt)("p",null,"To configure AWS RDS to restrict network access from a VPC with a CIDR of ",(0,r.kt)("inlineCode",{parentName:"p"},"10.0.1.0/24")," and a public IP of ",(0,r.kt)("inlineCode",{parentName:"p"},"103.192.227.125"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'modules: \n kusionstack/mysql@0.1.0: \n default: \n cloud: aws\n # ...\n securityIPs: \n - "10.0.1.0/24"\n - "103.192.227.125/32"\n')),(0,r.kt)("p",null,"Depending on the cloud provider, the default behavior of the database firewall settings may differ if omitted."),(0,r.kt)("h3",{id:"subnet-id"},"Subnet ID"),(0,r.kt)("p",null,"On AWS, you have the option to launch the RDS instance inside a specific VPC if a ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," is present in the application configuration. By default, if ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," is not provided, the RDS will be created in the default VPC for that account. However, the recommendation is to self-manage your VPCs to provider better isolation from a network security perspective."),(0,r.kt)("p",null,"On AliCloud, the ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," is required. The concept of subnet maps to VSwitch in AliCloud."),(0,r.kt)("p",null,"To place the RDS instance into a specific VPC on Alicloud:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'modules: \n kusionstack/mysql@0.1.0: \n default: \n cloud: alicloud\n # ...\n subnetID: "subnet-xxxxxxxxxxxxxxxx"\n')),(0,r.kt)("h3",{id:"private-routing"},"Private Routing"),(0,r.kt)("p",null,"There is an option to enforce private routing on certain cloud providers if both the workload and the database are running on the cloud."),(0,r.kt)("p",null,"On AliCloud, you can set the ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting")," flag to ",(0,r.kt)("inlineCode",{parentName:"p"},"True"),". The database host generated will be a private FQDN that is only resolvable and accessible from within the AliCloud VPCs. Setting ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting")," flag to ",(0,r.kt)("inlineCode",{parentName:"p"},"True")," when ",(0,r.kt)("inlineCode",{parentName:"p"},"type")," is ",(0,r.kt)("inlineCode",{parentName:"p"},"aws")," is a no-op."),(0,r.kt)("p",null,"To enforce private routing on AliCloud:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules: \n kusionstack/mysql@0.1.0: \n default: \n cloud: alicloud\n # ...\n privateRouting: true\n")),(0,r.kt)("p",null,"Kusion will then generate a private FQDN and inject it into the application runtime as the environment variable ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_HOST_")," for the application to use. A complete list of Kusion-managed environment variables for mysql database can be found ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/reference/modules/developer-schemas/database/mysql#credentials-and-connectivity"},"here"),"."),(0,r.kt)("p",null,"Otherwise when using the public FQDN to connect to a database from the workload, the route will depend on cloud provider's routing preference. The options are generally either:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Travel as far as possible on the cloud provider's global backbone network, or also referred to as cold potato routing, or"),(0,r.kt)("li",{parentName:"ul"},"Egress as early as possible to the public Internet and re-enter the cloud provider's datacenter later, or also referred to as hot potato routing")),(0,r.kt)("p",null,"The prior generally has better performance but is also more expensive."),(0,r.kt)("p",null,"You can find a good read on the ",(0,r.kt)("a",{parentName:"p",href:"https://aws.amazon.com/blogs/architecture/internet-routing-and-traffic-engineering/"},"AWS Blog")," or the ",(0,r.kt)("a",{parentName:"p",href:"https://learn.microsoft.com/en-us/azure/virtual-network/ip-services/routing-preference-overview"},"Microsoft Learn"),"."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/977fdfc4.859a2a9a.js b/assets/js/977fdfc4.859a2a9a.js deleted file mode 100644 index e4a082c2e11..00000000000 --- a/assets/js/977fdfc4.859a2a9a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[135],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),u=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},c=function(e){var t=u(e.components);return n.createElement(l.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=u(a),m=r,h=d["".concat(l,".").concat(m)]||d[m]||p[m]||o;return a?n.createElement(h,i(i({ref:t},c),{},{components:a})):n.createElement(h,i({ref:t},c))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,i=new Array(o);i[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var u=2;u{a.d(t,{Z:()=>i});var n=a(67294),r=a(86010);const o="tabItem_Ymn6";function i(e){let{children:t,hidden:a,className:i}=e;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(o,i),hidden:a},t)}},74866:(e,t,a)=>{a.d(t,{Z:()=>S});var n=a(87462),r=a(67294),o=a(86010),i=a(12466),s=a(76775),l=a(91980),u=a(67392),c=a(50012);function p(e){return function(e){var t;return(null==(t=r.Children.map(e,(e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})))?void 0:t.filter(Boolean))??[]}(e).map((e=>{let{props:{value:t,label:a,attributes:n,default:r}}=e;return{value:t,label:a,attributes:n,default:r}}))}function d(e){const{values:t,children:a}=e;return(0,r.useMemo)((()=>{const e=t??p(a);return function(e){const t=(0,u.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,a])}function m(e){let{value:t,tabValues:a}=e;return a.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:a}=e;const n=(0,s.k6)(),o=function(e){let{queryString:t=!1,groupId:a}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!a)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return a??null}({queryString:t,groupId:a});return[(0,l._X)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(n.location.search);t.set(o,e),n.replace({...n.location,search:t.toString()})}),[o,n])]}function f(e){const{defaultValue:t,queryString:a=!1,groupId:n}=e,o=d(e),[i,s]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:a}=e;if(0===a.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:a}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${a.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const n=a.find((e=>e.default))??a[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:o}))),[l,u]=h({queryString:a,groupId:n}),[p,f]=function(e){let{groupId:t}=e;const a=function(e){return e?`docusaurus.tab.${e}`:null}(t),[n,o]=(0,c.Nk)(a);return[n,(0,r.useCallback)((e=>{a&&o.set(e)}),[a,o])]}({groupId:n}),k=(()=>{const e=l??p;return m({value:e,tabValues:o})?e:null})();(0,r.useLayoutEffect)((()=>{k&&s(k)}),[k]);return{selectedValue:i,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);s(e),u(e),f(e)}),[u,f,o]),tabValues:o}}var k=a(72389);const g="tabList__CuJ",b="tabItem_LNqP";function y(e){let{className:t,block:a,selectedValue:s,selectValue:l,tabValues:u}=e;const c=[],{blockElementScrollPositionUntilNextRender:p}=(0,i.o5)(),d=e=>{const t=e.currentTarget,a=c.indexOf(t),n=u[a].value;n!==s&&(p(t),l(n))},m=e=>{var t;let a=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=c.indexOf(e.currentTarget)+1;a=c[t]??c[0];break}case"ArrowLeft":{const t=c.indexOf(e.currentTarget)-1;a=c[t]??c[c.length-1];break}}null==(t=a)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":a},t)},u.map((e=>{let{value:t,label:a,attributes:i}=e;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,key:t,ref:e=>c.push(e),onKeyDown:m,onClick:d},i,{className:(0,o.Z)("tabs__item",b,null==i?void 0:i.className,{"tabs__item--active":s===t})}),a??t)})))}function v(e){let{lazy:t,children:a,selectedValue:n}=e;const o=(Array.isArray(a)?a:[a]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===n));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==n}))))}function w(e){const t=f(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",g)},r.createElement(y,(0,n.Z)({},e,t)),r.createElement(v,(0,n.Z)({},e,t)))}function S(e){const t=(0,k.Z)();return r.createElement(w,(0,n.Z)({key:String(t)},e))}},81087:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>s,metadata:()=>u,toc:()=>p});var n=a(87462),r=(a(67294),a(3905)),o=a(74866),i=a(85162);const s={id:"databse"},l="Managed Databases",u={unversionedId:"configuration-walkthrough/databse",id:"configuration-walkthrough/databse",title:"Managed Databases",description:"You could also specify a database needed for the application. That can be achieved via a mysql or a postgres module (or bring-your-own-module) in the accessories field in AppConfiguration to achieve that.",source:"@site/docs/kusion/4-configuration-walkthrough/6-database.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/databse",permalink:"/docs/next/configuration-walkthrough/databse",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/4-configuration-walkthrough/6-database.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:6,frontMatter:{id:"databse"},sidebar:"kusion",previous:{title:"Application Networking",permalink:"/docs/next/configuration-walkthrough/networking"},next:{title:"Secrets",permalink:"/docs/next/configuration-walkthrough/secret"}},c={},p=[{value:"Import",id:"import",level:2},{value:"Types of Database offerings",id:"types-of-database-offerings",level:2},{value:"Cloud Credentials and Permissions",id:"cloud-credentials-and-permissions",level:2},{value:"Configure Database",id:"configure-database",level:2},{value:"Provision a Cloud Database",id:"provision-a-cloud-database",level:3},{value:"AWS RDS Instance",id:"aws-rds-instance",level:4},{value:"AliCloud RDS Instance",id:"alicloud-rds-instance",level:4},{value:"Local Database",id:"local-database",level:3},{value:"Database Credentials",id:"database-credentials",level:2},{value:"Configure Network Access",id:"configure-network-access",level:2},{value:"Subnet ID",id:"subnet-id",level:3},{value:"Private Routing",id:"private-routing",level:3}],d={toc:p};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"managed-databases"},"Managed Databases"),(0,r.kt)("p",null,"You could also specify a database needed for the application. That can be achieved via a ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql")," or a ",(0,r.kt)("inlineCode",{parentName:"p"},"postgres")," module (or bring-your-own-module) in the ",(0,r.kt)("inlineCode",{parentName:"p"},"accessories")," field in ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," to achieve that."),(0,r.kt)("p",null,"You can currently have several databases with ",(0,r.kt)("strong",{parentName:"p"},"different database names")," for an application at the same time."),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"kam")," package and the ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql")," Kusion Module. For more details on KCL package and module import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/configuration-walkthrough/overview#configuration-file-overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport mysql.mysql\nimport postgres.postgres\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"kcl.mod")," must contain reference to the ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql")," module or ",(0,r.kt)("inlineCode",{parentName:"p"},"postgres")," module:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'#...\n\n[dependencies]\nmysql = { oci = "oci://ghcr.io/kusionstack/mysql", tag = "0.1.0" }\npostgres = { oci = "oci://ghcr.io/kusionstack/postgres", tag = "0.1.0" }\n#...\n')),(0,r.kt)("h2",{id:"types-of-database-offerings"},"Types of Database offerings"),(0,r.kt)("p",null,"As of version 0.11.0, Kusion supports the following database offerings on the cloud:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"MySQL and PostgreSQL Relational Database Service (RDS) on ",(0,r.kt)("a",{parentName:"li",href:"https://aws.amazon.com/rds/"},"AWS")),(0,r.kt)("li",{parentName:"ul"},"MySQL and PostgreSQL Relational Database Service (RDS) on ",(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/product/databases"},"AliCloud"))),(0,r.kt)("p",null,"More database types on more cloud vendors will be added in the future."),(0,r.kt)("p",null,"Alternatively, Kusion also supports creating a database at ",(0,r.kt)("inlineCode",{parentName:"p"},"localhost")," for local testing needs. A local database is quicker to stand up and easier to manage. It also eliminates the need for an account and any relevant costs with the cloud providers in the case that a local testing environment is sufficient."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"You do need a local Kubernetes cluster to run the local database workloads. You can refer to ",(0,r.kt)("a",{parentName:"p",href:"https://minikube.sigs.k8s.io/docs/start/"},"Minikube")," or ",(0,r.kt)("a",{parentName:"p",href:"https://kind.sigs.k8s.io/docs/user/quick-start/"},"Kind")," to get started.\nTo see an end-to-end use case for standing up a local testing environment including a local database, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/getting-started/deliver-quickstart"},"Kusion Quickstart"),".")),(0,r.kt)("h2",{id:"cloud-credentials-and-permissions"},"Cloud Credentials and Permissions"),(0,r.kt)("p",null,"Kusion provisions databases on the cloud via ",(0,r.kt)("a",{parentName:"p",href:"https://www.terraform.io/"},"terraform")," providers. For it to create ",(0,r.kt)("em",{parentName:"p"},"any")," cloud resources, it requires a set of credentials that belongs to an account that has the appropriate write access so the terraform provider can be initialized properly."),(0,r.kt)("p",null,"For AWS, the environment variables needed:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'export AWS_ACCESS_KEY_ID="xxxxxxxxxxx" # replace it with your AccessKey\nexport AWS_SECRET_ACCESS_KEY="xxxxxxx" # replace it with your SecretKey\n')),(0,r.kt)("p",null,"For AliCloud, the environment variables needed:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'export ALICLOUD_ACCESS_KEY="xxxxxxxxx" # replace it with your AccessKey\nexport ALICLOUD_SECRET_KEY="xxxxxxxxx" # replace it with your SecretKey\n')),(0,r.kt)("p",null,"The user account that owns these credentials would need to have the proper permission policies attached to create databases and security groups. If you are using the cloud-managed policies, the policies needed to provision a database and configure firewall rules are listed below."),(0,r.kt)("p",null,"For AWS:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AmazonVPCFullAccess")," for creating and managing database firewall rules via security group"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AmazonRDSFullAccess")," for creating and managing RDS instances")),(0,r.kt)("p",null,"For AliCloud:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AliyunVPCFullAccess")," for creating and managing database firewall rules via security group"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AliyunRDSFullAccess")," for creating and managing RDS instances")),(0,r.kt)("p",null,"Alternatively, you can use customer managed policies if the cloud provider built-in policies don't meet your needs. The list of permissions needed are in the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonRDSFullAccess.html#AmazonRDSFullAccess-json"},"AmazonRDSFullAccess Policy Document")," and ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonVPCFullAccess.html"},"AmazonVPCFullAccess Policy Document"),". It will most likely be a subset of the permissions in the policy documents."),(0,r.kt)("h2",{id:"configure-database"},"Configure Database"),(0,r.kt)("h3",{id:"provision-a-cloud-database"},"Provision a Cloud Database"),(0,r.kt)("p",null,"Assuming the steps in the ",(0,r.kt)("a",{parentName:"p",href:"#cloud-credentials-and-permissions"},"Cloud Credentials and Permissions")," section is setup properly, you can now provision cloud databases via Kusion."),(0,r.kt)("h4",{id:"aws-rds-instance"},"AWS RDS Instance"),(0,r.kt)("p",null,"To provision an AWS RDS instance with MySQL v8.0 or PostgreSQL v14.0, you can append the following YAML file to your own workspace configurations and update the corresponding workspace with command ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace update"),". "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n aws: \n version: 5.0.1\n source: hashicorp/aws\n region: us-east-1 # Please replace with your own aws provider region\n\n# MySQL configurations for AWS RDS\nmodules: \n kusionstack/mysql@0.1.0:\n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n securityIPs: \n - 0.0.0.0/0\n suffix: "-mysql"\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n aws: \n version: 5.0.1\n source: hashicorp/aws\n region: us-east-1 # Please replace with your own aws provider region\n\n# PostgreSQL configurations for AWS RDS\nmodules: \n kusionstack/postgres@0.1.0:\n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n securityIPs: \n - 0.0.0.0/0\n suffix: "-postgres"\n')))),(0,r.kt)("p",null,"For KCL configuration file declarations: "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'wordpress: ac.AppConfiguration {\n # ...\n accessories: {\n "mysql": mysql.MySQL {\n type: "cloud"\n version: "8.0"\n }\n }\n}\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'pgadmin: ac.AppConfiguration {\n # ...\n accessories: {\n "postgres": postgres.PostgreSQL {\n type: "cloud"\n version: "14.0"\n }\n }\n}\n')))),(0,r.kt)("p",null,"It's highly recommended to replace ",(0,r.kt)("inlineCode",{parentName:"p"},"0.0.0.0/0")," and closely manage the whitelist of IPs that can access the database for security purposes. The ",(0,r.kt)("inlineCode",{parentName:"p"},"0.0.0.0/0")," in the example above or if ",(0,r.kt)("inlineCode",{parentName:"p"},"securityIPs")," is omitted altogether will allow connections from anywhere which would typically be a security bad practice."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"instanceType")," field determines the computation and memory capacity of the RDS instance. The ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.micro")," instance type in the example above represents the ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3")," instance class with a size of ",(0,r.kt)("inlineCode",{parentName:"p"},"micro"),". In the same ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3")," instance family there are also ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.small"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.medium"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.2xlarge"),", etc."),(0,r.kt)("p",null,"The full list of supported ",(0,r.kt)("inlineCode",{parentName:"p"},"instanceType")," values can be found ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html#Concepts.DBInstanceClass.Support"},"here"),"."),(0,r.kt)("p",null,"You can also adjust the storage capacity for the database instance by changing the ",(0,r.kt)("inlineCode",{parentName:"p"},"size")," field which is storage size measured in gigabytes. The minimum is 20. More details can be found ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#Concepts.Storage.GeneralSSD"},"here"),"."),(0,r.kt)("h4",{id:"alicloud-rds-instance"},"AliCloud RDS Instance"),(0,r.kt)("p",null,"To provision an Alicloud RDS instance with MySQL or PostgreSQL, you can append the following YAML file to your own workspace configurations and update the corresponding workspace with command ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace update"),". Note that AliCloud RDS has several additional fields such as ",(0,r.kt)("inlineCode",{parentName:"p"},"category"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting"),":"),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n alicloud:\n version: 1.209.1\n source: aliyun/alicloud\n region: cn-beijing # Please replace with your own alicloud provider region\n\n# MySQL configurations for Alicloud RDS\nmodules: \n kusionstack/mysql@0.1.0: \n default: \n cloud: alicloud\n size: 20\n instanceType: mysql.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n securityIPs: \n - 0.0.0.0/0\n suffix: "-mysql"\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n alicloud:\n version: 1.209.1\n source: aliyun/alicloud\n region: cn-beijing # Please replace with your own alicloud provider region\n\n# PostgreSQL configurations for Alicloud RDS\nmodules: \n kusionstack/postgres@0.1.0:\n default:\n cloud: alicloud\n size: 20\n instanceType: pg.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n securityIPs: \n - 0.0.0.0/0\n suffix: "-postgres"\n')))),(0,r.kt)("p",null,"For KCL configuration file declarations: "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'wordpress: ac.AppConfiguration {\n # ...\n accessories: {\n "mysql": mysql.MySQL {\n type: "cloud"\n version: "8.0"\n }\n }\n}\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'pgadmin: ac.AppConfiguration {\n # ...\n accessories: {\n "postgres": postgres.PostgreSQL {\n type: "cloud"\n version: "14.0"\n }\n }\n}\n')))),(0,r.kt)("p",null,"We will walkthrough ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting")," in the ",(0,r.kt)("a",{parentName:"p",href:"#configure-network-access"},"Configure Network Access")," section."),(0,r.kt)("p",null,"The full list of supported ",(0,r.kt)("inlineCode",{parentName:"p"},"instanceType")," values can be found in:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/apsaradb-rds-for-mysql/primary-apsaradb-rds-for-mysql-instance-types#concept-2096487"},"MySQL instance types(x86)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/apsaradb-rds-for-postgresql/primary-apsaradb-rds-for-postgresql-instance-types#concept-2096578"},"PostgreSQL instance types"))),(0,r.kt)("h3",{id:"local-database"},"Local Database"),(0,r.kt)("p",null,"To deploy a local database with MySQL v8.0 or PostgreSQL v14.0:"),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'wordpress: ac.AppConfiguration {\n # ...\n accessories: {\n "mysql": mysql.MySQL {\n type: "local"\n version: "8.0"\n }\n }\n}\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'pgadmin: ac.AppConfiguration {\n # ...\n accessories: {\n "postgres": postgres.PostgreSQL {\n type: "local"\n version: "14.0"\n }\n }\n}\n')))),(0,r.kt)("h2",{id:"database-credentials"},"Database Credentials"),(0,r.kt)("p",null,"There is no need to manage the database credentials manually. Kusion will automatically generate a random password, set it as the credential when creating the database, and then inject the hostname, username and password into the application runtime."),(0,r.kt)("p",null,"You have the option to BYO (Bring Your Own) username for the database credential by specifying the ",(0,r.kt)("inlineCode",{parentName:"p"},"username")," attribute in the ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n kusionstack/mysql@0.1.0:\n default:\n # ...\n username: "my_username"\n')),(0,r.kt)("p",null,"You ",(0,r.kt)("strong",{parentName:"p"},"cannot")," bring your own password. The password will always be managed by Kusion automatically."),(0,r.kt)("p",null,"The database credentials are injected into the environment variables of the application container. You can access them via the following env vars:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"# env | grep KUSION_DB\nKUSION_DB_HOST_WORDPRESS_MYSQL=wordpress.xxxxxxxx.us-east-1.rds.amazonaws.com\nKUSION_DB_USERNAME_WORDPRESS_MYSQL=xxxxxxxxx\nKUSION_DB_PASSWORD_WORDPRESS_MYSQL=xxxxxxxxx\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about the environment of database credentials injected by Kusion can be found at ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/reference/modules/developer-schemas/database/mysql#credentials-and-connectivity"},"mysql credentials and connectivity")," and ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/reference/modules/developer-schemas/database/postgres#credentials-and-connectivity"},"postgres credentials and connectivity"))),(0,r.kt)("p",null,"You can use these environment variables out of the box. Or most likely, your application might retrieve the connection details from a different set of environment variables. In that case, you can map the kusion environment variables to the ones expected by your application using the ",(0,r.kt)("inlineCode",{parentName:"p"},"$()")," expression. "),(0,r.kt)("p",null,"This example below will assign the value of ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_HOST_WORDPRESS_MYSQL")," into ",(0,r.kt)("inlineCode",{parentName:"p"},"WORDPRESS_DB_HOST"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_USERNAME_WORDPRESS_MYSQL")," into ",(0,r.kt)("inlineCode",{parentName:"p"},"WORDPRESS_DB_USER"),", likewise for ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_PASSWORD_WORDPRESS_MYSQL")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"WORDPRESS_DB_PASSWORD"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'wordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n wordpress: c.Container {\n image = "wordpress:6.3-apache"\n env: {\n "WORDPRESS_DB_HOST": "$(KUSION_DB_HOST_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD_WORDPRESS_MYSQL)"\n }\n # ...\n }\n }\n # ...\n }\n accessories: {\n # ...\n }\n}\n')),(0,r.kt)("h2",{id:"configure-network-access"},"Configure Network Access"),(0,r.kt)("p",null,"You can also optionally configure the network access to the database as part of the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),". This is highly recommended because it dramatically increases the security posture of your cloud environment in the means of least privilege principle."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"securityIPs")," field in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Database")," schema declares the list of network addresses that are allowed to access the database. The network addresses are in the ",(0,r.kt)("a",{parentName:"p",href:"https://aws.amazon.com/what-is/cidr/"},"CIDR notation")," and can be either a private IP range (",(0,r.kt)("a",{parentName:"p",href:"https://datatracker.ietf.org/doc/html/rfc1918"},"RFC-1918")," and ",(0,r.kt)("a",{parentName:"p",href:"https://datatracker.ietf.org/doc/html/rfc6598"},"RFC-6598")," address) or a public one."),(0,r.kt)("p",null,"If the database need to be accessed from a public location (which should most likely not be the case in a production environment), ",(0,r.kt)("inlineCode",{parentName:"p"},"securityIPs")," need to include the public IP address of the traffic source (For instance, if the RDS database needs to be accessed from your computer)."),(0,r.kt)("p",null,"To configure AWS RDS to restrict network access from a VPC with a CIDR of ",(0,r.kt)("inlineCode",{parentName:"p"},"10.0.1.0/24")," and a public IP of ",(0,r.kt)("inlineCode",{parentName:"p"},"103.192.227.125"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'modules: \n kusionstack/mysql@0.1.0: \n default: \n cloud: aws\n # ...\n securityIPs: \n - "10.0.1.0/24"\n - "103.192.227.125/32"\n')),(0,r.kt)("p",null,"Depending on the cloud provider, the default behavior of the database firewall settings may differ if omitted."),(0,r.kt)("h3",{id:"subnet-id"},"Subnet ID"),(0,r.kt)("p",null,"On AWS, you have the option to launch the RDS instance inside a specific VPC if a ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," is present in the application configuration. By default, if ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," is not provided, the RDS will be created in the default VPC for that account. However, the recommendation is to self-manage your VPCs to provider better isolation from a network security perspective."),(0,r.kt)("p",null,"On AliCloud, the ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," is required. The concept of subnet maps to VSwitch in AliCloud."),(0,r.kt)("p",null,"To place the RDS instance into a specific VPC on Alicloud:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'modules: \n kusionstack/mysql@0.1.0: \n default: \n cloud: alicloud\n # ...\n subnetID: "subnet-xxxxxxxxxxxxxxxx"\n')),(0,r.kt)("h3",{id:"private-routing"},"Private Routing"),(0,r.kt)("p",null,"There is an option to enforce private routing on certain cloud providers if both the workload and the database are running on the cloud."),(0,r.kt)("p",null,"On AliCloud, you can set the ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting")," flag to ",(0,r.kt)("inlineCode",{parentName:"p"},"True"),". The database host generated will be a private FQDN that is only resolvable and accessible from within the AliCloud VPCs. Setting ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting")," flag to ",(0,r.kt)("inlineCode",{parentName:"p"},"True")," when ",(0,r.kt)("inlineCode",{parentName:"p"},"type")," is ",(0,r.kt)("inlineCode",{parentName:"p"},"aws")," is a no-op."),(0,r.kt)("p",null,"To enforce private routing on AliCloud:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules: \n kusionstack/mysql@0.1.0: \n default: \n cloud: alicloud\n # ...\n privateRouting: true\n")),(0,r.kt)("p",null,"Kusion will then generate a private FQDN and inject it into the application runtime as the environment variable ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_HOST_")," for the application to use. A complete list of Kusion-managed environment variables for mysql database can be found ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/reference/modules/developer-schemas/database/mysql#credentials-and-connectivity"},"here"),"."),(0,r.kt)("p",null,"Otherwise when using the public FQDN to connect to a database from the workload, the route will depend on cloud provider's routing preference. The options are generally either:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Travel as far as possible on the cloud provider's global backbone network, or also referred to as cold potato routing, or"),(0,r.kt)("li",{parentName:"ul"},"Egress as early as possible to the public Internet and re-enter the cloud provider's datacenter later, or also referred to as hot potato routing")),(0,r.kt)("p",null,"The prior generally has better performance but is also more expensive."),(0,r.kt)("p",null,"You can find a good read on the ",(0,r.kt)("a",{parentName:"p",href:"https://aws.amazon.com/blogs/architecture/internet-routing-and-traffic-engineering/"},"AWS Blog")," or the ",(0,r.kt)("a",{parentName:"p",href:"https://learn.microsoft.com/en-us/azure/virtual-network/ip-services/routing-preference-overview"},"Microsoft Learn"),"."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/97cb7c6f.2185af50.js b/assets/js/97cb7c6f.2185af50.js new file mode 100644 index 00000000000..73ffb118d36 --- /dev/null +++ b/assets/js/97cb7c6f.2185af50.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4627],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=c(n),d=o,f=u["".concat(l,".").concat(d)]||u[d]||m[d]||i;return n?r.createElement(f,a(a({ref:t},p),{},{components:n})):r.createElement(f,a({ref:t},p))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=u;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>m,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var r=n(87462),o=(n(67294),n(3905));const i={},a="kusion mod init",s={unversionedId:"reference/commands/kusion-mod-init",id:"version-v0.11/reference/commands/kusion-mod-init",title:"kusion mod init",description:"Create a kusion module along with common files and directories in the current directory",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-mod-init.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-mod-init",permalink:"/docs/reference/commands/kusion-mod-init",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-mod-init.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion init",permalink:"/docs/reference/commands/kusion-init"},next:{title:"kusion mod push",permalink:"/docs/reference/commands/kusion-mod-push"}},l={},c=[{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:c};function m(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-mod-init"},"kusion mod init"),(0,o.kt)("p",null,"Create a kusion module along with common files and directories in the current directory"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion mod init [MODULE NAME] [PATH] [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Create a kusion module template in the current directory\n kusion mod init my-module\n \n # Init a kusion module at the specified Path\n kusion mod init my-module ./modules\n \n # Init a module from a remote git template repository\n kusion mod init my-module --template https://github.com//\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for init\n --template string Initialize with specified template\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-mod"},"kusion mod"),"\t - Manage Kusion modules")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/97cb7c6f.dd8c1393.js b/assets/js/97cb7c6f.dd8c1393.js deleted file mode 100644 index bd8c74e9219..00000000000 --- a/assets/js/97cb7c6f.dd8c1393.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4627],{3905:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},m=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,m=s(e,["components","mdxType","originalType","parentName"]),u=c(n),d=o,f=u["".concat(l,".").concat(d)]||u[d]||p[d]||i;return n?r.createElement(f,a(a({ref:t},m),{},{components:n})):r.createElement(f,a({ref:t},m))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=u;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>p,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var r=n(87462),o=(n(67294),n(3905));const i={},a="kusion mod init",s={unversionedId:"reference/commands/kusion-mod-init",id:"version-v0.11/reference/commands/kusion-mod-init",title:"kusion mod init",description:"Create a kusion module along with common files and directories in the current directory",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-mod-init.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-mod-init",permalink:"/docs/reference/commands/kusion-mod-init",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-mod-init.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion init",permalink:"/docs/reference/commands/kusion-init"},next:{title:"kusion mod push",permalink:"/docs/reference/commands/kusion-mod-push"}},l={},c=[{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],m={toc:c};function p(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-mod-init"},"kusion mod init"),(0,o.kt)("p",null,"Create a kusion module along with common files and directories in the current directory"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion mod init [MODULE NAME] [PATH] [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Create a kusion module template in the current directory\n kusion mod init my-module\n \n # Init a kusion module at the specified Path\n kusion mod init my-module ./modules\n \n # Init a module from a remote git template repository\n kusion mod init my-module --template https://github.com//\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for init\n --template string Initialize with specified template\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-mod"},"kusion mod"),"\t - Manage Kusion modules")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/97d4b178.12592fa3.js b/assets/js/97d4b178.12592fa3.js new file mode 100644 index 00000000000..5fe5ba3ad89 --- /dev/null +++ b/assets/js/97d4b178.12592fa3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5644],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},d=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,p=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=s(n),m=i,k=u["".concat(p,".").concat(m)]||u[m]||c[m]||o;return n?a.createElement(k,r(r({ref:t},d),{},{components:n})):a.createElement(k,r({ref:t},d))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,r=new Array(o);r[0]=u;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>r,default:()=>c,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var a=n(87462),i=(n(67294),n(3905));const o={id:"kcl-basics"},r="KCL Basics",l={unversionedId:"configuration-walkthrough/kcl-basics",id:"configuration-walkthrough/kcl-basics",title:"KCL Basics",description:"Table of Content",source:"@site/docs/kusion/4-configuration-walkthrough/2-kcl-basics.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/kcl-basics",permalink:"/docs/next/configuration-walkthrough/kcl-basics",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/4-configuration-walkthrough/2-kcl-basics.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"kcl-basics"},sidebar:"kusion",previous:{title:"Configuration File Overview",permalink:"/docs/next/configuration-walkthrough/overview"},next:{title:"Base and Override",permalink:"/docs/next/configuration-walkthrough/base-override"}},p={},s=[{value:"Table of Content",id:"table-of-content",level:2},{value:"Variable assignments",id:"variable-assignments",level:2},{value:"Common built-in types",id:"common-built-in-types",level:2},{value:"Lists and maps",id:"lists-and-maps",level:2},{value:"Conditional statements",id:"conditional-statements",level:2},{value:"The : and = operator",id:"the--and--operator",level:2},{value:"Advanced KCL capabilities",id:"advanced-kcl-capabilities",level:2}],d={toc:s};function c(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"kcl-basics"},"KCL Basics"),(0,i.kt)("h2",{id:"table-of-content"},"Table of Content"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#variable-assignments"},"Variable assignments")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#common-built-in-types"},"Common built-in types")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#lists-and-maps"},"Lists and maps")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#conditional-statements"},"Conditional statements")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#the--and--operator"},"The : and = operator")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#advanced-kcl-capabilities"},"Advanced KCL capabilities"))),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/"},"KCL")," is the choice of configuration language consumed by Kusion. KCL is an open source constraint-based record and functional language. KCL works well with a large number of complex configurations via modern programming language technology and practice, and is committed to provide better modularity, scalability, stability and extensibility."),(0,i.kt)("h2",{id:"variable-assignments"},"Variable assignments"),(0,i.kt)("p",null,"There are two ways to initialize a variable in KCL. You can either use the ",(0,i.kt)("inlineCode",{parentName:"p"},":")," operator or the ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operator. We will discuss the difference between them in ",(0,i.kt)("a",{parentName:"p",href:"#the--and--operator"},"this section later"),"."),(0,i.kt)("p",null,"Here are the two ways to create a variable and initialize it:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'foo = "Foo" # Declare a variable named `foo` and its value is a string literal "Foo"\nbar: "Bar" # Declare a variable named `bar` and its value is a string literal "Bar"\n')),(0,i.kt)("p",null,"You will be able to override a variable assignment via the ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operator. We will discuss this in depth in the ",(0,i.kt)("a",{parentName:"p",href:"#the--and--operator"},(0,i.kt)("inlineCode",{parentName:"a"},":")," and ",(0,i.kt)("inlineCode",{parentName:"a"},"=")," operator section"),"."),(0,i.kt)("h2",{id:"common-built-in-types"},"Common built-in types"),(0,i.kt)("p",null,"KCL supports ",(0,i.kt)("inlineCode",{parentName:"p"},"int"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"float"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"bool")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"string")," as the built-in types."),(0,i.kt)("p",null,"Other types are defined in the packages that are imported into the application configuration files. One such example would be the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," object (or ",(0,i.kt)("inlineCode",{parentName:"p"},"Container"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Probe"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Port")," object, etc) that are defined in the ",(0,i.kt)("inlineCode",{parentName:"p"},"kam")," repository."),(0,i.kt)("h2",{id:"lists-and-maps"},"Lists and maps"),(0,i.kt)("p",null,"Lists are represented using the ",(0,i.kt)("inlineCode",{parentName:"p"},"[]")," notation.\nAn example of lists:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"list0 = [1, 2, 3]\nlist1 = [4, 5, 6]\njoined_list = list0 + list1 # [1, 2, 3, 4, 5, 6]\n")),(0,i.kt)("p",null,"Maps are represented using the ",(0,i.kt)("inlineCode",{parentName:"p"},"{}")," notation.\nAn example of maps:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"a = {\"one\" = 1, \"two\" = 2, \"three\" = 3}\nb = {'one' = 1, 'two' = 2, 'three' = 3}\nassert a == b # True\nassert len(a) == 3 # True\n")),(0,i.kt)("h2",{id:"conditional-statements"},"Conditional statements"),(0,i.kt)("p",null,"You can also use basic control flow statements when writing the configuration file."),(0,i.kt)("p",null,"An example that sets the value of ",(0,i.kt)("inlineCode",{parentName:"p"},"replicas")," conditionally based on the value of ",(0,i.kt)("inlineCode",{parentName:"p"},"containers.myapp.resources.cpu"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\n\nmyapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: ""\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1 if containers.myapp.resources.cpu == "500m" else 2\n }\n}\n')),(0,i.kt)("p",null,"For more details on KCL's control flow statements, please refer to the ",(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/reference/lang/tour#control-flow-statements"},"KCL documentation"),"."),(0,i.kt)("h2",{id:"the--and--operator"},"The ",(0,i.kt)("inlineCode",{parentName:"h2"},":")," and ",(0,i.kt)("inlineCode",{parentName:"h2"},"=")," operator"),(0,i.kt)("p",null,"You might have noticed there is a mixed usage of the ",(0,i.kt)("inlineCode",{parentName:"p"},":")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," in the samples above."),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("strong",{parentName:"p"},"TLDR: The recommendation is to use ",(0,i.kt)("inlineCode",{parentName:"strong"},":")," in the common configurations, and ",(0,i.kt)("inlineCode",{parentName:"strong"},"=")," for override in the environment-specific configurations."))),(0,i.kt)("p",null,"In KCL:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},":")," represents a union-ed value assignment. In the pattern ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier: E")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier: T E"),", the value of the expression ",(0,i.kt)("inlineCode",{parentName:"li"},"E")," with optional type annotation ",(0,i.kt)("inlineCode",{parentName:"li"},"T")," will be merged and union-ed into the element value."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"=")," represents a value override. In the pattern ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier = E")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier = T E"),", The value of the expression ",(0,i.kt)("inlineCode",{parentName:"li"},"E")," with optional type annotation ",(0,i.kt)("inlineCode",{parentName:"li"},"T")," will override the ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier")," attribute value.")),(0,i.kt)("p",null,"Let's take a look at an example:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"# This is one configuration that will be merged.\nconfig: Config {\n data.d1 = 1\n}\n# This is another configuration that will be merged.\nconfig: Config {\n data.d2 = 2\n}\n")),(0,i.kt)("p",null,"The above is equivalent to the snippet below since the two expressions for ",(0,i.kt)("inlineCode",{parentName:"p"},"config")," get merged/union-ed into one:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"config: Config {\n data.d1 = 1\n data.d2 = 1\n}\n")),(0,i.kt)("p",null,"whereas using the ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operators will result in a different outcome:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"# This is first configuration.\nconfig = Config {\n data.d1 = 1\n}\n# This is second configuration that will override the prior one.\nconfig = Config {\n data.d2 = 2\n}\n")),(0,i.kt)("p",null,"The config above results in:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"config: Config {\n data.d2 = 2\n}\n")),(0,i.kt)("p",null,"Please note that the ",(0,i.kt)("inlineCode",{parentName:"p"},":")," attribute operator represents an idempotent merge operation, and an error will be thrown when the values that need to be merged conflict with each other."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"data0 = {id: 1} | {id: 2} # Error\uff1aconflicting values between {'id': 2} and {'id': 1}\ndata1 = {id: 1} | {id = 2} # Ok, the value of `data` is {\"id\": 2}\n")),(0,i.kt)("p",null,"More about ",(0,i.kt)("inlineCode",{parentName:"p"},":")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operator can be found in the ",(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/reference/lang/tour#config-operations"},"KCL documentation"),"."),(0,i.kt)("h2",{id:"advanced-kcl-capabilities"},"Advanced KCL capabilities"),(0,i.kt)("p",null,"For more advanced KCL capabilities, please visit the ",(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/user_docs/support/faq-kcl"},"KCL website"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/97d4b178.28fad91d.js b/assets/js/97d4b178.28fad91d.js deleted file mode 100644 index 9b36f3a0114..00000000000 --- a/assets/js/97d4b178.28fad91d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5644],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},d=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,p=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=s(n),m=i,k=u["".concat(p,".").concat(m)]||u[m]||c[m]||o;return n?a.createElement(k,r(r({ref:t},d),{},{components:n})):a.createElement(k,r({ref:t},d))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,r=new Array(o);r[0]=u;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>r,default:()=>c,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var a=n(87462),i=(n(67294),n(3905));const o={id:"kcl-basics"},r="KCL Basics",l={unversionedId:"configuration-walkthrough/kcl-basics",id:"configuration-walkthrough/kcl-basics",title:"KCL Basics",description:"Table of Content",source:"@site/docs/kusion/4-configuration-walkthrough/2-kcl-basics.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/kcl-basics",permalink:"/docs/next/configuration-walkthrough/kcl-basics",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/4-configuration-walkthrough/2-kcl-basics.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"kcl-basics"},sidebar:"kusion",previous:{title:"Configuration File Overview",permalink:"/docs/next/configuration-walkthrough/overview"},next:{title:"Base and Override",permalink:"/docs/next/configuration-walkthrough/base-override"}},p={},s=[{value:"Table of Content",id:"table-of-content",level:2},{value:"Variable assignments",id:"variable-assignments",level:2},{value:"Common built-in types",id:"common-built-in-types",level:2},{value:"Lists and maps",id:"lists-and-maps",level:2},{value:"Conditional statements",id:"conditional-statements",level:2},{value:"The : and = operator",id:"the--and--operator",level:2},{value:"Advanced KCL capabilities",id:"advanced-kcl-capabilities",level:2}],d={toc:s};function c(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"kcl-basics"},"KCL Basics"),(0,i.kt)("h2",{id:"table-of-content"},"Table of Content"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#variable-assignments"},"Variable assignments")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#common-built-in-types"},"Common built-in types")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#lists-and-maps"},"Lists and maps")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#conditional-statements"},"Conditional statements")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#the--and--operator"},"The : and = operator")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#advanced-kcl-capabilities"},"Advanced KCL capabilities"))),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/"},"KCL")," is the choice of configuration language consumed by Kusion. KCL is an open source constraint-based record and functional language. KCL works well with a large number of complex configurations via modern programming language technology and practice, and is committed to provide better modularity, scalability, stability and extensibility."),(0,i.kt)("h2",{id:"variable-assignments"},"Variable assignments"),(0,i.kt)("p",null,"There are two ways to initialize a variable in KCL. You can either use the ",(0,i.kt)("inlineCode",{parentName:"p"},":")," operator or the ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operator. We will discuss the difference between them in ",(0,i.kt)("a",{parentName:"p",href:"#the--and--operator"},"this section later"),"."),(0,i.kt)("p",null,"Here are the two ways to create a variable and initialize it:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'foo = "Foo" # Declare a variable named `foo` and its value is a string literal "Foo"\nbar: "Bar" # Declare a variable named `bar` and its value is a string literal "Bar"\n')),(0,i.kt)("p",null,"You will be able to override a variable assignment via the ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operator. We will discuss this in depth in the ",(0,i.kt)("a",{parentName:"p",href:"#the--and--operator"},(0,i.kt)("inlineCode",{parentName:"a"},":")," and ",(0,i.kt)("inlineCode",{parentName:"a"},"=")," operator section"),"."),(0,i.kt)("h2",{id:"common-built-in-types"},"Common built-in types"),(0,i.kt)("p",null,"KCL supports ",(0,i.kt)("inlineCode",{parentName:"p"},"int"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"float"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"bool")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"string")," as the built-in types."),(0,i.kt)("p",null,"Other types are defined in the packages that are imported into the application configuration files. One such example would be the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," object (or ",(0,i.kt)("inlineCode",{parentName:"p"},"Container"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Probe"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Port")," object, etc) that are defined in the ",(0,i.kt)("inlineCode",{parentName:"p"},"kam")," repository."),(0,i.kt)("h2",{id:"lists-and-maps"},"Lists and maps"),(0,i.kt)("p",null,"Lists are represented using the ",(0,i.kt)("inlineCode",{parentName:"p"},"[]")," notation.\nAn example of lists:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"list0 = [1, 2, 3]\nlist1 = [4, 5, 6]\njoined_list = list0 + list1 # [1, 2, 3, 4, 5, 6]\n")),(0,i.kt)("p",null,"Maps are represented using the ",(0,i.kt)("inlineCode",{parentName:"p"},"{}")," notation.\nAn example of maps:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"a = {\"one\" = 1, \"two\" = 2, \"three\" = 3}\nb = {'one' = 1, 'two' = 2, 'three' = 3}\nassert a == b # True\nassert len(a) == 3 # True\n")),(0,i.kt)("h2",{id:"conditional-statements"},"Conditional statements"),(0,i.kt)("p",null,"You can also use basic control flow statements when writing the configuration file."),(0,i.kt)("p",null,"An example that sets the value of ",(0,i.kt)("inlineCode",{parentName:"p"},"replicas")," conditionally based on the value of ",(0,i.kt)("inlineCode",{parentName:"p"},"containers.myapp.resources.cpu"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\n\nmyapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: ""\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1 if containers.myapp.resources.cpu == "500m" else 2\n }\n}\n')),(0,i.kt)("p",null,"For more details on KCL's control flow statements, please refer to the ",(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/reference/lang/tour#control-flow-statements"},"KCL documentation"),"."),(0,i.kt)("h2",{id:"the--and--operator"},"The ",(0,i.kt)("inlineCode",{parentName:"h2"},":")," and ",(0,i.kt)("inlineCode",{parentName:"h2"},"=")," operator"),(0,i.kt)("p",null,"You might have noticed there is a mixed usage of the ",(0,i.kt)("inlineCode",{parentName:"p"},":")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," in the samples above."),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("strong",{parentName:"p"},"TLDR: The recommendation is to use ",(0,i.kt)("inlineCode",{parentName:"strong"},":")," in the common configurations, and ",(0,i.kt)("inlineCode",{parentName:"strong"},"=")," for override in the environment-specific configurations."))),(0,i.kt)("p",null,"In KCL:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},":")," represents a union-ed value assignment. In the pattern ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier: E")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier: T E"),", the value of the expression ",(0,i.kt)("inlineCode",{parentName:"li"},"E")," with optional type annotation ",(0,i.kt)("inlineCode",{parentName:"li"},"T")," will be merged and union-ed into the element value."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"=")," represents a value override. In the pattern ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier = E")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier = T E"),", The value of the expression ",(0,i.kt)("inlineCode",{parentName:"li"},"E")," with optional type annotation ",(0,i.kt)("inlineCode",{parentName:"li"},"T")," will override the ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier")," attribute value.")),(0,i.kt)("p",null,"Let's take a look at an example:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"# This is one configuration that will be merged.\nconfig: Config {\n data.d1 = 1\n}\n# This is another configuration that will be merged.\nconfig: Config {\n data.d2 = 2\n}\n")),(0,i.kt)("p",null,"The above is equivalent to the snippet below since the two expressions for ",(0,i.kt)("inlineCode",{parentName:"p"},"config")," get merged/union-ed into one:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"config: Config {\n data.d1 = 1\n data.d2 = 1\n}\n")),(0,i.kt)("p",null,"whereas using the ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operators will result in a different outcome:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"# This is first configuration.\nconfig = Config {\n data.d1 = 1\n}\n# This is second configuration that will override the prior one.\nconfig = Config {\n data.d2 = 2\n}\n")),(0,i.kt)("p",null,"The config above results in:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"config: Config {\n data.d2 = 2\n}\n")),(0,i.kt)("p",null,"Please note that the ",(0,i.kt)("inlineCode",{parentName:"p"},":")," attribute operator represents an idempotent merge operation, and an error will be thrown when the values that need to be merged conflict with each other."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"data0 = {id: 1} | {id: 2} # Error\uff1aconflicting values between {'id': 2} and {'id': 1}\ndata1 = {id: 1} | {id = 2} # Ok, the value of `data` is {\"id\": 2}\n")),(0,i.kt)("p",null,"More about ",(0,i.kt)("inlineCode",{parentName:"p"},":")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operator can be found in the ",(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/reference/lang/tour#config-operations"},"KCL documentation"),"."),(0,i.kt)("h2",{id:"advanced-kcl-capabilities"},"Advanced KCL capabilities"),(0,i.kt)("p",null,"For more advanced KCL capabilities, please visit the ",(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/user_docs/support/faq-kcl"},"KCL website"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/98c2782f.61de7134.js b/assets/js/98c2782f.61de7134.js new file mode 100644 index 00000000000..779f151c3aa --- /dev/null +++ b/assets/js/98c2782f.61de7134.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2984],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>u});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),d=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},s=function(e){var t=d(e.components);return a.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),m=d(n),u=r,k=m["".concat(p,".").concat(u)]||m[u]||c[u]||l;return n?a.createElement(k,o(o({ref:t},s),{},{components:n})):a.createElement(k,o({ref:t},s))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,o=new Array(l);o[0]=m;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:r,o[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>c,frontMatter:()=>l,metadata:()=>i,toc:()=>d});var a=n(87462),r=(n(67294),n(3905));const l={},o="probe",i={unversionedId:"reference/modules/catalog-models/internal/container/probe/probe",id:"version-v0.10/reference/modules/catalog-models/internal/container/probe/probe",title:"probe",description:"Schema Probe",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/container/probe/probe.md",sourceDirName:"6-reference/2-modules/1-catalog-models/internal/container/probe",slug:"/reference/modules/catalog-models/internal/container/probe/",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/container/probe/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/container/probe/probe.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"lifecycle",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/container/lifecycle/"},next:{title:"port",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/network/port"}},p={},d=[{value:"Schema Probe",id:"schema-probe",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Schema Exec",id:"schema-exec",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3},{value:"Schema Http",id:"schema-http",level:2},{value:"Attributes",id:"attributes-2",level:3},{value:"Examples",id:"examples-2",level:3},{value:"Schema Tcp",id:"schema-tcp",level:2},{value:"Attributes",id:"attributes-3",level:3},{value:"Examples",id:"examples-3",level:3}],s={toc:d};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"probe"},"probe"),(0,r.kt)("h2",{id:"schema-probe"},"Schema Probe"),(0,r.kt)("p",null,"Probe describes a health check to be performed against a container to determine whether it is",(0,r.kt)("br",null),"alive or ready to receive traffic. There are three probe types: readiness, liveness, and startup."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"probeHandler"),(0,r.kt)("br",null),"The action taken to determine the alive or health of a container"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-tcp"},"probe.Tcp")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"initialDelaySeconds"),(0,r.kt)("br",null),"The number of seconds before health checking is activated.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle%5C#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle\\#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"timeoutSeconds"),(0,r.kt)("br",null),"The number of seconds after which the probe times out.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle%5C#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle\\#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"periodSeconds"),(0,r.kt)("br",null),"How often (in seconds) to perform the probe."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"successThreshold"),(0,r.kt)("br",null),"Minimum consecutive successes for the probe to be considered successful after having failed."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"failureThreshold"),(0,r.kt)("br",null),"Minimum consecutive failures for the probe to be considered failed after having succeeded."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"terminationGracePeriod")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nprobe = p.Probe {\n probeHandler: p.Http {\n path: "/healthz"\n }\n initialDelaySeconds: 10\n}\n')),(0,r.kt)("h2",{id:"schema-exec"},"Schema Exec"),(0,r.kt)("p",null,'Exec describes a "run in container" action.'),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command"),(0,r.kt)("br",null),"The command line to execute inside the container."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nexecProbe = p.Exec {\n command: ["probe.sh"]\n}\n')),(0,r.kt)("h2",{id:"schema-http"},"Schema Http"),(0,r.kt)("p",null,"Http describes an action based on HTTP Get requests."),(0,r.kt)("h3",{id:"attributes-2"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url"),(0,r.kt)("br",null),"The full qualified url to send HTTP requests."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"headers"),(0,r.kt)("br",null),"Collection of custom headers to set in the request"),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-2"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nhttpProbe = p.Http {\n url: "http://localhost:80"\n headers: {\n "X-HEADER": "VALUE"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-tcp"},"Schema Tcp"),(0,r.kt)("p",null,"Tcp describes an action based on opening a socket."),(0,r.kt)("h3",{id:"attributes-3"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url"),(0,r.kt)("br",null),"The full qualified url to open a socket."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-3"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\ntcpProbe = p.Tcp {\n url: "tcp://localhost:1234"\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/98c2782f.a19bf2ce.js b/assets/js/98c2782f.a19bf2ce.js deleted file mode 100644 index 5fd9d6609db..00000000000 --- a/assets/js/98c2782f.a19bf2ce.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2984],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>u});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),d=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},s=function(e){var t=d(e.components);return a.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,s=i(e,["components","mdxType","originalType","parentName"]),m=d(n),u=r,k=m["".concat(p,".").concat(u)]||m[u]||c[u]||l;return n?a.createElement(k,o(o({ref:t},s),{},{components:n})):a.createElement(k,o({ref:t},s))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,o=new Array(l);o[0]=m;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:r,o[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>c,frontMatter:()=>l,metadata:()=>i,toc:()=>d});var a=n(87462),r=(n(67294),n(3905));const l={},o="probe",i={unversionedId:"reference/modules/catalog-models/internal/container/probe/probe",id:"version-v0.10/reference/modules/catalog-models/internal/container/probe/probe",title:"probe",description:"Schema Probe",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/container/probe/probe.md",sourceDirName:"6-reference/2-modules/1-catalog-models/internal/container/probe",slug:"/reference/modules/catalog-models/internal/container/probe/",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/container/probe/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/container/probe/probe.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"lifecycle",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/container/lifecycle/"},next:{title:"port",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/network/port"}},p={},d=[{value:"Schema Probe",id:"schema-probe",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Schema Exec",id:"schema-exec",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3},{value:"Schema Http",id:"schema-http",level:2},{value:"Attributes",id:"attributes-2",level:3},{value:"Examples",id:"examples-2",level:3},{value:"Schema Tcp",id:"schema-tcp",level:2},{value:"Attributes",id:"attributes-3",level:3},{value:"Examples",id:"examples-3",level:3}],s={toc:d};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"probe"},"probe"),(0,r.kt)("h2",{id:"schema-probe"},"Schema Probe"),(0,r.kt)("p",null,"Probe describes a health check to be performed against a container to determine whether it is",(0,r.kt)("br",null),"alive or ready to receive traffic. There are three probe types: readiness, liveness, and startup."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"probeHandler"),(0,r.kt)("br",null),"The action taken to determine the alive or health of a container"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-tcp"},"probe.Tcp")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"initialDelaySeconds"),(0,r.kt)("br",null),"The number of seconds before health checking is activated.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle%5C#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle\\#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"timeoutSeconds"),(0,r.kt)("br",null),"The number of seconds after which the probe times out.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle%5C#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle\\#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"periodSeconds"),(0,r.kt)("br",null),"How often (in seconds) to perform the probe."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"successThreshold"),(0,r.kt)("br",null),"Minimum consecutive successes for the probe to be considered successful after having failed."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"failureThreshold"),(0,r.kt)("br",null),"Minimum consecutive failures for the probe to be considered failed after having succeeded."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"terminationGracePeriod")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nprobe = p.Probe {\n probeHandler: p.Http {\n path: "/healthz"\n }\n initialDelaySeconds: 10\n}\n')),(0,r.kt)("h2",{id:"schema-exec"},"Schema Exec"),(0,r.kt)("p",null,'Exec describes a "run in container" action.'),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command"),(0,r.kt)("br",null),"The command line to execute inside the container."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nexecProbe = p.Exec {\n command: ["probe.sh"]\n}\n')),(0,r.kt)("h2",{id:"schema-http"},"Schema Http"),(0,r.kt)("p",null,"Http describes an action based on HTTP Get requests."),(0,r.kt)("h3",{id:"attributes-2"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url"),(0,r.kt)("br",null),"The full qualified url to send HTTP requests."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"headers"),(0,r.kt)("br",null),"Collection of custom headers to set in the request"),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-2"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nhttpProbe = p.Http {\n url: "http://localhost:80"\n headers: {\n "X-HEADER": "VALUE"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-tcp"},"Schema Tcp"),(0,r.kt)("p",null,"Tcp describes an action based on opening a socket."),(0,r.kt)("h3",{id:"attributes-3"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url"),(0,r.kt)("br",null),"The full qualified url to open a socket."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-3"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\ntcpProbe = p.Tcp {\n url: "tcp://localhost:1234"\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/992984a1.ceaf33a6.js b/assets/js/992984a1.02a7186d.js similarity index 54% rename from assets/js/992984a1.ceaf33a6.js rename to assets/js/992984a1.02a7186d.js index f6f7a22ab98..c791952b16a 100644 --- a/assets/js/992984a1.ceaf33a6.js +++ b/assets/js/992984a1.02a7186d.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8767],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),c=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=c(e.components);return n.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),d=c(r),f=o,m=d["".concat(p,".").concat(f)]||d[f]||u[f]||a;return r?n.createElement(m,i(i({ref:t},l),{},{components:r})):n.createElement(m,i({ref:t},l))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=d;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var c=2;c{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>c});var n=r(87462),o=(r(67294),r(3905));const a={},i="kusion workspace update",s={unversionedId:"reference/commands/kusion-workspace-update",id:"version-v0.10/reference/commands/kusion-workspace-update",title:"kusion workspace update",description:"Update a workspace configuration",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace-update.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-update",permalink:"/docs/v0.10/reference/commands/kusion-workspace-update",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace-update.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace show",permalink:"/docs/v0.10/reference/commands/kusion-workspace-show"},next:{title:"kusion workspace",permalink:"/docs/v0.10/reference/commands/kusion-workspace"}},p={},c=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],l={toc:c};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-update"},"kusion workspace update"),(0,o.kt)("p",null,"Update a workspace configuration"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command updates a workspace configuration with specified configuration file, where the file must be in the YAML format."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace update\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Update a workspace configuration\n kusion workspace update dev -f dev.yaml\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -f, --file string the path of workspace configuration file\n -h, --help help for update\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8767],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),c=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=c(e.components);return n.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),d=c(r),f=o,m=d["".concat(p,".").concat(f)]||d[f]||u[f]||a;return r?n.createElement(m,i(i({ref:t},l),{},{components:r})):n.createElement(m,i({ref:t},l))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=d;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var c=2;c{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>c});var n=r(87462),o=(r(67294),r(3905));const a={},i="kusion workspace update",s={unversionedId:"reference/commands/kusion-workspace-update",id:"version-v0.10/reference/commands/kusion-workspace-update",title:"kusion workspace update",description:"Update a workspace configuration",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace-update.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-update",permalink:"/docs/v0.10/reference/commands/kusion-workspace-update",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace-update.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace show",permalink:"/docs/v0.10/reference/commands/kusion-workspace-show"},next:{title:"kusion workspace",permalink:"/docs/v0.10/reference/commands/kusion-workspace"}},p={},c=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],l={toc:c};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-update"},"kusion workspace update"),(0,o.kt)("p",null,"Update a workspace configuration"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command updates a workspace configuration with specified configuration file, where the file must be in the YAML format."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace update\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Update a workspace configuration\n kusion workspace update dev -f dev.yaml\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -f, --file string the path of workspace configuration file\n -h, --help help for update\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/99c9a9f3.90422214.js b/assets/js/99c9a9f3.90422214.js new file mode 100644 index 00000000000..f1c63cc20e7 --- /dev/null +++ b/assets/js/99c9a9f3.90422214.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1930],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>k});var n=a(67294);function o(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function r(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(o[a]=e[a]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(o[a]=e[a])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var a=e.components,o=e.mdxType,r=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=p(a),k=o,h=u["".concat(l,".").concat(k)]||u[k]||d[k]||r;return a?n.createElement(h,i(i({ref:t},c),{},{components:a})):n.createElement(h,i({ref:t},c))}));function k(e,t){var a=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=a.length,i=new Array(r);i[0]=u;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var p=2;p{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>r,metadata:()=>s,toc:()=>p});var n=a(87462),o=(a(67294),a(3905));const r={id:"workspace",sidebar_label:"Workspace"},i="Workspace",s={unversionedId:"concepts/workspace",id:"version-v0.11/concepts/workspace",title:"Workspace",description:"Workspace is a logical concept that maps to an actual target environment to deploy a stack to. In today's context, this usually represents a Kubernetes cluster for the application workload and an optional cloud account to provision infrastructure resources that the workload depends on (A database, for example). Aside from the deployment destination, workspaces are also designed to be associated with a series of platform configurations that are used by all the stacks deployed to said workspace.",source:"@site/docs_versioned_docs/version-v0.11/3-concepts/4-workspace.md",sourceDirName:"3-concepts",slug:"/concepts/workspace",permalink:"/docs/concepts/workspace",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/3-concepts/4-workspace.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:4,frontMatter:{id:"workspace",sidebar_label:"Workspace"},sidebar:"kusion",previous:{title:"Application Developer User Guide",permalink:"/docs/concepts/kusion-module/app-dev-guide"},next:{title:"AppConfiguration",permalink:"/docs/concepts/app-configuration"}},l={},p=[{value:"Workspace Configuration",id:"workspace-configuration",level:2},{value:"modules",id:"modules",level:3},{value:"runtimes",id:"runtimes",level:3},{value:"Managing Workspace",id:"managing-workspace",level:2},{value:"Creating Workspace",id:"creating-workspace",level:3},{value:"Listing Workspace",id:"listing-workspace",level:3},{value:"Switching Workspace",id:"switching-workspace",level:3},{value:"Showing Workspace",id:"showing-workspace",level:3},{value:"Updating Workspace",id:"updating-workspace",level:3},{value:"Deleting Workspace",id:"deleting-workspace",level:3},{value:"Using Workspace",id:"using-workspace",level:2}],c={toc:p};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"workspace"},"Workspace"),(0,o.kt)("p",null,"Workspace is a logical concept that maps to an actual target environment to deploy a stack to. In today's context, this ",(0,o.kt)("em",{parentName:"p"},"usually")," represents a Kubernetes cluster for the application workload and an optional cloud account to provision infrastructure resources that the workload depends on (A database, for example). Aside from the deployment destination, workspaces are also designed to be associated with a series of platform configurations that are used by all the stacks deployed to said workspace."),(0,o.kt)("p",null,"When executing the command ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion generate"),', Kusion will "match" the AppConfiguration and the approriate workspace configuration to dynamically generate the ',(0,o.kt)("inlineCode",{parentName:"p"},"Spec"),", which contains the complete manifest to describe the resources in the stack. The relationship of the Project, Stack and Workspace is shown as below. Notice that all three ways to organize stacks are valid."),(0,o.kt)("p",null,(0,o.kt)("img",{alt:"project-stack-workspace",src:a(3682).Z,width:"1572",height:"1006"})),(0,o.kt)("p",null,'Workspace is designed to address separation of concerns. As opposed to the development-time concept of a "stack", a workspace is a deploy-time concept that represents a deployment target, a.k.a an actual runtime environment. Workspaces should be entirely managed by Platform Engineers to alleviate the burden on developers to understand environment-specific details.'),(0,o.kt)("p",null,"To dig a little deeper, a workspace represents the need for a distinct set of \"platform opinions\". That includes things that application developer either don't want to or shouldn't need to worry about, such as which Kubernetes cluster to deploy to, the credentials to deploy to said clusters, and other infrastructure details like what database instance to provision."),(0,o.kt)("p",null,"Workspace is intended to be flexible so you can map them as your see fit to the boundaries that are relevant to your use case. For example, you can map a workspace to a cloud region (aws-us-east-1), provided that regional isolation is sufficient for you (this is an extreme case). Alternatively, a workspace can be map to the combination of a cloud region and an SDLC phase (aws-dev-us-east-1), provided that it represents the right boundary from a platform perspective."),(0,o.kt)("p",null,"The workspace configuration is in a deterministic format and currently written in YAML. The subcommands of ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace")," are provided to manage the workspaces. When using ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace"),", the workspace configuration will be saved as YAML file in local file system. To avoid the possible risks, the environment variables are provided to hold the sensitive data such as Access Keys and Secret keys."),(0,o.kt)("h2",{id:"workspace-configuration"},"Workspace Configuration"),(0,o.kt)("p",null,"The configuration of a Workspace is stored in a single YAML file, which consists of ",(0,o.kt)("inlineCode",{parentName:"p"},"modules")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"runtimes"),". An example of Workspace configuration is shown as below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-yaml"},"# The platform configuration for Modules or KAMs.\n# For each Module or KAM, the configuration format is as below. \n# # ${module_identifier} or ${KAM_name}:\n# # default: # default configuration, applied to all projects\n# # ${field1}: ${value1}\n# # #{field2}: ${value2}\n# # ...\n# # ${patcher_name}: #patcher configuration, applied to the projects assigned in projectSelector\n# # ${field1}: ${value1_override}\n# # ...\n# # projectSelector:\n# # - ${project1_name}\n# # - ${project2_name}\n# # ...\nmodules:\n kusionstack/mysql@0.1.0:\n default:\n cloud: alicloud\n size: 20\n instanceType: mysql.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: ${mysql_subnet_id}\n databaseName: kusion\n largeSize:\n size: 50\n projectSelector:\n - foo\n - bar\n \n# The configuration of Runtimes, support Kubernetes and Terraform.\n# For each Runtime, the configuration format is as below.\n# # ${runtime_name}:\n# # ${field1}: ${value1}\n# # ${field2}: ${value2}\n# # ...\nruntimes:\n kubernetes:\n kubeConfig: /etc/kubeconfig.yaml\n terraform:\n aws:\n version: 1.0.4\n source: hashicorp/aws\n region: us-east-1\n")),(0,o.kt)("h3",{id:"modules"},"modules"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"modules")," are the platform-part configurations of Modules and KAMs, where the identifier of them are ",(0,o.kt)("inlineCode",{parentName:"p"},"${namespace}/${module_name}@${module_tag}")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"${kam_name}"),". For each Module or KAM configuration, it is composed of a ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," and several ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher")," blocks. The ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," block contains the universal configuration of the Workspace, and can be applied to all Stacks in the Workspace, which is composed of the values of the Module's or KAM's fields. The ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher")," block contains the exclusive configuration for certain Stacks, which includes not only the fields' values, but also the applied Projects."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher")," block is designed to increase the flexibility for platform engineers managing Workspaces. Cause the Workspace should map to the real physical environment, in the actual production practice, it's almost impossible that all the Stacks share the same platform configuration, although we want them the same. "),(0,o.kt)("p",null,"The values of the same fields in ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher")," will override the ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", and one field in multiple patchers is forbidden to assign to the same Project. That is, if there are more than one ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher")," declaring the same field with different values, the applied Projects are prohibited to overlap. And, The name of ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher")," must not be ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),"."),(0,o.kt)("p",null,"In the ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher"),", the applied Projects are assigned by the field ",(0,o.kt)("inlineCode",{parentName:"p"},"ProjectSelector"),", which is an array of the Project names. The ",(0,o.kt)("inlineCode",{parentName:"p"},"ProjectSelector")," is provided rather than something may like ",(0,o.kt)("inlineCode",{parentName:"p"},"StackSelector"),', which specifies the applied Stacks. Here are the reasons. Explaining from the perspective of using Workspace, the mapping of Workspace and Stack is specified by the Kusion operation commands\' users. While explaining from the perspective of the relationship among Project, Stack and Workspace, Workspace is designed for the reuse of platform-level configuration among multiple Projects. When a Project "encounters" a Workspace, it becomes a "Stack instance", which can be applied to a series of real resources. If using something like ',(0,o.kt)("inlineCode",{parentName:"p"},"StackSelector"),", the reuse would not get realized, and Workspace would also lose its relevance. For more information of the relationship, please refer to ",(0,o.kt)("a",{parentName:"p",href:"project/overview"},"Project")," and ",(0,o.kt)("a",{parentName:"p",href:"stack/overview"},"Stack"),". "),(0,o.kt)("p",null,"Different Module and KAM has different name, fields, and corresponding format and restrictions. When writing the configuration, check the corresponding Module's or KAM's description, and make sure all the requisite Modules and KAMs have correctly configured. Please refer to ",(0,o.kt)("a",{parentName:"p",href:"kusion-module/overview"},"Kuiosn Module")," and find more information. The example above gives a sample of the Module ",(0,o.kt)("inlineCode",{parentName:"p"},"mysql"),"."),(0,o.kt)("h3",{id:"runtimes"},"runtimes"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"runtimes")," are the interface that Kusion interacts with the real infrastructure, which are only configured by the platform engineers in Workspace. Kusion supports the runtimes ",(0,o.kt)("inlineCode",{parentName:"p"},"Kubernetes")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Terraform")," for now."),(0,o.kt)("p",null,"For ",(0,o.kt)("inlineCode",{parentName:"p"},"Kubernetes")," runtime, the path of the KubeConfig file is provided to configure, which is specified by the filed ",(0,o.kt)("inlineCode",{parentName:"p"},"kubeConfig"),". Besides, the environment variable ",(0,o.kt)("inlineCode",{parentName:"p"},"KUBECONFIG")," is also supported with higher priority. If both not set, the default path ",(0,o.kt)("inlineCode",{parentName:"p"},"$HOME/.kube/config")," will be used. For the example above, the ",(0,o.kt)("inlineCode",{parentName:"p"},"kubeConfig")," is set in the workspace configuration."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"Terraform")," runtime is composed of multiple Terraform providers' configurations, where the key is the provider name, and the values varies across different providers. For the configuration fields, Kusion keeps the same with Terraform, including the supported environment variables. Please refer to ",(0,o.kt)("a",{parentName:"p",href:"https://registry.terraform.io/"},"Terraform Registry")," and find more information. For the example above, a sample of aws runtime configuration is given, while the ",(0,o.kt)("inlineCode",{parentName:"p"},"access_key")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"access_secret")," is not set in the Workspace file, and expected setting by the environment variables ",(0,o.kt)("inlineCode",{parentName:"p"},"AWS_ACCESS_KEY_ID")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"AWS_SECRET_ACCESS_KEY"),"."),(0,o.kt)("h2",{id:"managing-workspace"},"Managing Workspace"),(0,o.kt)("p",null,"The subcommands of ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace")," are used to manage Workspaces, including ",(0,o.kt)("inlineCode",{parentName:"p"},"create"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"show"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"list"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"switch"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"update")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"delete"),". Cause the Workspace configurations are stored persistently, the current or a specified Backend will be used. For more information of Backend, please refer to ",(0,o.kt)("a",{parentName:"p",href:"backend"},"Backend"),"."),(0,o.kt)("p",null,"Kusion will create a ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," Workspace with empty configuration in every Backend automatically, and set it as the current. When first using Kusion, or no configuration of Workspace, the ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," Workspace will be used. "),(0,o.kt)("h3",{id:"creating-workspace"},"Creating Workspace"),(0,o.kt)("p",null,"Use ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace create ${name} -f ${configuration_file_path}")," to create a new Workspace with the configuration in a YAML file. The Workspace is identified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"name"),", and must be a new one, while the configuration must be written in a YAML file with correct format. "),(0,o.kt)("p",null,"The command above will create the Workspace in current Backend. If to create a Workspace in another backend, please use flag ",(0,o.kt)("inlineCode",{parentName:"p"},"--backend")," to specify. The Workspace names in a Backend must be different, but allow the same in different Backends."),(0,o.kt)("p",null,"In some scenarios, when a Workspace is created, it is expected to be the current. For simplification, the flag ",(0,o.kt)("inlineCode",{parentName:"p"},"--current")," is provided to set the Workspace current alongside the creation."),(0,o.kt)("p",null,"Be attention, creating ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," Workspace is not allowed, because it's created by Kusion automatically."),(0,o.kt)("p",null,"The example is shown as below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"# create a workspace in current backend\nkusion workspace create dev -f dev.yaml\n\n# create a workspace in current backend ans set it as current\nkusion workspace create dev -f dev.yaml --current\n\n# create a workspace in specified backend\nkusion workspace create dev -f dev.yaml --backend oss-pre\n")),(0,o.kt)("p",null,"The Workspaces to create are decided by the platform engineers. We recommend that they are organized by the following rules:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"SDLC phases"),", such as ",(0,o.kt)("inlineCode",{parentName:"li"},"dev"),", ",(0,o.kt)("inlineCode",{parentName:"li"},"pre"),", ",(0,o.kt)("inlineCode",{parentName:"li"},"prod"),";"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"cloud vendors"),", such as ",(0,o.kt)("inlineCode",{parentName:"li"},"aws"),", ",(0,o.kt)("inlineCode",{parentName:"li"},"alicloud"),";"),(0,o.kt)("li",{parentName:"ul"},"combination of the two above, such as ",(0,o.kt)("inlineCode",{parentName:"li"},"dev-aws"),", ",(0,o.kt)("inlineCode",{parentName:"li"},"prod-alicloud"),".")),(0,o.kt)("p",null,"In design, Kusion does not support deploying Stack to multiple clouds or regions within a single Workspace. While users can technically define a Module that provisions resources across multiple clouds or regions, Kusion does not recommend this practice, and will not provide technical support for such configuration. If the platform engineers need to manage resources across multiple clouds or regions, they should create separate Workspaces."),(0,o.kt)("h3",{id:"listing-workspace"},"Listing Workspace"),(0,o.kt)("p",null,"Use ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace list")," to get all the workspace names."),(0,o.kt)("p",null,"The example is shown as below. In order to simplify, The following examples will not give using specified backend, which is supported by ",(0,o.kt)("inlineCode",{parentName:"p"},"--backend")," flag."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"# list all the workspace names\nkusion workspace list\n")),(0,o.kt)("h3",{id:"switching-workspace"},"Switching Workspace"),(0,o.kt)("p",null,"In order not to specify the Workspace name for each Kusion operation command, ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace switch ${name}")," is provided to switch the current Workspace. Then when executing ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion generate"),", the current Workspace will be used. The to-switch Workspace must be created."),(0,o.kt)("p",null,"The example is shown as below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"# switch workspace\nkusion workspace switch dev\n")),(0,o.kt)("h3",{id:"showing-workspace"},"Showing Workspace"),(0,o.kt)("p",null,"Use ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace show ${name}")," to get the Workspace configuration. If the ",(0,o.kt)("inlineCode",{parentName:"p"},"name")," is not specified, the configuration of current Workspace will get returned."),(0,o.kt)("p",null,"The example is shown as below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"# show a specified workspace configuration\nkusion workspace show dev\n\n# show the current workspace configuration\nkusion workspace show\n")),(0,o.kt)("h3",{id:"updating-workspace"},"Updating Workspace"),(0,o.kt)("p",null,"When the Workspace needs to update, use ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace update ${name} -f ${configuration_file_path}")," to update with the new configuration file. The whole updated configuration is asked to provide, and the Workspace must be created. Get the Workspace configuration first, then refresh the configuration and execute the command, which are the recommended steps. If the ",(0,o.kt)("inlineCode",{parentName:"p"},"name")," is not specified, the current Workspace will be used."),(0,o.kt)("p",null,"Updating the ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," Workspace is allowed. And the flag ",(0,o.kt)("inlineCode",{parentName:"p"},"--current")," is also supported to set it as the current."),(0,o.kt)("p",null,"The example is shown as below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"# update a specified workspace\nkusion workspace update dev -f dev_new.yaml\n\n# update a specified workspace and set it as current\nkusion workspace update dev -f dev_new.yaml --current\n\n# update the current workspace\nkusion workspace update -f dev_new.yaml\n")),(0,o.kt)("h3",{id:"deleting-workspace"},"Deleting Workspace"),(0,o.kt)("p",null,"When a Workspace is not in use anymore, use ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace delete ${name}")," to delete a Workspace. If the ",(0,o.kt)("inlineCode",{parentName:"p"},"name")," is not specified, the current Workspace will get deleted, and the ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," Workspace will be set as the current Workspace. Therefore, deleting the ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," Workspace is not allowed. "),(0,o.kt)("p",null,"The example is shown as below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"# delete a specified workspace\nkusion workspace delete dev \n\n# delete the current workspace\nkusion workspace delete\n")),(0,o.kt)("h2",{id:"using-workspace"},"Using Workspace"),(0,o.kt)("p",null,"Workspace is used in the command ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion generate"),", the following steps help smooth the operation process."),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"Write the Workspace configuration file with the format shown above, and fulfill all the necessary fields;"),(0,o.kt)("li",{parentName:"ol"},"Create the workspace with ",(0,o.kt)("inlineCode",{parentName:"li"},"kusion workspace create"),", then Kusion perceives the Workspace. The flag ",(0,o.kt)("inlineCode",{parentName:"li"},"--current")," can be used to set it as the current."),(0,o.kt)("li",{parentName:"ol"},"Execute ",(0,o.kt)("inlineCode",{parentName:"li"},"kusion generate")," in a Stack to generate the whole Spec, the AppConfiguration and Workspace configuration get rendered automatically, and can be applied to the real infrastructure. If the appointed Workspace or Backend is asked, the flags ",(0,o.kt)("inlineCode",{parentName:"li"},"--workspace")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"--backend")," will help achieve that. "),(0,o.kt)("li",{parentName:"ol"},"If the Workspace needs to update, delete, switch, etc. Use the above commands to achieve that.")))}d.isMDXComponent=!0},3682:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/project-stack-workspace-565b997b82d65f1f62a943184916c510.png"}}]); \ No newline at end of file diff --git a/assets/js/99c9a9f3.b1aedf2f.js b/assets/js/99c9a9f3.b1aedf2f.js deleted file mode 100644 index 3e31ba7517a..00000000000 --- a/assets/js/99c9a9f3.b1aedf2f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1930],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>k});var n=a(67294);function o(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function r(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(o[a]=e[a]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(o[a]=e[a])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var a=e.components,o=e.mdxType,r=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=p(a),k=o,h=u["".concat(l,".").concat(k)]||u[k]||d[k]||r;return a?n.createElement(h,i(i({ref:t},c),{},{components:a})):n.createElement(h,i({ref:t},c))}));function k(e,t){var a=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=a.length,i=new Array(r);i[0]=u;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var p=2;p{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>r,metadata:()=>s,toc:()=>p});var n=a(87462),o=(a(67294),a(3905));const r={id:"workspace",sidebar_label:"Workspace"},i="Workspace",s={unversionedId:"concepts/workspace",id:"version-v0.11/concepts/workspace",title:"Workspace",description:"Workspace is a logical concept that maps to an actual target environment to deploy a stack to. In today's context, this usually represents a Kubernetes cluster for the application workload and an optional cloud account to provision infrastructure resources that the workload depends on (A database, for example). Aside from the deployment destination, workspaces are also designed to be associated with a series of platform configurations that are used by all the stacks deployed to said workspace.",source:"@site/docs_versioned_docs/version-v0.11/3-concepts/4-workspace.md",sourceDirName:"3-concepts",slug:"/concepts/workspace",permalink:"/docs/concepts/workspace",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/3-concepts/4-workspace.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:4,frontMatter:{id:"workspace",sidebar_label:"Workspace"},sidebar:"kusion",previous:{title:"Application Developer User Guide",permalink:"/docs/concepts/kusion-module/app-dev-guide"},next:{title:"AppConfiguration",permalink:"/docs/concepts/app-configuration"}},l={},p=[{value:"Workspace Configuration",id:"workspace-configuration",level:2},{value:"modules",id:"modules",level:3},{value:"runtimes",id:"runtimes",level:3},{value:"Managing Workspace",id:"managing-workspace",level:2},{value:"Creating Workspace",id:"creating-workspace",level:3},{value:"Listing Workspace",id:"listing-workspace",level:3},{value:"Switching Workspace",id:"switching-workspace",level:3},{value:"Showing Workspace",id:"showing-workspace",level:3},{value:"Updating Workspace",id:"updating-workspace",level:3},{value:"Deleting Workspace",id:"deleting-workspace",level:3},{value:"Using Workspace",id:"using-workspace",level:2}],c={toc:p};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"workspace"},"Workspace"),(0,o.kt)("p",null,"Workspace is a logical concept that maps to an actual target environment to deploy a stack to. In today's context, this ",(0,o.kt)("em",{parentName:"p"},"usually")," represents a Kubernetes cluster for the application workload and an optional cloud account to provision infrastructure resources that the workload depends on (A database, for example). Aside from the deployment destination, workspaces are also designed to be associated with a series of platform configurations that are used by all the stacks deployed to said workspace."),(0,o.kt)("p",null,"When executing the command ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion generate"),', Kusion will "match" the AppConfiguration and the approriate workspace configuration to dynamically generate the ',(0,o.kt)("inlineCode",{parentName:"p"},"Spec"),", which contains the complete manifest to describe the resources in the stack. The relationship of the Project, Stack and Workspace is shown as below. Notice that all three ways to organize stacks are valid."),(0,o.kt)("p",null,(0,o.kt)("img",{alt:"project-stack-workspace",src:a(3682).Z,width:"1572",height:"1006"})),(0,o.kt)("p",null,'Workspace is designed to address separation of concerns. As opposed to the development-time concept of a "stack", a workspace is a deploy-time concept that represents a deployment target, a.k.a an actual runtime environment. Workspaces should be entirely managed by Platform Engineers to alleviate the burden on developers to understand environment-specific details.'),(0,o.kt)("p",null,"To dig a little deeper, a workspace represents the need for a distinct set of \"platform opinions\". That includes things that application developer either don't want to or shouldn't need to worry about, such as which Kubernetes cluster to deploy to, the credentials to deploy to said clusters, and other infrastructure details like what database instance to provision."),(0,o.kt)("p",null,"Workspace is intended to be flexible so you can map them as your see fit to the boundaries that are relevant to your use case. For example, you can map a workspace to a cloud region (aws-us-east-1), provided that regional isolation is sufficient for you (this is an extreme case). Alternatively, a workspace can be map to the combination of a cloud region and an SDLC phase (aws-dev-us-east-1), provided that it represents the right boundary from a platform perspective."),(0,o.kt)("p",null,"The workspace configuration is in a deterministic format and currently written in YAML. The subcommands of ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace")," are provided to manage the workspaces. When using ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace"),", the workspace configuration will be saved as YAML file in local file system. To avoid the possible risks, the environment variables are provided to hold the sensitive data such as Access Keys and Secret keys."),(0,o.kt)("h2",{id:"workspace-configuration"},"Workspace Configuration"),(0,o.kt)("p",null,"The configuration of a Workspace is stored in a single YAML file, which consists of ",(0,o.kt)("inlineCode",{parentName:"p"},"modules")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"runtimes"),". An example of Workspace configuration is shown as below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-yaml"},"# The platform configuration for Modules or KAMs.\n# For each Module or KAM, the configuration format is as below. \n# # ${module_identifier} or ${KAM_name}:\n# # default: # default configuration, applied to all projects\n# # ${field1}: ${value1}\n# # #{field2}: ${value2}\n# # ...\n# # ${patcher_name}: #patcher configuration, applied to the projects assigned in projectSelector\n# # ${field1}: ${value1_override}\n# # ...\n# # projectSelector:\n# # - ${project1_name}\n# # - ${project2_name}\n# # ...\nmodules:\n kusionstack/mysql@0.1.0:\n default:\n cloud: alicloud\n size: 20\n instanceType: mysql.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: ${mysql_subnet_id}\n databaseName: kusion\n largeSize:\n size: 50\n projectSelector:\n - foo\n - bar\n \n# The configuration of Runtimes, support Kubernetes and Terraform.\n# For each Runtime, the configuration format is as below.\n# # ${runtime_name}:\n# # ${field1}: ${value1}\n# # ${field2}: ${value2}\n# # ...\nruntimes:\n kubernetes:\n kubeConfig: /etc/kubeconfig.yaml\n terraform:\n aws:\n version: 1.0.4\n source: hashicorp/aws\n region: us-east-1\n")),(0,o.kt)("h3",{id:"modules"},"modules"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"modules")," are the platform-part configurations of Modules and KAMs, where the identifier of them are ",(0,o.kt)("inlineCode",{parentName:"p"},"${namespace}/${module_name}@${module_tag}")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"${kam_name}"),". For each Module or KAM configuration, it is composed of a ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," and several ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher")," blocks. The ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," block contains the universal configuration of the Workspace, and can be applied to all Stacks in the Workspace, which is composed of the values of the Module's or KAM's fields. The ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher")," block contains the exclusive configuration for certain Stacks, which includes not only the fields' values, but also the applied Projects."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher")," block is designed to increase the flexibility for platform engineers managing Workspaces. Cause the Workspace should map to the real physical environment, in the actual production practice, it's almost impossible that all the Stacks share the same platform configuration, although we want them the same. "),(0,o.kt)("p",null,"The values of the same fields in ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher")," will override the ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", and one field in multiple patchers is forbidden to assign to the same Project. That is, if there are more than one ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher")," declaring the same field with different values, the applied Projects are prohibited to overlap. And, The name of ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher")," must not be ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),"."),(0,o.kt)("p",null,"In the ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher"),", the applied Projects are assigned by the field ",(0,o.kt)("inlineCode",{parentName:"p"},"ProjectSelector"),", which is an array of the Project names. The ",(0,o.kt)("inlineCode",{parentName:"p"},"ProjectSelector")," is provided rather than something may like ",(0,o.kt)("inlineCode",{parentName:"p"},"StackSelector"),', which specifies the applied Stacks. Here are the reasons. Explaining from the perspective of using Workspace, the mapping of Workspace and Stack is specified by the Kusion operation commands\' users. While explaining from the perspective of the relationship among Project, Stack and Workspace, Workspace is designed for the reuse of platform-level configuration among multiple Projects. When a Project "encounters" a Workspace, it becomes a "Stack instance", which can be applied to a series of real resources. If using something like ',(0,o.kt)("inlineCode",{parentName:"p"},"StackSelector"),", the reuse would not get realized, and Workspace would also lose its relevance. For more information of the relationship, please refer to ",(0,o.kt)("a",{parentName:"p",href:"project/overview"},"Project")," and ",(0,o.kt)("a",{parentName:"p",href:"stack/overview"},"Stack"),". "),(0,o.kt)("p",null,"Different Module and KAM has different name, fields, and corresponding format and restrictions. When writing the configuration, check the corresponding Module's or KAM's description, and make sure all the requisite Modules and KAMs have correctly configured. Please refer to ",(0,o.kt)("a",{parentName:"p",href:"kusion-module/overview"},"Kuiosn Module")," and find more information. The example above gives a sample of the Module ",(0,o.kt)("inlineCode",{parentName:"p"},"mysql"),"."),(0,o.kt)("h3",{id:"runtimes"},"runtimes"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"runtimes")," are the interface that Kusion interacts with the real infrastructure, which are only configured by the platform engineers in Workspace. Kusion supports the runtimes ",(0,o.kt)("inlineCode",{parentName:"p"},"Kubernetes")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Terraform")," for now."),(0,o.kt)("p",null,"For ",(0,o.kt)("inlineCode",{parentName:"p"},"Kubernetes")," runtime, the path of the KubeConfig file is provided to configure, which is specified by the filed ",(0,o.kt)("inlineCode",{parentName:"p"},"kubeConfig"),". Besides, the environment variable ",(0,o.kt)("inlineCode",{parentName:"p"},"KUBECONFIG")," is also supported with higher priority. If both not set, the default path ",(0,o.kt)("inlineCode",{parentName:"p"},"$HOME/.kube/config")," will be used. For the example above, the ",(0,o.kt)("inlineCode",{parentName:"p"},"kubeConfig")," is set in the workspace configuration."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"Terraform")," runtime is composed of multiple Terraform providers' configurations, where the key is the provider name, and the values varies across different providers. For the configuration fields, Kusion keeps the same with Terraform, including the supported environment variables. Please refer to ",(0,o.kt)("a",{parentName:"p",href:"https://registry.terraform.io/"},"Terraform Registry")," and find more information. For the example above, a sample of aws runtime configuration is given, while the ",(0,o.kt)("inlineCode",{parentName:"p"},"access_key")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"access_secret")," is not set in the Workspace file, and expected setting by the environment variables ",(0,o.kt)("inlineCode",{parentName:"p"},"AWS_ACCESS_KEY_ID")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"AWS_SECRET_ACCESS_KEY"),"."),(0,o.kt)("h2",{id:"managing-workspace"},"Managing Workspace"),(0,o.kt)("p",null,"The subcommands of ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace")," are used to manage Workspaces, including ",(0,o.kt)("inlineCode",{parentName:"p"},"create"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"show"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"list"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"switch"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"update")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"delete"),". Cause the Workspace configurations are stored persistently, the current or a specified Backend will be used. For more information of Backend, please refer to ",(0,o.kt)("a",{parentName:"p",href:"backend"},"Backend"),"."),(0,o.kt)("p",null,"Kusion will create a ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," Workspace with empty configuration in every Backend automatically, and set it as the current. When first using Kusion, or no configuration of Workspace, the ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," Workspace will be used. "),(0,o.kt)("h3",{id:"creating-workspace"},"Creating Workspace"),(0,o.kt)("p",null,"Use ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace create ${name} -f ${configuration_file_path}")," to create a new Workspace with the configuration in a YAML file. The Workspace is identified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"name"),", and must be a new one, while the configuration must be written in a YAML file with correct format. "),(0,o.kt)("p",null,"The command above will create the Workspace in current Backend. If to create a Workspace in another backend, please use flag ",(0,o.kt)("inlineCode",{parentName:"p"},"--backend")," to specify. The Workspace names in a Backend must be different, but allow the same in different Backends."),(0,o.kt)("p",null,"In some scenarios, when a Workspace is created, it is expected to be the current. For simplification, the flag ",(0,o.kt)("inlineCode",{parentName:"p"},"--current")," is provided to set the Workspace current alongside the creation."),(0,o.kt)("p",null,"Be attention, creating ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," Workspace is not allowed, because it's created by Kusion automatically."),(0,o.kt)("p",null,"The example is shown as below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"# create a workspace in current backend\nkusion workspace create dev -f dev.yaml\n\n# create a workspace in current backend ans set it as current\nkusion workspace create dev -f dev.yaml --current\n\n# create a workspace in specified backend\nkusion workspace create dev -f dev.yaml --backend oss-pre\n")),(0,o.kt)("p",null,"The Workspaces to create are decided by the platform engineers. We recommend that they are organized by the following rules:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"SDLC phases"),", such as ",(0,o.kt)("inlineCode",{parentName:"li"},"dev"),", ",(0,o.kt)("inlineCode",{parentName:"li"},"pre"),", ",(0,o.kt)("inlineCode",{parentName:"li"},"prod"),";"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"cloud vendors"),", such as ",(0,o.kt)("inlineCode",{parentName:"li"},"aws"),", ",(0,o.kt)("inlineCode",{parentName:"li"},"alicloud"),";"),(0,o.kt)("li",{parentName:"ul"},"combination of the two above, such as ",(0,o.kt)("inlineCode",{parentName:"li"},"dev-aws"),", ",(0,o.kt)("inlineCode",{parentName:"li"},"prod-alicloud"),".")),(0,o.kt)("p",null,"In design, Kusion does not support deploying Stack to multiple clouds or regions within a single Workspace. While users can technically define a Module that provisions resources across multiple clouds or regions, Kusion does not recommend this practice, and will not provide technical support for such configuration. If the platform engineers need to manage resources across multiple clouds or regions, they should create separate Workspaces."),(0,o.kt)("h3",{id:"listing-workspace"},"Listing Workspace"),(0,o.kt)("p",null,"Use ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace list")," to get all the workspace names."),(0,o.kt)("p",null,"The example is shown as below. In order to simplify, The following examples will not give using specified backend, which is supported by ",(0,o.kt)("inlineCode",{parentName:"p"},"--backend")," flag."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"# list all the workspace names\nkusion workspace list\n")),(0,o.kt)("h3",{id:"switching-workspace"},"Switching Workspace"),(0,o.kt)("p",null,"In order not to specify the Workspace name for each Kusion operation command, ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace switch ${name}")," is provided to switch the current Workspace. Then when executing ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion generate"),", the current Workspace will be used. The to-switch Workspace must be created."),(0,o.kt)("p",null,"The example is shown as below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"# switch workspace\nkusion workspace switch dev\n")),(0,o.kt)("h3",{id:"showing-workspace"},"Showing Workspace"),(0,o.kt)("p",null,"Use ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace show ${name}")," to get the Workspace configuration. If the ",(0,o.kt)("inlineCode",{parentName:"p"},"name")," is not specified, the configuration of current Workspace will get returned."),(0,o.kt)("p",null,"The example is shown as below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"# show a specified workspace configuration\nkusion workspace show dev\n\n# show the current workspace configuration\nkusion workspace show\n")),(0,o.kt)("h3",{id:"updating-workspace"},"Updating Workspace"),(0,o.kt)("p",null,"When the Workspace needs to update, use ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace update ${name} -f ${configuration_file_path}")," to update with the new configuration file. The whole updated configuration is asked to provide, and the Workspace must be created. Get the Workspace configuration first, then refresh the configuration and execute the command, which are the recommended steps. If the ",(0,o.kt)("inlineCode",{parentName:"p"},"name")," is not specified, the current Workspace will be used."),(0,o.kt)("p",null,"Updating the ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," Workspace is allowed. And the flag ",(0,o.kt)("inlineCode",{parentName:"p"},"--current")," is also supported to set it as the current."),(0,o.kt)("p",null,"The example is shown as below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"# update a specified workspace\nkusion workspace update dev -f dev_new.yaml\n\n# update a specified workspace and set it as current\nkusion workspace update dev -f dev_new.yaml --current\n\n# update the current workspace\nkusion workspace update -f dev_new.yaml\n")),(0,o.kt)("h3",{id:"deleting-workspace"},"Deleting Workspace"),(0,o.kt)("p",null,"When a Workspace is not in use anymore, use ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace delete ${name}")," to delete a Workspace. If the ",(0,o.kt)("inlineCode",{parentName:"p"},"name")," is not specified, the current Workspace will get deleted, and the ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," Workspace will be set as the current Workspace. Therefore, deleting the ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," Workspace is not allowed. "),(0,o.kt)("p",null,"The example is shown as below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"# delete a specified workspace\nkusion workspace delete dev \n\n# delete the current workspace\nkusion workspace delete\n")),(0,o.kt)("h2",{id:"using-workspace"},"Using Workspace"),(0,o.kt)("p",null,"Workspace is used in the command ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion generate"),", the following steps help smooth the operation process."),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"Write the Workspace configuration file with the format shown above, and fulfill all the necessary fields;"),(0,o.kt)("li",{parentName:"ol"},"Create the workspace with ",(0,o.kt)("inlineCode",{parentName:"li"},"kusion workspace create"),", then Kusion perceives the Workspace. The flag ",(0,o.kt)("inlineCode",{parentName:"li"},"--current")," can be used to set it as the current."),(0,o.kt)("li",{parentName:"ol"},"Execute ",(0,o.kt)("inlineCode",{parentName:"li"},"kusion generate")," in a Stack to generate the whole Spec, the AppConfiguration and Workspace configuration get rendered automatically, and can be applied to the real infrastructure. If the appointed Workspace or Backend is asked, the flags ",(0,o.kt)("inlineCode",{parentName:"li"},"--workspace")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"--backend")," will help achieve that. "),(0,o.kt)("li",{parentName:"ol"},"If the Workspace needs to update, delete, switch, etc. Use the above commands to achieve that.")))}d.isMDXComponent=!0},3682:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/project-stack-workspace-565b997b82d65f1f62a943184916c510.png"}}]); \ No newline at end of file diff --git a/assets/js/9a8d2f85.580daa71.js b/assets/js/9a8d2f85.6d07595b.js similarity index 83% rename from assets/js/9a8d2f85.580daa71.js rename to assets/js/9a8d2f85.6d07595b.js index b4b73f01b12..05005b86259 100644 --- a/assets/js/9a8d2f85.580daa71.js +++ b/assets/js/9a8d2f85.6d07595b.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7135],{3905:(e,r,t)=>{t.d(r,{Zo:()=>d,kt:()=>f});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function i(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function a(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var l=n.createContext({}),s=function(e){var r=n.useContext(l),t=r;return e&&(t="function"==typeof e?e(r):a(a({},r),e)),t},d=function(e){var r=s(e.components);return n.createElement(l.Provider,{value:r},e.children)},p={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},u=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),u=s(t),f=o,m=u["".concat(l,".").concat(f)]||u[f]||p[f]||i;return t?n.createElement(m,a(a({ref:r},d),{},{components:t})):n.createElement(m,a({ref:r},d))}));function f(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=u;var c={};for(var l in r)hasOwnProperty.call(r,l)&&(c[l]=r[l]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var s=2;s{t.r(r),t.d(r,{assets:()=>l,contentTitle:()=>a,default:()=>p,frontMatter:()=>i,metadata:()=>c,toc:()=>s});var n=t(87462),o=(t(67294),t(3905));const i={},a="Kusion Model Library",c={unversionedId:"reference/model/index",id:"version-v0.9/reference/model/index",title:"Kusion Model Library",description:"",source:"@site/docs_versioned_docs/version-v0.9/reference/model/index.md",sourceDirName:"reference/model",slug:"/reference/model/",permalink:"/docs/v0.9/reference/model/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/index.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Backend Configuration",permalink:"/docs/v0.9/reference/cli/backend/backend-configuration"},next:{title:"Overview",permalink:"/docs/v0.9/reference/model/overview"}},l={},s=[],d={toc:s};function p(e){let{components:r,...t}=e;return(0,o.kt)("wrapper",(0,n.Z)({},d,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-model-library"},"Kusion Model Library"))}p.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7135],{3905:(e,r,t)=>{t.d(r,{Zo:()=>d,kt:()=>f});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function i(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function a(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var l=n.createContext({}),s=function(e){var r=n.useContext(l),t=r;return e&&(t="function"==typeof e?e(r):a(a({},r),e)),t},d=function(e){var r=s(e.components);return n.createElement(l.Provider,{value:r},e.children)},p={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},u=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),u=s(t),f=o,m=u["".concat(l,".").concat(f)]||u[f]||p[f]||i;return t?n.createElement(m,a(a({ref:r},d),{},{components:t})):n.createElement(m,a({ref:r},d))}));function f(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=u;var c={};for(var l in r)hasOwnProperty.call(r,l)&&(c[l]=r[l]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var s=2;s{t.r(r),t.d(r,{assets:()=>l,contentTitle:()=>a,default:()=>p,frontMatter:()=>i,metadata:()=>c,toc:()=>s});var n=t(87462),o=(t(67294),t(3905));const i={},a="Kusion Model Library",c={unversionedId:"reference/model/index",id:"version-v0.9/reference/model/index",title:"Kusion Model Library",description:"",source:"@site/docs_versioned_docs/version-v0.9/reference/model/index.md",sourceDirName:"reference/model",slug:"/reference/model/",permalink:"/docs/v0.9/reference/model/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/index.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Backend Configuration",permalink:"/docs/v0.9/reference/cli/backend/backend-configuration"},next:{title:"Overview",permalink:"/docs/v0.9/reference/model/overview"}},l={},s=[],d={toc:s};function p(e){let{components:r,...t}=e;return(0,o.kt)("wrapper",(0,n.Z)({},d,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-model-library"},"Kusion Model Library"))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9aa67784.0d83ccfd.js b/assets/js/9aa67784.0d83ccfd.js deleted file mode 100644 index b68fa075cd4..00000000000 --- a/assets/js/9aa67784.0d83ccfd.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[786],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>u});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),s=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},d=function(e){var t=s(e.components);return a.createElement(i.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,i=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),m=s(n),u=r,k=m["".concat(i,".").concat(u)]||m[u]||c[u]||l;return n?a.createElement(k,o(o({ref:t},d),{},{components:n})):a.createElement(k,o({ref:t},d))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,o=new Array(l);o[0]=m;var p={};for(var i in t)hasOwnProperty.call(t,i)&&(p[i]=t[i]);p.originalType=e,p.mdxType="string"==typeof e?e:r,o[1]=p;for(var s=2;s{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>c,frontMatter:()=>l,metadata:()=>p,toc:()=>s});var a=n(87462),r=(n(67294),n(3905));const l={},o="probe",p={unversionedId:"reference/modules/developer-schemas/internal/container/probe/probe",id:"reference/modules/developer-schemas/internal/container/probe/probe",title:"probe",description:"Schema Probe",source:"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/internal/container/probe/probe.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/internal/container/probe",slug:"/reference/modules/developer-schemas/internal/container/probe/",permalink:"/docs/next/reference/modules/developer-schemas/internal/container/probe/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/1-developer-schemas/internal/container/probe/probe.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"lifecycle",permalink:"/docs/next/reference/modules/developer-schemas/internal/container/lifecycle/"},next:{title:"secret",permalink:"/docs/next/reference/modules/developer-schemas/internal/secret/"}},i={},s=[{value:"Schema Probe",id:"schema-probe",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Schema Exec",id:"schema-exec",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3},{value:"Schema Http",id:"schema-http",level:2},{value:"Attributes",id:"attributes-2",level:3},{value:"Examples",id:"examples-2",level:3},{value:"Schema Tcp",id:"schema-tcp",level:2},{value:"Attributes",id:"attributes-3",level:3},{value:"Examples",id:"examples-3",level:3}],d={toc:s};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"probe"},"probe"),(0,r.kt)("h2",{id:"schema-probe"},"Schema Probe"),(0,r.kt)("p",null,"Probe describes a health check to be performed against a container to determine whether it is",(0,r.kt)("br",null),"alive or ready to receive traffic. There are three probe types: readiness, liveness, and startup."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"failureThreshold")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimum consecutive failures for the probe to be considered failed after having succeeded."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"initialDelaySeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"The number of seconds before health checking is activated.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"periodSeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"How often (in seconds) to perform the probe."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"probeHandler")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#exec"},"Exec")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#http"},"Http")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#tcp"},"Tcp"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"successThreshold")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimum consecutive successes for the probe to be considered successful after having failed."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"terminationGracePeriod")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Duration in seconds before terminate gracefully upon probe failure."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"timeoutSeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"The number of seconds after which the probe times out.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container.probe as p\n\nprobe = p.Probe {\n probeHandler: p.Http {\n path: "/healthz"\n }\n initialDelaySeconds: 10\n}\n')),(0,r.kt)("h2",{id:"schema-exec"},"Schema Exec"),(0,r.kt)("p",null,'Exec describes a "run in container" action.'),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"The command line to execute inside the container."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container.probe as p\n\nexecProbe = p.Exec {\n command: ["probe.sh"]\n}\n')),(0,r.kt)("h2",{id:"schema-http"},"Schema Http"),(0,r.kt)("p",null,"Http describes an action based on HTTP Get requests."),(0,r.kt)("h3",{id:"attributes-2"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"headers")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of custom headers to set in the request"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The full qualified url to send HTTP requests."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples-2"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container.probe as p\n\nhttpProbe = p.Http {\n url: "http://localhost:80"\n headers: {\n "X-HEADER": "VALUE"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-tcp"},"Schema Tcp"),(0,r.kt)("p",null,"Tcp describes an action based on opening a socket."),(0,r.kt)("h3",{id:"attributes-3"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The full qualified url to open a socket."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples-3"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container.probe as p\n\ntcpProbe = p.Tcp {\n url: "tcp://localhost:1234"\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9aa67784.c7446483.js b/assets/js/9aa67784.c7446483.js new file mode 100644 index 00000000000..a4468adc8b9 --- /dev/null +++ b/assets/js/9aa67784.c7446483.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[786],{3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>u});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function o(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var i=n.createContext({}),s=function(e){var t=n.useContext(i),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},d=function(e){var t=s(e.components);return n.createElement(i.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,i=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),m=s(a),u=r,k=m["".concat(i,".").concat(u)]||m[u]||c[u]||l;return a?n.createElement(k,o(o({ref:t},d),{},{components:a})):n.createElement(k,o({ref:t},d))}));function u(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,o=new Array(l);o[0]=m;var p={};for(var i in t)hasOwnProperty.call(t,i)&&(p[i]=t[i]);p.originalType=e,p.mdxType="string"==typeof e?e:r,o[1]=p;for(var s=2;s{a.r(t),a.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>c,frontMatter:()=>l,metadata:()=>p,toc:()=>s});var n=a(87462),r=(a(67294),a(3905));const l={},o="probe",p={unversionedId:"reference/modules/developer-schemas/internal/container/probe/probe",id:"reference/modules/developer-schemas/internal/container/probe/probe",title:"probe",description:"Schema Probe",source:"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/internal/container/probe/probe.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/internal/container/probe",slug:"/reference/modules/developer-schemas/internal/container/probe/",permalink:"/docs/next/reference/modules/developer-schemas/internal/container/probe/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/1-developer-schemas/internal/container/probe/probe.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"lifecycle",permalink:"/docs/next/reference/modules/developer-schemas/internal/container/lifecycle/"},next:{title:"secret",permalink:"/docs/next/reference/modules/developer-schemas/internal/secret/"}},i={},s=[{value:"Schema Probe",id:"schema-probe",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Schema Exec",id:"schema-exec",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3},{value:"Schema Http",id:"schema-http",level:2},{value:"Attributes",id:"attributes-2",level:3},{value:"Examples",id:"examples-2",level:3},{value:"Schema Tcp",id:"schema-tcp",level:2},{value:"Attributes",id:"attributes-3",level:3},{value:"Examples",id:"examples-3",level:3}],d={toc:s};function c(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"probe"},"probe"),(0,r.kt)("h2",{id:"schema-probe"},"Schema Probe"),(0,r.kt)("p",null,"Probe describes a health check to be performed against a container to determine whether it is",(0,r.kt)("br",null),"alive or ready to receive traffic. There are three probe types: readiness, liveness, and startup."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"failureThreshold")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimum consecutive failures for the probe to be considered failed after having succeeded."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"initialDelaySeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"The number of seconds before health checking is activated.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"periodSeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"How often (in seconds) to perform the probe."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"probeHandler")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#exec"},"Exec")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#http"},"Http")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#tcp"},"Tcp"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"successThreshold")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimum consecutive successes for the probe to be considered successful after having failed."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"terminationGracePeriod")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Duration in seconds before terminate gracefully upon probe failure."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"timeoutSeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"The number of seconds after which the probe times out.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container.probe as p\n\nprobe = p.Probe {\n probeHandler: p.Http {\n path: "/healthz"\n }\n initialDelaySeconds: 10\n}\n')),(0,r.kt)("h2",{id:"schema-exec"},"Schema Exec"),(0,r.kt)("p",null,'Exec describes a "run in container" action.'),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"The command line to execute inside the container."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container.probe as p\n\nexecProbe = p.Exec {\n command: ["probe.sh"]\n}\n')),(0,r.kt)("h2",{id:"schema-http"},"Schema Http"),(0,r.kt)("p",null,"Http describes an action based on HTTP Get requests."),(0,r.kt)("h3",{id:"attributes-2"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"headers")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of custom headers to set in the request"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The full qualified url to send HTTP requests."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples-2"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container.probe as p\n\nhttpProbe = p.Http {\n url: "http://localhost:80"\n headers: {\n "X-HEADER": "VALUE"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-tcp"},"Schema Tcp"),(0,r.kt)("p",null,"Tcp describes an action based on opening a socket."),(0,r.kt)("h3",{id:"attributes-3"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The full qualified url to open a socket."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples-3"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container.probe as p\n\ntcpProbe = p.Tcp {\n url: "tcp://localhost:1234"\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9abd7762.1509a21c.js b/assets/js/9abd7762.1509a21c.js new file mode 100644 index 00000000000..1b8b86e9624 --- /dev/null +++ b/assets/js/9abd7762.1509a21c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2379],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>d});var i=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function a(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=i.createContext({}),p=function(e){var t=i.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},c=function(e){var t=p(e.components);return i.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},f=i.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),f=p(n),d=r,m=f["".concat(l,".").concat(d)]||f[d]||u[d]||o;return n?i.createElement(m,a(a({ref:t},c),{},{components:n})):i.createElement(m,a({ref:t},c))}));function d(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,a=new Array(o);a[0]=f;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,a[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var i=n(87462),r=(n(67294),n(3905));const o={},a="kusion init",s={unversionedId:"reference/cli/kusion/kusion_init",id:"version-v0.9/reference/cli/kusion/kusion_init",title:"kusion init",description:"Initialize the scaffolding for a project",source:"@site/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_init.md",sourceDirName:"reference/cli/kusion",slug:"/reference/cli/kusion/kusion_init",permalink:"/docs/v0.9/reference/cli/kusion/kusion_init",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_init.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion destroy",permalink:"/docs/v0.9/reference/cli/kusion/kusion_destroy"},next:{title:"kusion preview",permalink:"/docs/v0.9/reference/cli/kusion/kusion_preview"}},l={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 28-Sep-2023",id:"auto-generated-by-spf13cobra-on-28-sep-2023",level:6}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,i.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"kusion-init"},"kusion init"),(0,r.kt)("p",null,"Initialize the scaffolding for a project"),(0,r.kt)("h3",{id:"synopsis"},"Synopsis"),(0,r.kt)("p",null,"This command initializes the scaffolding for a project, generating a project from an appointed template with correct structure."),(0,r.kt)("p",null," The scaffold templates can be retrieved from local or online. The built-in templates are used by default, self-defined templates are also supported by assigning the template repository path."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kusion init\n")),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"}," # Initialize a project from internal templates\n kusion init\n \n # Initialize a project from default online templates\n kusion init --online=true\n \n # Initialize a project from a specific online template\n kusion init https://github.com// --online=true\n \n # Initialize a project from a specific local template\n kusion init /path/to/templates\n")),(0,r.kt)("h3",{id:"options"},"Options"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"}," --custom-params string Custom params in JSON. If specified, it will be used as the template default value and skip prompts\n --force Force generating the scaffolding files, even if it would change the existing files\n -h, --help help for init\n --online Use templates from online repository to initialize project, or use locally cached templates\n --project-name string Initialize with specified project name. If not specified, a prompt will request it\n --template-name string Initialize with specified template. If not specified, a prompt will request it\n --yes Skip prompts and proceed with default values\n")),(0,r.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/v0.9/reference/cli/kusion/"},"kusion"),"\t - Kusion is the platform engineering engine of KusionStack")),(0,r.kt)("h6",{id:"auto-generated-by-spf13cobra-on-28-sep-2023"},"Auto generated by spf13/cobra on 28-Sep-2023"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9abd7762.dae98762.js b/assets/js/9abd7762.dae98762.js deleted file mode 100644 index 4d630fe5660..00000000000 --- a/assets/js/9abd7762.dae98762.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2379],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>d});var i=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function a(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=i.createContext({}),p=function(e){var t=i.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},c=function(e){var t=p(e.components);return i.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},f=i.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),f=p(n),d=r,m=f["".concat(l,".").concat(d)]||f[d]||u[d]||o;return n?i.createElement(m,a(a({ref:t},c),{},{components:n})):i.createElement(m,a({ref:t},c))}));function d(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,a=new Array(o);a[0]=f;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,a[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var i=n(87462),r=(n(67294),n(3905));const o={},a="kusion init",s={unversionedId:"reference/cli/kusion/kusion_init",id:"version-v0.9/reference/cli/kusion/kusion_init",title:"kusion init",description:"Initialize the scaffolding for a project",source:"@site/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_init.md",sourceDirName:"reference/cli/kusion",slug:"/reference/cli/kusion/kusion_init",permalink:"/docs/v0.9/reference/cli/kusion/kusion_init",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_init.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion destroy",permalink:"/docs/v0.9/reference/cli/kusion/kusion_destroy"},next:{title:"kusion preview",permalink:"/docs/v0.9/reference/cli/kusion/kusion_preview"}},l={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 28-Sep-2023",id:"auto-generated-by-spf13cobra-on-28-sep-2023",level:6}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,i.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"kusion-init"},"kusion init"),(0,r.kt)("p",null,"Initialize the scaffolding for a project"),(0,r.kt)("h3",{id:"synopsis"},"Synopsis"),(0,r.kt)("p",null,"This command initializes the scaffolding for a project, generating a project from an appointed template with correct structure."),(0,r.kt)("p",null," The scaffold templates can be retrieved from local or online. The built-in templates are used by default, self-defined templates are also supported by assigning the template repository path."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kusion init\n")),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"}," # Initialize a project from internal templates\n kusion init\n \n # Initialize a project from default online templates\n kusion init --online=true\n \n # Initialize a project from a specific online template\n kusion init https://github.com// --online=true\n \n # Initialize a project from a specific local template\n kusion init /path/to/templates\n")),(0,r.kt)("h3",{id:"options"},"Options"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"}," --custom-params string Custom params in JSON. If specified, it will be used as the template default value and skip prompts\n --force Force generating the scaffolding files, even if it would change the existing files\n -h, --help help for init\n --online Use templates from online repository to initialize project, or use locally cached templates\n --project-name string Initialize with specified project name. If not specified, a prompt will request it\n --template-name string Initialize with specified template. If not specified, a prompt will request it\n --yes Skip prompts and proceed with default values\n")),(0,r.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/v0.9/reference/cli/kusion/"},"kusion"),"\t - Kusion is the platform engineering engine of KusionStack")),(0,r.kt)("h6",{id:"auto-generated-by-spf13cobra-on-28-sep-2023"},"Auto generated by spf13/cobra on 28-Sep-2023"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9b7cb8f9.8a3f1b13.js b/assets/js/9b7cb8f9.8a3f1b13.js new file mode 100644 index 00000000000..d32bb3286ba --- /dev/null +++ b/assets/js/9b7cb8f9.8a3f1b13.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8976],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=r.createContext({}),s=function(e){var n=r.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},c=function(e){var n=s(e.components);return r.createElement(p.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(t),m=o,h=u["".concat(p,".").concat(m)]||u[m]||d[m]||i;return t?r.createElement(h,a(a({ref:n},c),{},{components:t})):r.createElement(h,a({ref:n},c))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=u;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:o,a[1]=l;for(var s=2;s{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>a,default:()=>d,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var r=t(87462),o=(t(67294),t(3905));const i={},a="Configure Resource Specification",l={unversionedId:"guides/working-with-k8s/resource-spec",id:"version-v0.9/guides/working-with-k8s/resource-spec",title:"Configure Resource Specification",description:"You can manage container-level resource specification in the AppConfiguration model via the resources field (under the Container schema).",source:"@site/docs_versioned_docs/version-v0.9/guides/working-with-k8s/5-resource-spec.md",sourceDirName:"guides/working-with-k8s",slug:"/guides/working-with-k8s/resource-spec",permalink:"/docs/v0.9/guides/working-with-k8s/resource-spec",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/guides/working-with-k8s/5-resource-spec.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:5,frontMatter:{},sidebar:"kusion",previous:{title:"Upgrade Image",permalink:"/docs/v0.9/guides/working-with-k8s/image-upgrade"},next:{title:"Configure Monitoring Behavior With Prometheus",permalink:"/docs/v0.9/guides/observability/prometheus"}},p={},s=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],c={toc:s};function d(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"configure-resource-specification"},"Configure Resource Specification"),(0,o.kt)("p",null,"You can manage container-level resource specification in the ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model via the ",(0,o.kt)("inlineCode",{parentName:"p"},"resources")," field (under the ",(0,o.kt)("inlineCode",{parentName:"p"},"Container")," schema)."),(0,o.kt)("p",null,"For the full ",(0,o.kt)("inlineCode",{parentName:"p"},"Container")," schema reference, please see ",(0,o.kt)("a",{parentName:"p",href:"../../reference/model/catalog_models/workload/doc_service#schema-container"},"here")," for more details."),(0,o.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,o.kt)("p",null,"Please refer to the ",(0,o.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,o.kt)("p",null,"The example below also requires you to have ",(0,o.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will generate a ",(0,o.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,o.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the project directory."),(0,o.kt)("h2",{id:"example"},"Example"),(0,o.kt)("p",null,"Update the resources value in ",(0,o.kt)("inlineCode",{parentName:"p"},"dev/main.k"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-py"},'import catalog.models.schema.v1 as ac\n\nhelloworld: ac.AppConfiguration {\n workload.containers.helloworld: {\n # dev stack has different resource requirements\n # set resources to your want\n # before:\n # resources: {\n # "cpu": "500m"\n # "memory": "512M"\n # }\n # after: \n resources: {\n "cpu": "250m"\n "memory": "256Mi"\n }\n }\n}\n')),(0,o.kt)("p",null,"Everything else in ",(0,o.kt)("inlineCode",{parentName:"p"},"main.k")," stay the same."),(0,o.kt)("h2",{id:"applying"},"Applying"),(0,o.kt)("p",null,"Re-run steps in ",(0,o.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", resource scaling is completed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"$ kusion apply\n\u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:helloworld UnChanged\n* \u251c\u2500 v1:Service:helloworld:helloworld-dev-helloworld-private UnChanged\n* \u2514\u2500 apps/v1:Deployment:helloworld:helloworld-dev-helloworld Update\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:helloworld, skip \n SUCCESS UnChanged v1:Service:helloworld:helloworld-dev-helloworld-private, skip \n SUCCESS Update apps/v1:Deployment:helloworld:helloworld-dev-helloworld success \nUpdate apps/v1:Deployment:helloworld:helloworld-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,o.kt)("h2",{id:"validation"},"Validation"),(0,o.kt)("p",null,"We can verify the application container (in the deployment template) now has the updated resources attributes (cpu:250m, memory:256Mi) as defined in the container configuration:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kubectl get deployment -n helloworld -o yaml\n...\n template:\n ...\n spec:\n containers:\n - env:\n ...\n image: gcr.io/google-samples/gb-frontend:v4\n ...\n resources:\n limits:\n cpu: 250m\n memory: 256Mi\n...\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9b7cb8f9.aaa4f137.js b/assets/js/9b7cb8f9.aaa4f137.js deleted file mode 100644 index caf74d8a5e6..00000000000 --- a/assets/js/9b7cb8f9.aaa4f137.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8976],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var p=r.createContext({}),s=function(e){var n=r.useContext(p),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},c=function(e){var n=s(e.components);return r.createElement(p.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(t),m=o,h=u["".concat(p,".").concat(m)]||u[m]||d[m]||i;return t?r.createElement(h,a(a({ref:n},c),{},{components:t})):r.createElement(h,a({ref:n},c))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=u;var l={};for(var p in n)hasOwnProperty.call(n,p)&&(l[p]=n[p]);l.originalType=e,l.mdxType="string"==typeof e?e:o,a[1]=l;for(var s=2;s{t.r(n),t.d(n,{assets:()=>p,contentTitle:()=>a,default:()=>d,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var r=t(87462),o=(t(67294),t(3905));const i={},a="Configure Resource Specification",l={unversionedId:"guides/working-with-k8s/resource-spec",id:"version-v0.9/guides/working-with-k8s/resource-spec",title:"Configure Resource Specification",description:"You can manage container-level resource specification in the AppConfiguration model via the resources field (under the Container schema).",source:"@site/docs_versioned_docs/version-v0.9/guides/working-with-k8s/5-resource-spec.md",sourceDirName:"guides/working-with-k8s",slug:"/guides/working-with-k8s/resource-spec",permalink:"/docs/v0.9/guides/working-with-k8s/resource-spec",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/guides/working-with-k8s/5-resource-spec.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:5,frontMatter:{},sidebar:"kusion",previous:{title:"Upgrade Image",permalink:"/docs/v0.9/guides/working-with-k8s/image-upgrade"},next:{title:"Configure Monitoring Behavior With Prometheus",permalink:"/docs/v0.9/guides/observability/prometheus"}},p={},s=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],c={toc:s};function d(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"configure-resource-specification"},"Configure Resource Specification"),(0,o.kt)("p",null,"You can manage container-level resource specification in the ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model via the ",(0,o.kt)("inlineCode",{parentName:"p"},"resources")," field (under the ",(0,o.kt)("inlineCode",{parentName:"p"},"Container")," schema)."),(0,o.kt)("p",null,"For the full ",(0,o.kt)("inlineCode",{parentName:"p"},"Container")," schema reference, please see ",(0,o.kt)("a",{parentName:"p",href:"../../reference/model/catalog_models/workload/doc_service#schema-container"},"here")," for more details."),(0,o.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,o.kt)("p",null,"Please refer to the ",(0,o.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,o.kt)("p",null,"The example below also requires you to have ",(0,o.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will generate a ",(0,o.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,o.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the project directory."),(0,o.kt)("h2",{id:"example"},"Example"),(0,o.kt)("p",null,"Update the resources value in ",(0,o.kt)("inlineCode",{parentName:"p"},"dev/main.k"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-py"},'import catalog.models.schema.v1 as ac\n\nhelloworld: ac.AppConfiguration {\n workload.containers.helloworld: {\n # dev stack has different resource requirements\n # set resources to your want\n # before:\n # resources: {\n # "cpu": "500m"\n # "memory": "512M"\n # }\n # after: \n resources: {\n "cpu": "250m"\n "memory": "256Mi"\n }\n }\n}\n')),(0,o.kt)("p",null,"Everything else in ",(0,o.kt)("inlineCode",{parentName:"p"},"main.k")," stay the same."),(0,o.kt)("h2",{id:"applying"},"Applying"),(0,o.kt)("p",null,"Re-run steps in ",(0,o.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", resource scaling is completed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"$ kusion apply\n\u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:helloworld UnChanged\n* \u251c\u2500 v1:Service:helloworld:helloworld-dev-helloworld-private UnChanged\n* \u2514\u2500 apps/v1:Deployment:helloworld:helloworld-dev-helloworld Update\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:helloworld, skip \n SUCCESS UnChanged v1:Service:helloworld:helloworld-dev-helloworld-private, skip \n SUCCESS Update apps/v1:Deployment:helloworld:helloworld-dev-helloworld success \nUpdate apps/v1:Deployment:helloworld:helloworld-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,o.kt)("h2",{id:"validation"},"Validation"),(0,o.kt)("p",null,"We can verify the application container (in the deployment template) now has the updated resources attributes (cpu:250m, memory:256Mi) as defined in the container configuration:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kubectl get deployment -n helloworld -o yaml\n...\n template:\n ...\n spec:\n containers:\n - env:\n ...\n image: gcr.io/google-samples/gb-frontend:v4\n ...\n resources:\n limits:\n cpu: 250m\n memory: 256Mi\n...\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9beb799b.b2b00fd2.js b/assets/js/9beb799b.b2b00fd2.js new file mode 100644 index 00000000000..7fecc346ef7 --- /dev/null +++ b/assets/js/9beb799b.b2b00fd2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6568],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),l=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=l(e.components);return a.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=l(n),m=r,k=u["".concat(c,".").concat(m)]||u[m]||d[m]||i;return n?a.createElement(k,o(o({ref:t},p),{},{components:n})):a.createElement(k,o({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=u;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var a=n(87462),r=(n(67294),n(3905));const i={id:"configuration",sidebar_label:"Stack file reference"},o="Kusion stack file reference",s={unversionedId:"concepts/stack/configuration",id:"version-v0.11/concepts/stack/configuration",title:"Kusion stack file reference",description:"Every Kusion project's stack has a stack file, stack.yaml, which specifies metadata about your stack, such as the stack name and stack description. The stack file must begin with lowercase stack and have an extension of either .yaml or .yml.",source:"@site/docs_versioned_docs/version-v0.11/3-concepts/2-stack/2-configuration.md",sourceDirName:"3-concepts/2-stack",slug:"/concepts/stack/configuration",permalink:"/docs/concepts/stack/configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/3-concepts/2-stack/2-configuration.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"configuration",sidebar_label:"Stack file reference"},sidebar:"kusion",previous:{title:"Overview",permalink:"/docs/concepts/stack/overview"},next:{title:"Overview",permalink:"/docs/concepts/kusion-module/overview"}},c={},l=[{value:"Attributes",id:"attributes",level:2},{value:"Extensions",id:"extensions",level:3},{value:"kubernetesNamespace",id:"kubernetesnamespace",level:4}],p={toc:l};function d(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"kusion-stack-file-reference"},"Kusion stack file reference"),(0,r.kt)("p",null,"Every Kusion project's stack has a stack file, ",(0,r.kt)("inlineCode",{parentName:"p"},"stack.yaml"),", which specifies metadata about your stack, such as the stack name and stack description. The stack file must begin with lowercase ",(0,r.kt)("inlineCode",{parentName:"p"},"stack")," and have an extension of either ",(0,r.kt)("inlineCode",{parentName:"p"},".yaml")," or ",(0,r.kt)("inlineCode",{parentName:"p"},".yml"),"."),(0,r.kt)("h2",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Required"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Options"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},"required"),(0,r.kt)("td",{parentName:"tr",align:"left"},"Name of the stack containing alphanumeric characters, hyphens, underscores."),(0,r.kt)("td",{parentName:"tr",align:"left"},"None")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"description")),(0,r.kt)("td",{parentName:"tr",align:"left"},"optional"),(0,r.kt)("td",{parentName:"tr",align:"left"},"A brief description of the stack."),(0,r.kt)("td",{parentName:"tr",align:"left"},"None")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"extensions")),(0,r.kt)("td",{parentName:"tr",align:"left"},"optional"),(0,r.kt)("td",{parentName:"tr",align:"left"},"List of extensions on the stack."),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"#extensions"},"See blow"))))),(0,r.kt)("h3",{id:"extensions"},"Extensions"),(0,r.kt)("p",null,"Extensions allow you to customize how resources are generated or customized as part of release."),(0,r.kt)("h4",{id:"kubernetesnamespace"},"kubernetesNamespace"),(0,r.kt)("p",null,"The Kubernetes namespace extension allows you to customize namespace within your application generate Kubernetes resources. "),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Key"),(0,r.kt)("th",{parentName:"tr",align:"center"},"Required"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},"kind"),(0,r.kt)("td",{parentName:"tr",align:"center"},"y"),(0,r.kt)("td",{parentName:"tr",align:"left"},"The kind of extension being used. Must be 'kubernetesNamespace'"),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"kubernetesNamespace"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},"namespace"),(0,r.kt)("td",{parentName:"tr",align:"center"},"y"),(0,r.kt)("td",{parentName:"tr",align:"left"},"The namespace where all application-scoped resources generate Kubernetes objects."),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"default"))))))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9beb799b.f02903a4.js b/assets/js/9beb799b.f02903a4.js deleted file mode 100644 index 12330e724e6..00000000000 --- a/assets/js/9beb799b.f02903a4.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6568],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>u});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),l=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=l(e.components);return a.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),m=l(n),u=r,k=m["".concat(c,".").concat(u)]||m[u]||d[u]||i;return n?a.createElement(k,o(o({ref:t},p),{},{components:n})):a.createElement(k,o({ref:t},p))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=m;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var a=n(87462),r=(n(67294),n(3905));const i={id:"configuration",sidebar_label:"Stack file reference"},o="Kusion stack file reference",s={unversionedId:"concepts/stack/configuration",id:"version-v0.11/concepts/stack/configuration",title:"Kusion stack file reference",description:"Every Kusion project's stack has a stack file, stack.yaml, which specifies metadata about your stack, such as the stack name and stack description. The stack file must begin with lowercase stack and have an extension of either .yaml or .yml.",source:"@site/docs_versioned_docs/version-v0.11/3-concepts/2-stack/2-configuration.md",sourceDirName:"3-concepts/2-stack",slug:"/concepts/stack/configuration",permalink:"/docs/concepts/stack/configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/3-concepts/2-stack/2-configuration.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"configuration",sidebar_label:"Stack file reference"},sidebar:"kusion",previous:{title:"Overview",permalink:"/docs/concepts/stack/overview"},next:{title:"Overview",permalink:"/docs/concepts/kusion-module/overview"}},c={},l=[{value:"Attributes",id:"attributes",level:2},{value:"Extensions",id:"extensions",level:3},{value:"kubernetesNamespace",id:"kubernetesnamespace",level:4}],p={toc:l};function d(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"kusion-stack-file-reference"},"Kusion stack file reference"),(0,r.kt)("p",null,"Every Kusion project's stack has a stack file, ",(0,r.kt)("inlineCode",{parentName:"p"},"stack.yaml"),", which specifies metadata about your stack, such as the stack name and stack description. The stack file must begin with lowercase ",(0,r.kt)("inlineCode",{parentName:"p"},"stack")," and have an extension of either ",(0,r.kt)("inlineCode",{parentName:"p"},".yaml")," or ",(0,r.kt)("inlineCode",{parentName:"p"},".yml"),"."),(0,r.kt)("h2",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Required"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Options"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},"required"),(0,r.kt)("td",{parentName:"tr",align:"left"},"Name of the stack containing alphanumeric characters, hyphens, underscores."),(0,r.kt)("td",{parentName:"tr",align:"left"},"None")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"description")),(0,r.kt)("td",{parentName:"tr",align:"left"},"optional"),(0,r.kt)("td",{parentName:"tr",align:"left"},"A brief description of the stack."),(0,r.kt)("td",{parentName:"tr",align:"left"},"None")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"extensions")),(0,r.kt)("td",{parentName:"tr",align:"left"},"optional"),(0,r.kt)("td",{parentName:"tr",align:"left"},"List of extensions on the stack."),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"#extensions"},"See blow"))))),(0,r.kt)("h3",{id:"extensions"},"Extensions"),(0,r.kt)("p",null,"Extensions allow you to customize how resources are generated or customized as part of release."),(0,r.kt)("h4",{id:"kubernetesnamespace"},"kubernetesNamespace"),(0,r.kt)("p",null,"The Kubernetes namespace extension allows you to customize namespace within your application generate Kubernetes resources. "),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Key"),(0,r.kt)("th",{parentName:"tr",align:"center"},"Required"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},"kind"),(0,r.kt)("td",{parentName:"tr",align:"center"},"y"),(0,r.kt)("td",{parentName:"tr",align:"left"},"The kind of extension being used. Must be 'kubernetesNamespace'"),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"kubernetesNamespace"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},"namespace"),(0,r.kt)("td",{parentName:"tr",align:"center"},"y"),(0,r.kt)("td",{parentName:"tr",align:"left"},"The namespace where all application-scoped resources generate Kubernetes objects."),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"default"))))))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9bfd3055.16d500d1.js b/assets/js/9bfd3055.16d500d1.js new file mode 100644 index 00000000000..8ff0bf44fa4 --- /dev/null +++ b/assets/js/9bfd3055.16d500d1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4645],{3905:(e,n,t)=>{t.d(n,{Zo:()=>l,kt:()=>f});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),p=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},l=function(e){var n=p(e.components);return r.createElement(c.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=p(t),f=o,m=u["".concat(c,".").concat(f)]||u[f]||d[f]||a;return t?r.createElement(m,i(i({ref:n},l),{},{components:t})):r.createElement(m,i({ref:n},l))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=u;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var p=2;p{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var r=t(87462),o=(t(67294),t(3905));const a={id:"base-override"},i="Base and Override",s={unversionedId:"configuration-walkthrough/base-override",id:"version-v0.11/configuration-walkthrough/base-override",title:"Base and Override",description:"In practice, what we have observed for production-grade applications is that they usually need to be deployed to a wide range of different targets, be it different environments in the SDLC, or different clouds, regions or runtimes for cost/regulation/performance or disaster recovery related reasons.",source:"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/3-base-override.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/base-override",permalink:"/docs/configuration-walkthrough/base-override",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/3-base-override.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{id:"base-override"},sidebar:"kusion",previous:{title:"KCL Basics",permalink:"/docs/configuration-walkthrough/kcl-basics"},next:{title:"Workload",permalink:"/docs/configuration-walkthrough/workload"}},c={},p=[],l={toc:p};function d(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},l,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"base-and-override"},"Base and Override"),(0,o.kt)("p",null,"In practice, what we have observed for production-grade applications is that they usually need to be deployed to a wide range of different targets, be it different environments in the SDLC, or different clouds, regions or runtimes for cost/regulation/performance or disaster recovery related reasons."),(0,o.kt)("p",null,"In that context, we advocate for a pattern where you can leverage some Kusion and KCL features to minimize the amount of duplicate configurations, by separating the common base application configuration and environment-specific ones."),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"The file names in the below examples don't matter as long as they are called out and appear in the correct order in the ",(0,o.kt)("inlineCode",{parentName:"p"},"entries")," field (the field is a list) in ",(0,o.kt)("inlineCode",{parentName:"p"},"kcl.mod"),". The files with common configurations should appear first in the list and stack-specific ones last. The latter one takes precedence."),(0,o.kt)("p",{parentName:"admonition"},"The configurations also don't have be placed into a single ",(0,o.kt)("inlineCode",{parentName:"p"},".k")," file. For complex projects, they can be broken down into smaller organized ",(0,o.kt)("inlineCode",{parentName:"p"},".k")," files for better readability. ")),(0,o.kt)("p",null,"Base configuration defined in ",(0,o.kt)("inlineCode",{parentName:"p"},"base/base.k"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network.network as n\n\nmyapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: ""\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n public: True\n }\n ]\n }\n }\n}\n')),(0,o.kt)("p",null,"Environment-specific configuration defined in ",(0,o.kt)("inlineCode",{parentName:"p"},"dev/main.k"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\n\n# main.k declares customized configurations for dev stack.\nmyapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n # dev stack has different app configuration from the base\n image = "gcr.io/google-samples/gb-frontend:v5"\n resources = {\n "cpu": "250m"\n "memory": "256Mi"\n }\n }\n }\n replicas = 2\n }\n}\n')),(0,o.kt)("p",null,"Alternatively, you could locate a specific property (in this case below, the ",(0,o.kt)("inlineCode",{parentName:"p"},"Container")," object) in the ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," object using the dot selector shorthand(such as ",(0,o.kt)("inlineCode",{parentName:"p"},"workload.containers.myapp")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"workload.replicas")," below):"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\n\n# main.k declares customized configurations for dev stack.\nmyapp: ac.AppConfiguration {\n workload.replicas = 2\n workload.containers.myapp: {\n # dev stack has different app configuration\n image = "gcr.io/google-samples/gb-frontend:v5"\n resources = {\n "cpu": "250m"\n "memory": "256Mi"\n }\n }\n}\n')),(0,o.kt)("p",null,"This is especially useful when the application configuration is complex but the override is relatively straightforward."),(0,o.kt)("p",null,"The two examples above are equivalent when overriding the base."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9bfd3055.f9d9c90c.js b/assets/js/9bfd3055.f9d9c90c.js deleted file mode 100644 index b58ebb07cd3..00000000000 --- a/assets/js/9bfd3055.f9d9c90c.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4645],{3905:(e,n,t)=>{t.d(n,{Zo:()=>l,kt:()=>f});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),p=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},l=function(e){var n=p(e.components);return r.createElement(c.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=p(t),f=o,m=u["".concat(c,".").concat(f)]||u[f]||d[f]||a;return t?r.createElement(m,i(i({ref:n},l),{},{components:t})):r.createElement(m,i({ref:n},l))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=u;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var p=2;p{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var r=t(87462),o=(t(67294),t(3905));const a={id:"base-override"},i="Base and Override",s={unversionedId:"configuration-walkthrough/base-override",id:"version-v0.11/configuration-walkthrough/base-override",title:"Base and Override",description:"In practice, what we have observed for production-grade applications is that they usually need to be deployed to a wide range of different targets, be it different environments in the SDLC, or different clouds, regions or runtimes for cost/regulation/performance or disaster recovery related reasons.",source:"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/3-base-override.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/base-override",permalink:"/docs/configuration-walkthrough/base-override",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/3-base-override.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{id:"base-override"},sidebar:"kusion",previous:{title:"KCL Basics",permalink:"/docs/configuration-walkthrough/kcl-basics"},next:{title:"Workload",permalink:"/docs/configuration-walkthrough/workload"}},c={},p=[],l={toc:p};function d(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},l,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"base-and-override"},"Base and Override"),(0,o.kt)("p",null,"In practice, what we have observed for production-grade applications is that they usually need to be deployed to a wide range of different targets, be it different environments in the SDLC, or different clouds, regions or runtimes for cost/regulation/performance or disaster recovery related reasons."),(0,o.kt)("p",null,"In that context, we advocate for a pattern where you can leverage some Kusion and KCL features to minimize the amount of duplicate configurations, by separating the common base application configuration and environment-specific ones."),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"The file names in the below examples don't matter as long as they are called out and appear in the correct order in the ",(0,o.kt)("inlineCode",{parentName:"p"},"entries")," field (the field is a list) in ",(0,o.kt)("inlineCode",{parentName:"p"},"kcl.mod"),". The files with common configurations should appear first in the list and stack-specific ones last. The latter one takes precedence."),(0,o.kt)("p",{parentName:"admonition"},"The configurations also don't have be placed into a single ",(0,o.kt)("inlineCode",{parentName:"p"},".k")," file. For complex projects, they can be broken down into smaller organized ",(0,o.kt)("inlineCode",{parentName:"p"},".k")," files for better readability. ")),(0,o.kt)("p",null,"Base configuration defined in ",(0,o.kt)("inlineCode",{parentName:"p"},"base/base.k"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network.network as n\n\nmyapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: ""\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n public: True\n }\n ]\n }\n }\n}\n')),(0,o.kt)("p",null,"Environment-specific configuration defined in ",(0,o.kt)("inlineCode",{parentName:"p"},"dev/main.k"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\n\n# main.k declares customized configurations for dev stack.\nmyapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n # dev stack has different app configuration from the base\n image = "gcr.io/google-samples/gb-frontend:v5"\n resources = {\n "cpu": "250m"\n "memory": "256Mi"\n }\n }\n }\n replicas = 2\n }\n}\n')),(0,o.kt)("p",null,"Alternatively, you could locate a specific property (in this case below, the ",(0,o.kt)("inlineCode",{parentName:"p"},"Container")," object) in the ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," object using the dot selector shorthand(such as ",(0,o.kt)("inlineCode",{parentName:"p"},"workload.containers.myapp")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"workload.replicas")," below):"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\n\n# main.k declares customized configurations for dev stack.\nmyapp: ac.AppConfiguration {\n workload.replicas = 2\n workload.containers.myapp: {\n # dev stack has different app configuration\n image = "gcr.io/google-samples/gb-frontend:v5"\n resources = {\n "cpu": "250m"\n "memory": "256Mi"\n }\n }\n}\n')),(0,o.kt)("p",null,"This is especially useful when the application configuration is complex but the override is relatively straightforward."),(0,o.kt)("p",null,"The two examples above are equivalent when overriding the base."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9d46269e.14524253.js b/assets/js/9d46269e.14524253.js deleted file mode 100644 index f2a4d63acbd..00000000000 --- a/assets/js/9d46269e.14524253.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5827],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(n),f=i,m=d["".concat(l,".").concat(f)]||d[f]||u[f]||o;return n?r.createElement(m,a(a({ref:t},c),{},{components:n})):r.createElement(m,a({ref:t},c))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,a=new Array(o);a[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,a[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var r=n(87462),i=(n(67294),n(3905));const o={},a="kusion preview",s={unversionedId:"reference/commands/kusion-preview",id:"version-v0.10/reference/commands/kusion-preview",title:"kusion preview",description:"Preview a series of resource changes within the stack",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-preview.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-preview",permalink:"/docs/v0.10/reference/commands/kusion-preview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-preview.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion init",permalink:"/docs/v0.10/reference/commands/kusion-init"},next:{title:"kusion version",permalink:"/docs/v0.10/reference/commands/kusion-version"}},l={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"kusion-preview"},"kusion preview"),(0,i.kt)("p",null,"Preview a series of resource changes within the stack"),(0,i.kt)("h3",{id:"synopsis"},"Synopsis"),(0,i.kt)("p",null,"Preview a series of resource changes within the stack."),(0,i.kt)("p",null," Create, update or delete resources according to the intent described in the a stack. By default, Kusion will generate an execution plan and present it for your approval before taking any action."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"kusion preview [flags]\n")),(0,i.kt)("h3",{id:"examples"},"Examples"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},' # Preview with specified work directory\n kusion preview -w /path/to/workdir\n \n # Preview with specified arguments\n kusion preview -D name=test -D age=18\n \n # Preview with specified intent file\n kusion preview --intent-file intent.yaml\n \n # Preview with ignored fields\n kusion preview --ignore-fields="metadata.generation,metadata.managedFields\n \n # Preview with json format result\n kusion preview -o json\n \n # Preview without output style and color\n kusion preview --no-style=true\n')),(0,i.kt)("h3",{id:"options"},"Options"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"}," -a, --all --detail Automatically show all plan details, combined use with flag --detail\n -D, --argument stringToString Specify the top-level argument (default [])\n -C, --backend-config strings backend-config config state storage backend\n --backend-type string backend-type specify state storage backend\n -d, --detail Automatically show plan details with interactive options\n -h, --help help for preview\n --ignore-fields strings Ignore differences of target fields\n --intent-file string Specify the intent file path as input, and the intent file must be located in the working directory or its subdirectories\n --no-style no-style sets to RawOutput mode and disables all of styling\n --operator string Specify the operator\n -o, --output string Specify the output format\n -Y, --setting strings Specify the command line setting files\n -w, --workdir string Specify the work directory\n")),(0,i.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,i.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of KusionStack")),(0,i.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9d46269e.15887a17.js b/assets/js/9d46269e.15887a17.js new file mode 100644 index 00000000000..5283d565fb9 --- /dev/null +++ b/assets/js/9d46269e.15887a17.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5827],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(n),f=i,m=d["".concat(l,".").concat(f)]||d[f]||u[f]||o;return n?r.createElement(m,a(a({ref:t},c),{},{components:n})):r.createElement(m,a({ref:t},c))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,a=new Array(o);a[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,a[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var r=n(87462),i=(n(67294),n(3905));const o={},a="kusion preview",s={unversionedId:"reference/commands/kusion-preview",id:"version-v0.10/reference/commands/kusion-preview",title:"kusion preview",description:"Preview a series of resource changes within the stack",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-preview.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-preview",permalink:"/docs/v0.10/reference/commands/kusion-preview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-preview.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion init",permalink:"/docs/v0.10/reference/commands/kusion-init"},next:{title:"kusion version",permalink:"/docs/v0.10/reference/commands/kusion-version"}},l={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"kusion-preview"},"kusion preview"),(0,i.kt)("p",null,"Preview a series of resource changes within the stack"),(0,i.kt)("h3",{id:"synopsis"},"Synopsis"),(0,i.kt)("p",null,"Preview a series of resource changes within the stack."),(0,i.kt)("p",null," Create, update or delete resources according to the intent described in the a stack. By default, Kusion will generate an execution plan and present it for your approval before taking any action."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"kusion preview [flags]\n")),(0,i.kt)("h3",{id:"examples"},"Examples"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},' # Preview with specified work directory\n kusion preview -w /path/to/workdir\n \n # Preview with specified arguments\n kusion preview -D name=test -D age=18\n \n # Preview with specified intent file\n kusion preview --intent-file intent.yaml\n \n # Preview with ignored fields\n kusion preview --ignore-fields="metadata.generation,metadata.managedFields\n \n # Preview with json format result\n kusion preview -o json\n \n # Preview without output style and color\n kusion preview --no-style=true\n')),(0,i.kt)("h3",{id:"options"},"Options"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"}," -a, --all --detail Automatically show all plan details, combined use with flag --detail\n -D, --argument stringToString Specify the top-level argument (default [])\n -C, --backend-config strings backend-config config state storage backend\n --backend-type string backend-type specify state storage backend\n -d, --detail Automatically show plan details with interactive options\n -h, --help help for preview\n --ignore-fields strings Ignore differences of target fields\n --intent-file string Specify the intent file path as input, and the intent file must be located in the working directory or its subdirectories\n --no-style no-style sets to RawOutput mode and disables all of styling\n --operator string Specify the operator\n -o, --output string Specify the output format\n -Y, --setting strings Specify the command line setting files\n -w, --workdir string Specify the work directory\n")),(0,i.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,i.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of KusionStack")),(0,i.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9e3571d8.4c2b1e30.js b/assets/js/9e3571d8.4c2b1e30.js deleted file mode 100644 index 26b03285697..00000000000 --- a/assets/js/9e3571d8.4c2b1e30.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6103],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,f=d["".concat(l,".").concat(m)]||d[m]||u[m]||o;return n?r.createElement(f,i(i({ref:t},s),{},{components:n})):r.createElement(f,i({ref:t},s))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=d;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p.mdxType="string"==typeof e?e:a,i[1]=p;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>u,frontMatter:()=>o,metadata:()=>p,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const o={id:"configuration",sidebar_label:"Project file reference"},i="Kusion project file reference",p={unversionedId:"concepts/project/configuration",id:"concepts/project/configuration",title:"Kusion project file reference",description:"Every Kusion project has a project file, project.yaml, which specifies metadata about your project, such as the project name and project description. The project file must begin with lowercase project and have an extension of either .yaml or .yml.",source:"@site/docs/kusion/3-concepts/1-project/2-configuration.md",sourceDirName:"3-concepts/1-project",slug:"/concepts/project/configuration",permalink:"/docs/next/concepts/project/configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/3-concepts/1-project/2-configuration.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"configuration",sidebar_label:"Project file reference"},sidebar:"kusion",previous:{title:"Overview",permalink:"/docs/next/concepts/project/overview"},next:{title:"Overview",permalink:"/docs/next/concepts/stack/overview"}},l={},c=[{value:"Attributes",id:"attributes",level:2},{value:"Extensions",id:"extensions",level:3},{value:"kubernetesNamespace",id:"kubernetesnamespace",level:4}],s={toc:c};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"kusion-project-file-reference"},"Kusion project file reference"),(0,a.kt)("p",null,"Every Kusion project has a project file, ",(0,a.kt)("inlineCode",{parentName:"p"},"project.yaml"),", which specifies metadata about your project, such as the project name and project description. The project file must begin with lowercase ",(0,a.kt)("inlineCode",{parentName:"p"},"project")," and have an extension of either ",(0,a.kt)("inlineCode",{parentName:"p"},".yaml")," or ",(0,a.kt)("inlineCode",{parentName:"p"},".yml"),"."),(0,a.kt)("h2",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Required"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Description"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Options"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"name")),(0,a.kt)("td",{parentName:"tr",align:"left"},"required"),(0,a.kt)("td",{parentName:"tr",align:"left"},"Name of the project containing alphanumeric characters, hyphens, underscores."),(0,a.kt)("td",{parentName:"tr",align:"left"},"None")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"description")),(0,a.kt)("td",{parentName:"tr",align:"left"},"optional"),(0,a.kt)("td",{parentName:"tr",align:"left"},"A brief description of the project."),(0,a.kt)("td",{parentName:"tr",align:"left"},"None")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"extensions")),(0,a.kt)("td",{parentName:"tr",align:"left"},"optional"),(0,a.kt)("td",{parentName:"tr",align:"left"},"List of extensions on the project."),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("a",{parentName:"td",href:"#extensions"},"See blow"))))),(0,a.kt)("h3",{id:"extensions"},"Extensions"),(0,a.kt)("p",null,"Extensions allow you to customize how resources are generated or customized as part of release."),(0,a.kt)("h4",{id:"kubernetesnamespace"},"kubernetesNamespace"),(0,a.kt)("p",null,"The Kubernetes namespace extension allows you to customize namespace within your application generate Kubernetes resources. "),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Key"),(0,a.kt)("th",{parentName:"tr",align:"center"},"Required"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Description"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Example"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},"kind"),(0,a.kt)("td",{parentName:"tr",align:"center"},"y"),(0,a.kt)("td",{parentName:"tr",align:"left"},"The kind of extension being used. Must be 'kubernetesNamespace'"),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"kubernetesNamespace"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},"namespace"),(0,a.kt)("td",{parentName:"tr",align:"center"},"y"),(0,a.kt)("td",{parentName:"tr",align:"left"},"The namespace where all application-scoped resources generate Kubernetes objects."),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"default"))))))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9e3571d8.5da745d6.js b/assets/js/9e3571d8.5da745d6.js new file mode 100644 index 00000000000..cf95ff4c856 --- /dev/null +++ b/assets/js/9e3571d8.5da745d6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6103],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),d=l(n),m=a,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||o;return n?r.createElement(f,i(i({ref:t},s),{},{components:n})):r.createElement(f,i({ref:t},s))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=d;var p={};for(var c in t)hasOwnProperty.call(t,c)&&(p[c]=t[c]);p.originalType=e,p.mdxType="string"==typeof e?e:a,i[1]=p;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>o,metadata:()=>p,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const o={id:"configuration",sidebar_label:"Project file reference"},i="Kusion project file reference",p={unversionedId:"concepts/project/configuration",id:"concepts/project/configuration",title:"Kusion project file reference",description:"Every Kusion project has a project file, project.yaml, which specifies metadata about your project, such as the project name and project description. The project file must begin with lowercase project and have an extension of either .yaml or .yml.",source:"@site/docs/kusion/3-concepts/1-project/2-configuration.md",sourceDirName:"3-concepts/1-project",slug:"/concepts/project/configuration",permalink:"/docs/next/concepts/project/configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/3-concepts/1-project/2-configuration.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"configuration",sidebar_label:"Project file reference"},sidebar:"kusion",previous:{title:"Overview",permalink:"/docs/next/concepts/project/overview"},next:{title:"Overview",permalink:"/docs/next/concepts/stack/overview"}},c={},l=[{value:"Attributes",id:"attributes",level:2},{value:"Extensions",id:"extensions",level:3},{value:"kubernetesNamespace",id:"kubernetesnamespace",level:4}],s={toc:l};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"kusion-project-file-reference"},"Kusion project file reference"),(0,a.kt)("p",null,"Every Kusion project has a project file, ",(0,a.kt)("inlineCode",{parentName:"p"},"project.yaml"),", which specifies metadata about your project, such as the project name and project description. The project file must begin with lowercase ",(0,a.kt)("inlineCode",{parentName:"p"},"project")," and have an extension of either ",(0,a.kt)("inlineCode",{parentName:"p"},".yaml")," or ",(0,a.kt)("inlineCode",{parentName:"p"},".yml"),"."),(0,a.kt)("h2",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Required"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Description"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Options"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"name")),(0,a.kt)("td",{parentName:"tr",align:"left"},"required"),(0,a.kt)("td",{parentName:"tr",align:"left"},"Name of the project containing alphanumeric characters, hyphens, underscores."),(0,a.kt)("td",{parentName:"tr",align:"left"},"None")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"description")),(0,a.kt)("td",{parentName:"tr",align:"left"},"optional"),(0,a.kt)("td",{parentName:"tr",align:"left"},"A brief description of the project."),(0,a.kt)("td",{parentName:"tr",align:"left"},"None")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"extensions")),(0,a.kt)("td",{parentName:"tr",align:"left"},"optional"),(0,a.kt)("td",{parentName:"tr",align:"left"},"List of extensions on the project."),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("a",{parentName:"td",href:"#extensions"},"See blow"))))),(0,a.kt)("h3",{id:"extensions"},"Extensions"),(0,a.kt)("p",null,"Extensions allow you to customize how resources are generated or customized as part of release."),(0,a.kt)("h4",{id:"kubernetesnamespace"},"kubernetesNamespace"),(0,a.kt)("p",null,"The Kubernetes namespace extension allows you to customize namespace within your application generate Kubernetes resources. "),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Key"),(0,a.kt)("th",{parentName:"tr",align:"center"},"Required"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Description"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Example"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},"kind"),(0,a.kt)("td",{parentName:"tr",align:"center"},"y"),(0,a.kt)("td",{parentName:"tr",align:"left"},"The kind of extension being used. Must be 'kubernetesNamespace'"),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"kubernetesNamespace"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},"namespace"),(0,a.kt)("td",{parentName:"tr",align:"center"},"y"),(0,a.kt)("td",{parentName:"tr",align:"left"},"The namespace where all application-scoped resources generate Kubernetes objects."),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"default"))))))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9edb4516.add35d2f.js b/assets/js/9edb4516.add35d2f.js new file mode 100644 index 00000000000..534ca902f39 --- /dev/null +++ b/assets/js/9edb4516.add35d2f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3296],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),p=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=p(e.components);return r.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},c=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),c=p(n),m=a,g=c["".concat(i,".").concat(m)]||c[m]||u[m]||o;return n?r.createElement(g,l(l({ref:t},d),{},{components:n})):r.createElement(g,l({ref:t},d))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=c;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,l[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const o={},l="postgres",s={unversionedId:"reference/modules/workspace-configs/database/postgres",id:"version-v0.10/reference/modules/workspace-configs/database/postgres",title:"postgres",description:"Module PostgreSQL",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/database/postgres.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/database",slug:"/reference/modules/workspace-configs/database/postgres",permalink:"/docs/v0.10/reference/modules/workspace-configs/database/postgres",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/database/postgres.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"mysql",permalink:"/docs/v0.10/reference/modules/workspace-configs/database/mysql"},next:{title:"monitoring",permalink:"/docs/v0.10/reference/modules/workspace-configs/monitoring/prometheus"}},i={},p=[{value:"Module PostgreSQL",id:"module-postgresql",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],d={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"postgres"},"postgres"),(0,a.kt)("h2",{id:"module-postgresql"},"Module PostgreSQL"),(0,a.kt)("p",null,"PostgreSQL describes the attributes to locally deploy or create a cloud provider managed postgres database instance for the workload. "),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"cloud"),(0,a.kt)("br",null),"Cloud specifies the type of the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},'"aws" ',"|",' "alicloud"'),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"username"),(0,a.kt)("br",null),"Username specifies the operation account for the postgres database."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},'"root"'),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"category"),(0,a.kt)("br",null),"Category specifies the edition of the postgres instance provided by the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},'"Basic"'),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"securityIPs"),(0,a.kt)("br",null),"SecurityIPs specifies the list of IP addresses allowed to access the postgres instance provided by the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},"[str]"),(0,a.kt)("td",{parentName:"tr",align:null},'["0.0.0.0/0"]'),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"privateRouting"),(0,a.kt)("br",null),"PrivateRouting specifies whether the host address of the cloud postgres instance for the workload to connect with is via public network or private network of the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},"bool"),(0,a.kt)("td",{parentName:"tr",align:null},"true"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"size"),(0,a.kt)("br",null),"Size specifies the allocated storage size of the postgres instance."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"10"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"subnetID"),(0,a.kt)("br",null),"SubnetID specifies the virtual subnet ID associated with the VPC that the cloud postgres instance will be created in."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"suffix"),(0,a.kt)("br",null),"Suffix specifies the suffix of the database name."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n aws: \n version: 5.0.1\n source: hashicorp/aws\n region: us-east-1\n\n# PostgreSQL workspace configs for AWS RDS\nmodules: \n postgres: \n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n securityIPs: \n - 0.0.0.0/0\n suffix: "-postgres"\n')),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n alicloud:\n version: 1.209.1\n source: aliyun/alicloud\n region: cn-beijing\n\n# PostgreSQL workspace configs for Alicloud RDS\nmodules: \n postgres:\n default:\n cloud: alicloud\n size: 20\n instanceType: pg.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n securityIPs: \n - 0.0.0.0/0\n suffix: "-postgres"\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9edb4516.e67e8686.js b/assets/js/9edb4516.e67e8686.js deleted file mode 100644 index 74908049769..00000000000 --- a/assets/js/9edb4516.e67e8686.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3296],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var i=r.createContext({}),p=function(e){var t=r.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=p(e.components);return r.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},c=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),c=p(n),m=a,g=c["".concat(i,".").concat(m)]||c[m]||u[m]||o;return n?r.createElement(g,l(l({ref:t},d),{},{components:n})):r.createElement(g,l({ref:t},d))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=c;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,l[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const o={},l="postgres",s={unversionedId:"reference/modules/workspace-configs/database/postgres",id:"version-v0.10/reference/modules/workspace-configs/database/postgres",title:"postgres",description:"Module PostgreSQL",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/database/postgres.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/database",slug:"/reference/modules/workspace-configs/database/postgres",permalink:"/docs/v0.10/reference/modules/workspace-configs/database/postgres",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/database/postgres.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"mysql",permalink:"/docs/v0.10/reference/modules/workspace-configs/database/mysql"},next:{title:"monitoring",permalink:"/docs/v0.10/reference/modules/workspace-configs/monitoring/prometheus"}},i={},p=[{value:"Module PostgreSQL",id:"module-postgresql",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],d={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"postgres"},"postgres"),(0,a.kt)("h2",{id:"module-postgresql"},"Module PostgreSQL"),(0,a.kt)("p",null,"PostgreSQL describes the attributes to locally deploy or create a cloud provider managed postgres database instance for the workload. "),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"cloud"),(0,a.kt)("br",null),"Cloud specifies the type of the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},'"aws" ',"|",' "alicloud"'),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"username"),(0,a.kt)("br",null),"Username specifies the operation account for the postgres database."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},'"root"'),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"category"),(0,a.kt)("br",null),"Category specifies the edition of the postgres instance provided by the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},'"Basic"'),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"securityIPs"),(0,a.kt)("br",null),"SecurityIPs specifies the list of IP addresses allowed to access the postgres instance provided by the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},"[str]"),(0,a.kt)("td",{parentName:"tr",align:null},'["0.0.0.0/0"]'),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"privateRouting"),(0,a.kt)("br",null),"PrivateRouting specifies whether the host address of the cloud postgres instance for the workload to connect with is via public network or private network of the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},"bool"),(0,a.kt)("td",{parentName:"tr",align:null},"true"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"size"),(0,a.kt)("br",null),"Size specifies the allocated storage size of the postgres instance."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"10"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"subnetID"),(0,a.kt)("br",null),"SubnetID specifies the virtual subnet ID associated with the VPC that the cloud postgres instance will be created in."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"suffix"),(0,a.kt)("br",null),"Suffix specifies the suffix of the database name."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n aws: \n version: 5.0.1\n source: hashicorp/aws\n region: us-east-1\n\n# PostgreSQL workspace configs for AWS RDS\nmodules: \n postgres: \n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n securityIPs: \n - 0.0.0.0/0\n suffix: "-postgres"\n')),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n alicloud:\n version: 1.209.1\n source: aliyun/alicloud\n region: cn-beijing\n\n# PostgreSQL workspace configs for Alicloud RDS\nmodules: \n postgres:\n default:\n cloud: alicloud\n size: 20\n instanceType: pg.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n securityIPs: \n - 0.0.0.0/0\n suffix: "-postgres"\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9f069a65.8014090f.js b/assets/js/9f069a65.8014090f.js new file mode 100644 index 00000000000..d6a69c43bb4 --- /dev/null +++ b/assets/js/9f069a65.8014090f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[963],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>d});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=o.createContext({}),u=function(e){var t=o.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},l=function(e){var t=u(e.components);return o.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,s=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),m=u(n),d=r,h=m["".concat(s,".").concat(d)]||m[d]||c[d]||a;return n?o.createElement(h,i(i({ref:t},l),{},{components:n})):o.createElement(h,i({ref:t},l))}));function d(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,i=new Array(a);i[0]=m;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p.mdxType="string"==typeof e?e:r,i[1]=p;for(var u=2;u{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>c,frontMatter:()=>a,metadata:()=>p,toc:()=>u});var o=n(87462),r=(n(67294),n(3905));const a={},i="Application Monitoring",p={unversionedId:"configuration-walkthrough/monitoring",id:"configuration-walkthrough/monitoring",title:"Application Monitoring",description:"You could also specify the collection of monitoring requirements for the application. That can be achieved via a monitoring module (or bring-your-own-module) in the accessories field in AppConfiguration to achieve that.",source:"@site/docs/kusion/4-configuration-walkthrough/8-monitoring.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/monitoring",permalink:"/docs/next/configuration-walkthrough/monitoring",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/4-configuration-walkthrough/8-monitoring.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:8,frontMatter:{},sidebar:"kusion",previous:{title:"Secrets",permalink:"/docs/next/configuration-walkthrough/secret"},next:{title:"Operational Rules",permalink:"/docs/next/configuration-walkthrough/operational-rules"}},s={},u=[{value:"Import",id:"import",level:2},{value:"Workspace configurations",id:"workspace-configurations",level:2},{value:"Managing Scraping Configuration",id:"managing-scraping-configuration",level:2},{value:"Default values",id:"default-values",level:2}],l={toc:u};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,o.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"application-monitoring"},"Application Monitoring"),(0,r.kt)("p",null,"You could also specify the collection of monitoring requirements for the application. That can be achieved via a ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," module (or bring-your-own-module) in the ",(0,r.kt)("inlineCode",{parentName:"p"},"accessories")," field in ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," to achieve that."),(0,r.kt)("p",null,"As of version 0.11.0, Kusion supports integration with Prometheus by managing scraping behaviors in the configuration file."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"For the monitoring configuration to work (more specifically, consumed by Prometheus), this requires the target cluster to have installed Prometheus correctly, either as a Kubernetes operator or a server/agent."),(0,r.kt)("p",{parentName:"admonition"},"More about how to set up Prometheus can be found in the ",(0,r.kt)("a",{parentName:"p",href:"../user-guides/observability/prometheus"},"Prometheus User Guide for Kusion"))),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"kam")," package and the ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," Kusion Module. For more details on KCL package and module import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport monitoring as m\n")),(0,r.kt)("h2",{id:"workspace-configurations"},"Workspace configurations"),(0,r.kt)("p",null,"In addition to the KCL configuration file, there are also workspace-level configurations that should be set first. In an ideal scenario, this step is done by the platform engineers. "),(0,r.kt)("p",null,"In the event that they do not exist for you or your organization, e.g. if you are an individual developer, you can either do it yourself or use the ",(0,r.kt)("a",{parentName:"p",href:"#default-values"},"default values")," provided by the KusionStack team. The steps to do this yourself can be found in the ",(0,r.kt)("a",{parentName:"p",href:"../user-guides/observability/prometheus#setting-up-workspace-configs"},"Prometheus User Guide for Kusion"),"."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"For more details on how workspaces work, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/concepts/workspace"},"workspace concept"))),(0,r.kt)("p",null,"By separating configurations that the developers are interested in and those that platform owners are interested in, we can reduce the cognitive complexity of the application configuration and achieve separation of concern."),(0,r.kt)("p",null,"You can append the following YAML file to your own workspace configurations and update the corresponding workspace with command ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace update"),". "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n kusionstack/monitoring@v0.1.0:\n default:\n interval: 30s\n monitorType: Pod\n operatorMode: true\n scheme: http\n timeout: 15s\n")),(0,r.kt)("h2",{id:"managing-scraping-configuration"},"Managing Scraping Configuration"),(0,r.kt)("p",null,"To manage scrape configuration for the application:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n # Add the monitoring configuration backed by Prometheus\n accessories: {\n "monitoring": m.Prometheus {\n path: "/metrics"\n port: "web"\n }\n }\n}\n')),(0,r.kt)("p",null,"The example above will instruct the Prometheus job to scrape metrics from the ",(0,r.kt)("inlineCode",{parentName:"p"},"/metrics")," endpoint of the application on the port named ",(0,r.kt)("inlineCode",{parentName:"p"},"web"),"."),(0,r.kt)("p",null,"To instruct Prometheus to scrape from ",(0,r.kt)("inlineCode",{parentName:"p"},"/actuator/metrics")," on port ",(0,r.kt)("inlineCode",{parentName:"p"},"9099")," instead:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n # Add the monitoring configuration backed by Prometheus\n accessories: {\n "monitoring": m.Prometheus {\n path: "/actuator/metrics"\n port: "9099"\n }\n }\n}\n')),(0,r.kt)("p",null,"Note that numbered ports only work when your Prometheus is not running as an operator. "),(0,r.kt)("p",null,"Neither ",(0,r.kt)("inlineCode",{parentName:"p"},"path")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"port")," are required fields if Prometheus runs as an operator. If omitted, ",(0,r.kt)("inlineCode",{parentName:"p"},"path")," defaults to ",(0,r.kt)("inlineCode",{parentName:"p"},"/metrics"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"port")," defaults to the container port or service port, depending on which resource is being monitored. If Prometheus does not run as an operator, both fields are required."),(0,r.kt)("p",null,"Scraping scheme, interval and timeout are considered platform-managed configurations and are therefore managed as part of the ",(0,r.kt)("a",{parentName:"p",href:"../user-guides/observability/prometheus#setting-up-workspace-configs"},"workspace configurations"),"."),(0,r.kt)("p",null,"More details about how the Prometheus integration works can be found in the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/prometheus.md"},"design documentation"),"."),(0,r.kt)("h2",{id:"default-values"},"Default values"),(0,r.kt)("p",null,"If no workspace configurations are found, the default values provided by the KusionStack team are:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Scraping interval defaults to 30 seconds"),(0,r.kt)("li",{parentName:"ul"},"Scraping timeout defaults to 15 seconds"),(0,r.kt)("li",{parentName:"ul"},"Scraping scheme defaults to http"),(0,r.kt)("li",{parentName:"ul"},"Defaults to NOT running as an operator")),(0,r.kt)("p",null,"If any of the default values does not meet your need, you can change them by ",(0,r.kt)("a",{parentName:"p",href:"../user-guides/observability/prometheus#setting-up-workspace-configs"},"setting up the workspace configuration"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9f069a65.cd32031e.js b/assets/js/9f069a65.cd32031e.js deleted file mode 100644 index fc2771714e1..00000000000 --- a/assets/js/9f069a65.cd32031e.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[963],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>d});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=o.createContext({}),u=function(e){var t=o.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},l=function(e){var t=u(e.components);return o.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,s=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),m=u(n),d=r,h=m["".concat(s,".").concat(d)]||m[d]||c[d]||a;return n?o.createElement(h,i(i({ref:t},l),{},{components:n})):o.createElement(h,i({ref:t},l))}));function d(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,i=new Array(a);i[0]=m;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p.mdxType="string"==typeof e?e:r,i[1]=p;for(var u=2;u{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>c,frontMatter:()=>a,metadata:()=>p,toc:()=>u});var o=n(87462),r=(n(67294),n(3905));const a={},i="Application Monitoring",p={unversionedId:"configuration-walkthrough/monitoring",id:"configuration-walkthrough/monitoring",title:"Application Monitoring",description:"You could also specify the collection of monitoring requirements for the application. That can be achieved via a monitoring module (or bring-your-own-module) in the accessories field in AppConfiguration to achieve that.",source:"@site/docs/kusion/4-configuration-walkthrough/8-monitoring.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/monitoring",permalink:"/docs/next/configuration-walkthrough/monitoring",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/4-configuration-walkthrough/8-monitoring.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:8,frontMatter:{},sidebar:"kusion",previous:{title:"Secrets",permalink:"/docs/next/configuration-walkthrough/secret"},next:{title:"Operational Rules",permalink:"/docs/next/configuration-walkthrough/operational-rules"}},s={},u=[{value:"Import",id:"import",level:2},{value:"Workspace configurations",id:"workspace-configurations",level:2},{value:"Managing Scraping Configuration",id:"managing-scraping-configuration",level:2},{value:"Default values",id:"default-values",level:2}],l={toc:u};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,o.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"application-monitoring"},"Application Monitoring"),(0,r.kt)("p",null,"You could also specify the collection of monitoring requirements for the application. That can be achieved via a ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," module (or bring-your-own-module) in the ",(0,r.kt)("inlineCode",{parentName:"p"},"accessories")," field in ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," to achieve that."),(0,r.kt)("p",null,"As of version 0.11.0, Kusion supports integration with Prometheus by managing scraping behaviors in the configuration file."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"For the monitoring configuration to work (more specifically, consumed by Prometheus), this requires the target cluster to have installed Prometheus correctly, either as a Kubernetes operator or a server/agent."),(0,r.kt)("p",{parentName:"admonition"},"More about how to set up Prometheus can be found in the ",(0,r.kt)("a",{parentName:"p",href:"../user-guides/observability/prometheus"},"Prometheus User Guide for Kusion"))),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"kam")," package and the ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," Kusion Module. For more details on KCL package and module import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport monitoring as m\n")),(0,r.kt)("h2",{id:"workspace-configurations"},"Workspace configurations"),(0,r.kt)("p",null,"In addition to the KCL configuration file, there are also workspace-level configurations that should be set first. In an ideal scenario, this step is done by the platform engineers. "),(0,r.kt)("p",null,"In the event that they do not exist for you or your organization, e.g. if you are an individual developer, you can either do it yourself or use the ",(0,r.kt)("a",{parentName:"p",href:"#default-values"},"default values")," provided by the KusionStack team. The steps to do this yourself can be found in the ",(0,r.kt)("a",{parentName:"p",href:"../user-guides/observability/prometheus#setting-up-workspace-configs"},"Prometheus User Guide for Kusion"),"."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"For more details on how workspaces work, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/concepts/workspace"},"workspace concept"))),(0,r.kt)("p",null,"By separating configurations that the developers are interested in and those that platform owners are interested in, we can reduce the cognitive complexity of the application configuration and achieve separation of concern."),(0,r.kt)("p",null,"You can append the following YAML file to your own workspace configurations and update the corresponding workspace with command ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace update"),". "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n kusionstack/monitoring@v0.1.0:\n default:\n interval: 30s\n monitorType: Pod\n operatorMode: true\n scheme: http\n timeout: 15s\n")),(0,r.kt)("h2",{id:"managing-scraping-configuration"},"Managing Scraping Configuration"),(0,r.kt)("p",null,"To manage scrape configuration for the application:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n # Add the monitoring configuration backed by Prometheus\n accessories: {\n "monitoring": m.Prometheus {\n path: "/metrics"\n port: "web"\n }\n }\n}\n')),(0,r.kt)("p",null,"The example above will instruct the Prometheus job to scrape metrics from the ",(0,r.kt)("inlineCode",{parentName:"p"},"/metrics")," endpoint of the application on the port named ",(0,r.kt)("inlineCode",{parentName:"p"},"web"),"."),(0,r.kt)("p",null,"To instruct Prometheus to scrape from ",(0,r.kt)("inlineCode",{parentName:"p"},"/actuator/metrics")," on port ",(0,r.kt)("inlineCode",{parentName:"p"},"9099")," instead:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n # Add the monitoring configuration backed by Prometheus\n accessories: {\n "monitoring": m.Prometheus {\n path: "/actuator/metrics"\n port: "9099"\n }\n }\n}\n')),(0,r.kt)("p",null,"Note that numbered ports only work when your Prometheus is not running as an operator. "),(0,r.kt)("p",null,"Neither ",(0,r.kt)("inlineCode",{parentName:"p"},"path")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"port")," are required fields if Prometheus runs as an operator. If omitted, ",(0,r.kt)("inlineCode",{parentName:"p"},"path")," defaults to ",(0,r.kt)("inlineCode",{parentName:"p"},"/metrics"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"port")," defaults to the container port or service port, depending on which resource is being monitored. If Prometheus does not run as an operator, both fields are required."),(0,r.kt)("p",null,"Scraping scheme, interval and timeout are considered platform-managed configurations and are therefore managed as part of the ",(0,r.kt)("a",{parentName:"p",href:"../user-guides/observability/prometheus#setting-up-workspace-configs"},"workspace configurations"),"."),(0,r.kt)("p",null,"More details about how the Prometheus integration works can be found in the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/prometheus.md"},"design documentation"),"."),(0,r.kt)("h2",{id:"default-values"},"Default values"),(0,r.kt)("p",null,"If no workspace configurations are found, the default values provided by the KusionStack team are:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Scraping interval defaults to 30 seconds"),(0,r.kt)("li",{parentName:"ul"},"Scraping timeout defaults to 15 seconds"),(0,r.kt)("li",{parentName:"ul"},"Scraping scheme defaults to http"),(0,r.kt)("li",{parentName:"ul"},"Defaults to NOT running as an operator")),(0,r.kt)("p",null,"If any of the default values does not meet your need, you can change them by ",(0,r.kt)("a",{parentName:"p",href:"../user-guides/observability/prometheus#setting-up-workspace-configs"},"setting up the workspace configuration"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9f0c4bd9.fc5837ef.js b/assets/js/9f0c4bd9.5d0af657.js similarity index 56% rename from assets/js/9f0c4bd9.fc5837ef.js rename to assets/js/9f0c4bd9.5d0af657.js index ae8a14b2232..02dba53182b 100644 --- a/assets/js/9f0c4bd9.fc5837ef.js +++ b/assets/js/9f0c4bd9.5d0af657.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5742],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},l=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,s=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),f=p(n),m=o,d=f["".concat(s,".").concat(m)]||f[m]||u[m]||i;return n?r.createElement(d,a(a({ref:t},l),{},{components:n})):r.createElement(d,a({ref:t},l))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=f;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>c,toc:()=>p});var r=n(87462),o=(n(67294),n(3905));const i={},a="kusion config get",c={unversionedId:"reference/commands/kusion-config-get",id:"reference/commands/kusion-config-get",title:"kusion config get",description:"Get a config item",source:"@site/docs/kusion/6-reference/1-commands/kusion-config-get.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-config-get",permalink:"/docs/next/reference/commands/kusion-config-get",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-config-get.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion apply",permalink:"/docs/next/reference/commands/kusion-apply"},next:{title:"kusion config list",permalink:"/docs/next/reference/commands/kusion-config-list"}},s={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-config-get"},"kusion config get"),(0,o.kt)("p",null,"Get a config item"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command gets the value of a specified kusion config item, where the config item must be registered."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion config get\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Get a config item\n kusion config get backends.current\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for get\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-config"},"kusion config"),"\t - Interact with the Kusion config")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5742],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},l=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,s=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),f=p(n),m=o,d=f["".concat(s,".").concat(m)]||f[m]||u[m]||i;return n?r.createElement(d,a(a({ref:t},l),{},{components:n})):r.createElement(d,a({ref:t},l))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=f;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>c,toc:()=>p});var r=n(87462),o=(n(67294),n(3905));const i={},a="kusion config get",c={unversionedId:"reference/commands/kusion-config-get",id:"reference/commands/kusion-config-get",title:"kusion config get",description:"Get a config item",source:"@site/docs/kusion/6-reference/1-commands/kusion-config-get.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-config-get",permalink:"/docs/next/reference/commands/kusion-config-get",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-config-get.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion apply",permalink:"/docs/next/reference/commands/kusion-apply"},next:{title:"kusion config list",permalink:"/docs/next/reference/commands/kusion-config-list"}},s={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-config-get"},"kusion config get"),(0,o.kt)("p",null,"Get a config item"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command gets the value of a specified kusion config item, where the config item must be registered."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion config get\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Get a config item\n kusion config get backends.current\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for get\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-config"},"kusion config"),"\t - Interact with the Kusion config")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a08f9b67.6358c955.js b/assets/js/a08f9b67.6358c955.js deleted file mode 100644 index 068fe7096cf..00000000000 --- a/assets/js/a08f9b67.6358c955.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6107],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>k});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),d=p(r),k=o,m=d["".concat(i,".").concat(k)]||d[k]||u[k]||a;return r?n.createElement(m,s(s({ref:t},l),{},{components:r})):n.createElement(m,s({ref:t},l))}));function k(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=d;var c={};for(var i in t)hasOwnProperty.call(t,i)&&(c[i]=t[i]);c.originalType=e,c.mdxType="string"==typeof e?e:o,s[1]=c;for(var p=2;p{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion workspace",c={unversionedId:"reference/commands/kusion-workspace",id:"reference/commands/kusion-workspace",title:"kusion workspace",description:"Workspace is a logical concept representing a target that stacks will be deployed to",source:"@site/docs/kusion/6-reference/1-commands/kusion-workspace.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace",permalink:"/docs/next/reference/commands/kusion-workspace",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-workspace.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace update",permalink:"/docs/next/reference/commands/kusion-workspace-update"},next:{title:"Kusion Modules",permalink:"/docs/next/reference/modules/"}},i={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace"},"kusion workspace"),(0,o.kt)("p",null,"Workspace is a logical concept representing a target that stacks will be deployed to"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Workspace is a logical concept representing a target that stacks will be deployed to."),(0,o.kt)("p",null," Workspace is managed by platform engineers, which contains a set of configurations that application developers do not want or should not concern, and is reused by multiple stacks belonging to different projects."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace [flags]\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for workspace\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-workspace-create"},"kusion workspace create"),"\t - Create a new workspace"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-workspace-delete"},"kusion workspace delete"),"\t - Delete a workspace"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-workspace-list"},"kusion workspace list"),"\t - List all workspace names"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-workspace-show"},"kusion workspace show"),"\t - Show a workspace configuration"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-workspace-switch"},"kusion workspace switch"),"\t - Switch the current workspace"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-workspace-update"},"kusion workspace update"),"\t - Update a workspace configuration")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a08f9b67.a413e8c6.js b/assets/js/a08f9b67.a413e8c6.js new file mode 100644 index 00000000000..66f63188646 --- /dev/null +++ b/assets/js/a08f9b67.a413e8c6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6107],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>k});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),d=p(r),k=o,m=d["".concat(i,".").concat(k)]||d[k]||u[k]||a;return r?n.createElement(m,s(s({ref:t},l),{},{components:r})):n.createElement(m,s({ref:t},l))}));function k(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=d;var c={};for(var i in t)hasOwnProperty.call(t,i)&&(c[i]=t[i]);c.originalType=e,c.mdxType="string"==typeof e?e:o,s[1]=c;for(var p=2;p{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion workspace",c={unversionedId:"reference/commands/kusion-workspace",id:"reference/commands/kusion-workspace",title:"kusion workspace",description:"Workspace is a logical concept representing a target that stacks will be deployed to",source:"@site/docs/kusion/6-reference/1-commands/kusion-workspace.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace",permalink:"/docs/next/reference/commands/kusion-workspace",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-workspace.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace update",permalink:"/docs/next/reference/commands/kusion-workspace-update"},next:{title:"Kusion Modules",permalink:"/docs/next/reference/modules/"}},i={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace"},"kusion workspace"),(0,o.kt)("p",null,"Workspace is a logical concept representing a target that stacks will be deployed to"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Workspace is a logical concept representing a target that stacks will be deployed to."),(0,o.kt)("p",null," Workspace is managed by platform engineers, which contains a set of configurations that application developers do not want or should not concern, and is reused by multiple stacks belonging to different projects."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace [flags]\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for workspace\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-workspace-create"},"kusion workspace create"),"\t - Create a new workspace"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-workspace-delete"},"kusion workspace delete"),"\t - Delete a workspace"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-workspace-list"},"kusion workspace list"),"\t - List all workspace names"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-workspace-show"},"kusion workspace show"),"\t - Show a workspace configuration"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-workspace-switch"},"kusion workspace switch"),"\t - Switch the current workspace"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-workspace-update"},"kusion workspace update"),"\t - Update a workspace configuration")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a0ca06fd.442ef2f5.js b/assets/js/a0ca06fd.442ef2f5.js deleted file mode 100644 index de876fc96bb..00000000000 --- a/assets/js/a0ca06fd.442ef2f5.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9032],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>h});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=o.createContext({}),l=function(e){var t=o.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},c=function(e){var t=l(e.components);return o.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),m=l(n),h=r,d=m["".concat(s,".").concat(h)]||m[h]||u[h]||i;return n?o.createElement(d,a(a({ref:t},c),{},{components:n})):o.createElement(d,a({ref:t},c))}));function h(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,a=new Array(i);a[0]=m;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p.mdxType="string"==typeof e?e:r,a[1]=p;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>p,toc:()=>l});var o=n(87462),r=(n(67294),n(3905));const i={sidebar_position:8},a="Application Monitoring",p={unversionedId:"config-walkthrough/monitoring",id:"version-v0.9/config-walkthrough/monitoring",title:"Application Monitoring",description:"The monitoring attribute in the AppConfiguration instance is used to describe the specification for the collection of monitoring requirements for the application.",source:"@site/docs_versioned_docs/version-v0.9/config-walkthrough/monitoring.md",sourceDirName:"config-walkthrough",slug:"/config-walkthrough/monitoring",permalink:"/docs/v0.9/config-walkthrough/monitoring",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/config-walkthrough/monitoring.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:8,frontMatter:{sidebar_position:8},sidebar:"kusion",previous:{title:"Secret Management",permalink:"/docs/v0.9/config-walkthrough/secret"},next:{title:"Operational Rules",permalink:"/docs/v0.9/config-walkthrough/operational_rules"}},s={},l=[{value:"Import",id:"import",level:2},{value:"Project-level configurations",id:"project-level-configurations",level:2},{value:"Operator mode",id:"operator-mode",level:3},{value:"Monitor types",id:"monitor-types",level:3},{value:"Managing Scraping Configuration",id:"managing-scraping-configuration",level:2}],c={toc:l};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,o.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"application-monitoring"},"Application Monitoring"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," attribute in the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance is used to describe the specification for the collection of monitoring requirements for the application."),(0,r.kt)("p",null,"As of version 0.9.0, Kusion supports integration with Prometheus by managing scraping behaviors in the configuration file."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"The ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," attribute requires the target cluster to have installed Prometheus correctly, either as a Kubernetes operator or a server/agent."),(0,r.kt)("p",{parentName:"admonition"},"More about how to set up Prometheus can be found in the ",(0,r.kt)("a",{parentName:"p",href:"../guides/observability/prometheus"},"Prometheus User Guide for Kusion"))),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"catalog")," package. For more details on KCL package import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"../config-walkthrough/overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.monitoring as m\n")),(0,r.kt)("h2",{id:"project-level-configurations"},"Project-level configurations"),(0,r.kt)("p",null,"In addition to the KCL configuration file, there are also project-level configurations that can be set in the ",(0,r.kt)("inlineCode",{parentName:"p"},"project.yaml")," in hte project root directory."),(0,r.kt)("p",null,"By separating configurations that the developers are interested in and those that platform owners are interested in, we can reduce the cognitive complexity of the application configuration and achieve separation of concern."),(0,r.kt)("p",null,"In the context of ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring"),", there are two flags you can set in ",(0,r.kt)("inlineCode",{parentName:"p"},"project.yaml")," that will alter the behavior of Kusion."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"If you have initialized the projects with ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion init"),", the ",(0,r.kt)("inlineCode",{parentName:"p"},"project.yaml")," should be automatically created for you.")),(0,r.kt)("h3",{id:"operator-mode"},"Operator mode"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," flag indicates to Kusion whether the Prometheus instance installed in the cluster runs as a Kubernetes operator or not. This determines the different kinds of resources Kusion manages."),(0,r.kt)("p",null,"To see more about different ways to run Prometheus in the Kubernetes cluster, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/prometheus.md#prometheus-installation"},"design documentation"),"."),(0,r.kt)("p",null,"Most cloud vendors provide an out-of-the-box monitoring solutions for workloads running in a managed-Kubernetes cluster (EKS, AKS, etc), such as AWS CloudWatch, Azure Monitor, etc. These solutions mostly involve installing an agent (CloudWatch Agent, OMS Agent, etc) in the cluster and collecting the metrics to a centralized monitoring server. In those cases, you don't need to set ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," to ",(0,r.kt)("inlineCode",{parentName:"p"},"True"),". It only needs to be set to ",(0,r.kt)("inlineCode",{parentName:"p"},"True")," when you have an installation of the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator"},"Prometheus operator")," running inside the Kubernetes cluster."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"For differences between ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator"},"Prometheus operator"),", ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/kube-prometheus"},"kube-prometheus")," and the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack"},"community kube-prometheus-stack helm chart"),", the details are documented ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator#prometheus-operator-vs-kube-prometheus-vs-community-helm-chart"},"here"),".")),(0,r.kt)("h3",{id:"monitor-types"},"Monitor types"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"monitorType")," flag indicates the kind of monitor Kusion will create. It only applies when ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," is set to ",(0,r.kt)("inlineCode",{parentName:"p"},"True"),". As of version 0.9.0, Kusion provides options to scrape metrics from either the application pods or its corresponding Kubernetes services. This determines the different kinds of resources Kusion manages when Prometheus runs as an operator in the target cluster."),(0,r.kt)("p",null,"A sample ",(0,r.kt)("inlineCode",{parentName:"p"},"project.yaml")," with Prometheus settings:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"# The project basic info\nname: multi-stack-project\ngenerator:\n type: AppConfiguration\nprometheus:\n operatorMode: True\n monitorType: Service\n")),(0,r.kt)("p",null,"To instruct Prometheus to scrape from pod targets instead:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"# The project basic info\nname: multi-stack-project\ngenerator:\n type: AppConfiguration\nprometheus:\n operatorMode: True\n monitorType: Pod\n")),(0,r.kt)("p",null,"If the ",(0,r.kt)("inlineCode",{parentName:"p"},"prometheus")," section is missing from the ",(0,r.kt)("inlineCode",{parentName:"p"},"project.yaml"),", Kusion defaults ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," to false."),(0,r.kt)("h2",{id:"managing-scraping-configuration"},"Managing Scraping Configuration"),(0,r.kt)("p",null,"To create scrape configuration for the application:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n monitoring: m.Prometheus{\n interval: "30s"\n timeout: "15s"\n path: "/metrics"\n port: "web"\n scheme: "http"\n }\n}\n')),(0,r.kt)("p",null,"The example above will instruct the Prometheus job to scrape metrics from the ",(0,r.kt)("inlineCode",{parentName:"p"},"/metrics")," endpoint of the application every 30 seconds."),(0,r.kt)("p",null,"To instruct Prometheus to scrape from ",(0,r.kt)("inlineCode",{parentName:"p"},"actuator/metrics")," on port ",(0,r.kt)("inlineCode",{parentName:"p"},"9099")," instead:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n monitoring: m.Prometheus{\n interval: "10s"\n timeout: "5s"\n path: "/actuator/metrics"\n port: "9099"\n scheme: "http"\n }\n}\n')),(0,r.kt)("p",null,"More details about how the Prometheus integration works can be found in the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/prometheus"},"design documentation"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a0ca06fd.7662ee3d.js b/assets/js/a0ca06fd.7662ee3d.js new file mode 100644 index 00000000000..918bc590928 --- /dev/null +++ b/assets/js/a0ca06fd.7662ee3d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9032],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>h});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=o.createContext({}),l=function(e){var t=o.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},c=function(e){var t=l(e.components);return o.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),m=l(n),h=r,d=m["".concat(s,".").concat(h)]||m[h]||u[h]||i;return n?o.createElement(d,a(a({ref:t},c),{},{components:n})):o.createElement(d,a({ref:t},c))}));function h(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,a=new Array(i);a[0]=m;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p.mdxType="string"==typeof e?e:r,a[1]=p;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>p,toc:()=>l});var o=n(87462),r=(n(67294),n(3905));const i={sidebar_position:8},a="Application Monitoring",p={unversionedId:"config-walkthrough/monitoring",id:"version-v0.9/config-walkthrough/monitoring",title:"Application Monitoring",description:"The monitoring attribute in the AppConfiguration instance is used to describe the specification for the collection of monitoring requirements for the application.",source:"@site/docs_versioned_docs/version-v0.9/config-walkthrough/monitoring.md",sourceDirName:"config-walkthrough",slug:"/config-walkthrough/monitoring",permalink:"/docs/v0.9/config-walkthrough/monitoring",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/config-walkthrough/monitoring.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:8,frontMatter:{sidebar_position:8},sidebar:"kusion",previous:{title:"Secret Management",permalink:"/docs/v0.9/config-walkthrough/secret"},next:{title:"Operational Rules",permalink:"/docs/v0.9/config-walkthrough/operational_rules"}},s={},l=[{value:"Import",id:"import",level:2},{value:"Project-level configurations",id:"project-level-configurations",level:2},{value:"Operator mode",id:"operator-mode",level:3},{value:"Monitor types",id:"monitor-types",level:3},{value:"Managing Scraping Configuration",id:"managing-scraping-configuration",level:2}],c={toc:l};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,o.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"application-monitoring"},"Application Monitoring"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," attribute in the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance is used to describe the specification for the collection of monitoring requirements for the application."),(0,r.kt)("p",null,"As of version 0.9.0, Kusion supports integration with Prometheus by managing scraping behaviors in the configuration file."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"The ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," attribute requires the target cluster to have installed Prometheus correctly, either as a Kubernetes operator or a server/agent."),(0,r.kt)("p",{parentName:"admonition"},"More about how to set up Prometheus can be found in the ",(0,r.kt)("a",{parentName:"p",href:"../guides/observability/prometheus"},"Prometheus User Guide for Kusion"))),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"catalog")," package. For more details on KCL package import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"../config-walkthrough/overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.monitoring as m\n")),(0,r.kt)("h2",{id:"project-level-configurations"},"Project-level configurations"),(0,r.kt)("p",null,"In addition to the KCL configuration file, there are also project-level configurations that can be set in the ",(0,r.kt)("inlineCode",{parentName:"p"},"project.yaml")," in hte project root directory."),(0,r.kt)("p",null,"By separating configurations that the developers are interested in and those that platform owners are interested in, we can reduce the cognitive complexity of the application configuration and achieve separation of concern."),(0,r.kt)("p",null,"In the context of ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring"),", there are two flags you can set in ",(0,r.kt)("inlineCode",{parentName:"p"},"project.yaml")," that will alter the behavior of Kusion."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"If you have initialized the projects with ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion init"),", the ",(0,r.kt)("inlineCode",{parentName:"p"},"project.yaml")," should be automatically created for you.")),(0,r.kt)("h3",{id:"operator-mode"},"Operator mode"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," flag indicates to Kusion whether the Prometheus instance installed in the cluster runs as a Kubernetes operator or not. This determines the different kinds of resources Kusion manages."),(0,r.kt)("p",null,"To see more about different ways to run Prometheus in the Kubernetes cluster, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/prometheus.md#prometheus-installation"},"design documentation"),"."),(0,r.kt)("p",null,"Most cloud vendors provide an out-of-the-box monitoring solutions for workloads running in a managed-Kubernetes cluster (EKS, AKS, etc), such as AWS CloudWatch, Azure Monitor, etc. These solutions mostly involve installing an agent (CloudWatch Agent, OMS Agent, etc) in the cluster and collecting the metrics to a centralized monitoring server. In those cases, you don't need to set ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," to ",(0,r.kt)("inlineCode",{parentName:"p"},"True"),". It only needs to be set to ",(0,r.kt)("inlineCode",{parentName:"p"},"True")," when you have an installation of the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator"},"Prometheus operator")," running inside the Kubernetes cluster."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"For differences between ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator"},"Prometheus operator"),", ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/kube-prometheus"},"kube-prometheus")," and the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack"},"community kube-prometheus-stack helm chart"),", the details are documented ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator#prometheus-operator-vs-kube-prometheus-vs-community-helm-chart"},"here"),".")),(0,r.kt)("h3",{id:"monitor-types"},"Monitor types"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"monitorType")," flag indicates the kind of monitor Kusion will create. It only applies when ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," is set to ",(0,r.kt)("inlineCode",{parentName:"p"},"True"),". As of version 0.9.0, Kusion provides options to scrape metrics from either the application pods or its corresponding Kubernetes services. This determines the different kinds of resources Kusion manages when Prometheus runs as an operator in the target cluster."),(0,r.kt)("p",null,"A sample ",(0,r.kt)("inlineCode",{parentName:"p"},"project.yaml")," with Prometheus settings:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"# The project basic info\nname: multi-stack-project\ngenerator:\n type: AppConfiguration\nprometheus:\n operatorMode: True\n monitorType: Service\n")),(0,r.kt)("p",null,"To instruct Prometheus to scrape from pod targets instead:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"# The project basic info\nname: multi-stack-project\ngenerator:\n type: AppConfiguration\nprometheus:\n operatorMode: True\n monitorType: Pod\n")),(0,r.kt)("p",null,"If the ",(0,r.kt)("inlineCode",{parentName:"p"},"prometheus")," section is missing from the ",(0,r.kt)("inlineCode",{parentName:"p"},"project.yaml"),", Kusion defaults ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," to false."),(0,r.kt)("h2",{id:"managing-scraping-configuration"},"Managing Scraping Configuration"),(0,r.kt)("p",null,"To create scrape configuration for the application:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n monitoring: m.Prometheus{\n interval: "30s"\n timeout: "15s"\n path: "/metrics"\n port: "web"\n scheme: "http"\n }\n}\n')),(0,r.kt)("p",null,"The example above will instruct the Prometheus job to scrape metrics from the ",(0,r.kt)("inlineCode",{parentName:"p"},"/metrics")," endpoint of the application every 30 seconds."),(0,r.kt)("p",null,"To instruct Prometheus to scrape from ",(0,r.kt)("inlineCode",{parentName:"p"},"actuator/metrics")," on port ",(0,r.kt)("inlineCode",{parentName:"p"},"9099")," instead:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n monitoring: m.Prometheus{\n interval: "10s"\n timeout: "5s"\n path: "/actuator/metrics"\n port: "9099"\n scheme: "http"\n }\n}\n')),(0,r.kt)("p",null,"More details about how the Prometheus integration works can be found in the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/prometheus"},"design documentation"),"."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a104d7e6.45f528cc.js b/assets/js/a104d7e6.45f528cc.js deleted file mode 100644 index c08447ca738..00000000000 --- a/assets/js/a104d7e6.45f528cc.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6773],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>d});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),l=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},p=function(e){var n=l(e.components);return r.createElement(c.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},m=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),m=l(t),d=o,f=m["".concat(c,".").concat(d)]||m[d]||u[d]||a;return t?r.createElement(f,i(i({ref:n},p),{},{components:t})):r.createElement(f,i({ref:n},p))}));function d(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=m;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=t(87462),o=(t(67294),t(3905));const a={},i="kusion mod",s={unversionedId:"reference/commands/kusion-mod",id:"reference/commands/kusion-mod",title:"kusion mod",description:"Manage Kusion modules",source:"@site/docs/kusion/6-reference/1-commands/kusion-mod.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-mod",permalink:"/docs/next/reference/commands/kusion-mod",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-mod.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion mod push",permalink:"/docs/next/reference/commands/kusion-mod-push"},next:{title:"kusion options",permalink:"/docs/next/reference/commands/kusion-options"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:l};function u(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-mod"},"kusion mod"),(0,o.kt)("p",null,"Manage Kusion modules"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," Commands for managing Kusion modules.\n\n These commands help you manage the lifecycle of Kusion modules.\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion mod\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for mod\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-mod-init"},"kusion mod init"),"\t - Create a kusion module along with common files and directories in the current directory"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-mod-push"},"kusion mod push"),"\t - Push a module to OCI registry")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a104d7e6.5c0b558b.js b/assets/js/a104d7e6.5c0b558b.js new file mode 100644 index 00000000000..c2d7564f503 --- /dev/null +++ b/assets/js/a104d7e6.5c0b558b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6773],{3905:(e,n,t)=>{t.d(n,{Zo:()=>l,kt:()=>d});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),p=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},l=function(e){var n=p(e.components);return r.createElement(c.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},m=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),m=p(t),d=o,f=m["".concat(c,".").concat(d)]||m[d]||u[d]||a;return t?r.createElement(f,i(i({ref:n},l),{},{components:t})):r.createElement(f,i({ref:n},l))}));function d(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=m;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var p=2;p{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var r=t(87462),o=(t(67294),t(3905));const a={},i="kusion mod",s={unversionedId:"reference/commands/kusion-mod",id:"reference/commands/kusion-mod",title:"kusion mod",description:"Manage Kusion modules",source:"@site/docs/kusion/6-reference/1-commands/kusion-mod.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-mod",permalink:"/docs/next/reference/commands/kusion-mod",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-mod.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion mod push",permalink:"/docs/next/reference/commands/kusion-mod-push"},next:{title:"kusion options",permalink:"/docs/next/reference/commands/kusion-options"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},l,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-mod"},"kusion mod"),(0,o.kt)("p",null,"Manage Kusion modules"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," Commands for managing Kusion modules.\n\n These commands help you manage the lifecycle of Kusion modules.\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion mod\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for mod\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-mod-init"},"kusion mod init"),"\t - Create a kusion module along with common files and directories in the current directory"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-mod-push"},"kusion mod push"),"\t - Push a module to OCI registry")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a121ee0b.1e882ad3.js b/assets/js/a121ee0b.1e882ad3.js deleted file mode 100644 index 93e9e2e6af9..00000000000 --- a/assets/js/a121ee0b.1e882ad3.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2180],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),c=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=c(e.components);return a.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=c(n),m=r,k=d["".concat(l,".").concat(m)]||d[m]||u[m]||i;return n?a.createElement(k,o(o({ref:t},p),{},{components:n})):a.createElement(k,o({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var a=n(87462),r=(n(67294),n(3905));const i={id:"configuration",sidebar_label:"Stack file reference"},o="Kusion stack file reference",s={unversionedId:"concepts/stack/configuration",id:"concepts/stack/configuration",title:"Kusion stack file reference",description:"Every Kusion project's stack has a stack file, stack.yaml, which specifies metadata about your stack, such as the stack name and stack description. The stack file must begin with lowercase stack and have an extension of either .yaml or .yml.",source:"@site/docs/kusion/3-concepts/2-stack/2-configuration.md",sourceDirName:"3-concepts/2-stack",slug:"/concepts/stack/configuration",permalink:"/docs/next/concepts/stack/configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/3-concepts/2-stack/2-configuration.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"configuration",sidebar_label:"Stack file reference"},sidebar:"kusion",previous:{title:"Overview",permalink:"/docs/next/concepts/stack/overview"},next:{title:"Overview",permalink:"/docs/next/concepts/kusion-module/overview"}},l={},c=[{value:"Attributes",id:"attributes",level:2},{value:"Extensions",id:"extensions",level:3},{value:"kubernetesNamespace",id:"kubernetesnamespace",level:4}],p={toc:c};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"kusion-stack-file-reference"},"Kusion stack file reference"),(0,r.kt)("p",null,"Every Kusion project's stack has a stack file, ",(0,r.kt)("inlineCode",{parentName:"p"},"stack.yaml"),", which specifies metadata about your stack, such as the stack name and stack description. The stack file must begin with lowercase ",(0,r.kt)("inlineCode",{parentName:"p"},"stack")," and have an extension of either ",(0,r.kt)("inlineCode",{parentName:"p"},".yaml")," or ",(0,r.kt)("inlineCode",{parentName:"p"},".yml"),"."),(0,r.kt)("h2",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Required"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Options"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},"required"),(0,r.kt)("td",{parentName:"tr",align:"left"},"Name of the stack containing alphanumeric characters, hyphens, underscores."),(0,r.kt)("td",{parentName:"tr",align:"left"},"None")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"description")),(0,r.kt)("td",{parentName:"tr",align:"left"},"optional"),(0,r.kt)("td",{parentName:"tr",align:"left"},"A brief description of the stack."),(0,r.kt)("td",{parentName:"tr",align:"left"},"None")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"extensions")),(0,r.kt)("td",{parentName:"tr",align:"left"},"optional"),(0,r.kt)("td",{parentName:"tr",align:"left"},"List of extensions on the stack."),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"#extensions"},"See blow"))))),(0,r.kt)("h3",{id:"extensions"},"Extensions"),(0,r.kt)("p",null,"Extensions allow you to customize how resources are generated or customized as part of release."),(0,r.kt)("h4",{id:"kubernetesnamespace"},"kubernetesNamespace"),(0,r.kt)("p",null,"The Kubernetes namespace extension allows you to customize namespace within your application generate Kubernetes resources. "),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Key"),(0,r.kt)("th",{parentName:"tr",align:"center"},"Required"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},"kind"),(0,r.kt)("td",{parentName:"tr",align:"center"},"y"),(0,r.kt)("td",{parentName:"tr",align:"left"},"The kind of extension being used. Must be 'kubernetesNamespace'"),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"kubernetesNamespace"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},"namespace"),(0,r.kt)("td",{parentName:"tr",align:"center"},"y"),(0,r.kt)("td",{parentName:"tr",align:"left"},"The namespace where all application-scoped resources generate Kubernetes objects."),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"default"))))))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a121ee0b.7047d8dc.js b/assets/js/a121ee0b.7047d8dc.js new file mode 100644 index 00000000000..417441186a5 --- /dev/null +++ b/assets/js/a121ee0b.7047d8dc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2180],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=a.createContext({}),l=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=l(e.components);return a.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=l(n),m=r,k=d["".concat(c,".").concat(m)]||d[m]||u[m]||i;return n?a.createElement(k,o(o({ref:t},p),{},{components:n})):a.createElement(k,o({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,o=new Array(i);o[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var a=n(87462),r=(n(67294),n(3905));const i={id:"configuration",sidebar_label:"Stack file reference"},o="Kusion stack file reference",s={unversionedId:"concepts/stack/configuration",id:"concepts/stack/configuration",title:"Kusion stack file reference",description:"Every Kusion project's stack has a stack file, stack.yaml, which specifies metadata about your stack, such as the stack name and stack description. The stack file must begin with lowercase stack and have an extension of either .yaml or .yml.",source:"@site/docs/kusion/3-concepts/2-stack/2-configuration.md",sourceDirName:"3-concepts/2-stack",slug:"/concepts/stack/configuration",permalink:"/docs/next/concepts/stack/configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/3-concepts/2-stack/2-configuration.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"configuration",sidebar_label:"Stack file reference"},sidebar:"kusion",previous:{title:"Overview",permalink:"/docs/next/concepts/stack/overview"},next:{title:"Overview",permalink:"/docs/next/concepts/kusion-module/overview"}},c={},l=[{value:"Attributes",id:"attributes",level:2},{value:"Extensions",id:"extensions",level:3},{value:"kubernetesNamespace",id:"kubernetesnamespace",level:4}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"kusion-stack-file-reference"},"Kusion stack file reference"),(0,r.kt)("p",null,"Every Kusion project's stack has a stack file, ",(0,r.kt)("inlineCode",{parentName:"p"},"stack.yaml"),", which specifies metadata about your stack, such as the stack name and stack description. The stack file must begin with lowercase ",(0,r.kt)("inlineCode",{parentName:"p"},"stack")," and have an extension of either ",(0,r.kt)("inlineCode",{parentName:"p"},".yaml")," or ",(0,r.kt)("inlineCode",{parentName:"p"},".yml"),"."),(0,r.kt)("h2",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Required"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Options"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},"required"),(0,r.kt)("td",{parentName:"tr",align:"left"},"Name of the stack containing alphanumeric characters, hyphens, underscores."),(0,r.kt)("td",{parentName:"tr",align:"left"},"None")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"description")),(0,r.kt)("td",{parentName:"tr",align:"left"},"optional"),(0,r.kt)("td",{parentName:"tr",align:"left"},"A brief description of the stack."),(0,r.kt)("td",{parentName:"tr",align:"left"},"None")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"extensions")),(0,r.kt)("td",{parentName:"tr",align:"left"},"optional"),(0,r.kt)("td",{parentName:"tr",align:"left"},"List of extensions on the stack."),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"#extensions"},"See blow"))))),(0,r.kt)("h3",{id:"extensions"},"Extensions"),(0,r.kt)("p",null,"Extensions allow you to customize how resources are generated or customized as part of release."),(0,r.kt)("h4",{id:"kubernetesnamespace"},"kubernetesNamespace"),(0,r.kt)("p",null,"The Kubernetes namespace extension allows you to customize namespace within your application generate Kubernetes resources. "),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Key"),(0,r.kt)("th",{parentName:"tr",align:"center"},"Required"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Example"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},"kind"),(0,r.kt)("td",{parentName:"tr",align:"center"},"y"),(0,r.kt)("td",{parentName:"tr",align:"left"},"The kind of extension being used. Must be 'kubernetesNamespace'"),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"kubernetesNamespace"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},"namespace"),(0,r.kt)("td",{parentName:"tr",align:"center"},"y"),(0,r.kt)("td",{parentName:"tr",align:"left"},"The namespace where all application-scoped resources generate Kubernetes objects."),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"default"))))))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a28f322c.12c6f0b8.js b/assets/js/a28f322c.12c6f0b8.js new file mode 100644 index 00000000000..97942c65fc1 --- /dev/null +++ b/assets/js/a28f322c.12c6f0b8.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[905],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(r),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(f,s(s({ref:t},p),{},{components:r})):n.createElement(f,s({ref:t},p))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion destroy",i={unversionedId:"reference/commands/kusion-destroy",id:"reference/commands/kusion-destroy",title:"kusion destroy",description:"Destroy resources within the stack.",source:"@site/docs/kusion/6-reference/1-commands/kusion-destroy.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-destroy",permalink:"/docs/next/reference/commands/kusion-destroy",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-destroy.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion config",permalink:"/docs/next/reference/commands/kusion-config"},next:{title:"kusion generate",permalink:"/docs/next/reference/commands/kusion-generate"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:l};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-destroy"},"kusion destroy"),(0,o.kt)("p",null,"Destroy resources within the stack."),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Destroy resources within the stack."),(0,o.kt)("p",null," Please note that the destroy command does NOT perform resource version checks. Therefore, if someone submits an update to a resource at the same time you execute a destroy command, their update will be lost along with the rest of the resource."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion destroy [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Delete resources of current stack\n kusion destroy\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string The backend to use, supports 'local', 'oss' and 's3'.\n -d, --detail Automatically show preview details after previewing it\n -h, --help help for destroy\n --no-style no-style sets to RawOutput mode and disables all of styling\n --operator string Specify the operator\n -w, --workdir string The work directory to run Kusion CLI.\n --workspace string The name of target workspace to operate in.\n -y, --yes Automatically approve and perform the update after previewing it\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a28f322c.a1e5c3f8.js b/assets/js/a28f322c.a1e5c3f8.js deleted file mode 100644 index ae135449d2f..00000000000 --- a/assets/js/a28f322c.a1e5c3f8.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[905],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(r),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(f,s(s({ref:t},p),{},{components:r})):n.createElement(f,s({ref:t},p))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion destroy",i={unversionedId:"reference/commands/kusion-destroy",id:"reference/commands/kusion-destroy",title:"kusion destroy",description:"Destroy resources within the stack.",source:"@site/docs/kusion/6-reference/1-commands/kusion-destroy.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-destroy",permalink:"/docs/next/reference/commands/kusion-destroy",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-destroy.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion config",permalink:"/docs/next/reference/commands/kusion-config"},next:{title:"kusion generate",permalink:"/docs/next/reference/commands/kusion-generate"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:l};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-destroy"},"kusion destroy"),(0,o.kt)("p",null,"Destroy resources within the stack."),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Destroy resources within the stack."),(0,o.kt)("p",null," Please note that the destroy command does NOT perform resource version checks. Therefore, if someone submits an update to a resource at the same time you execute a destroy command, their update will be lost along with the rest of the resource."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion destroy [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Delete resources of current stack\n kusion destroy\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string The backend to use, supports 'local', 'oss' and 's3'.\n -d, --detail Automatically show preview details after previewing it\n -h, --help help for destroy\n --no-style no-style sets to RawOutput mode and disables all of styling\n --operator string Specify the operator\n -w, --workdir string The work directory to run Kusion CLI.\n --workspace string The name of target workspace to operate in.\n -y, --yes Automatically approve and perform the update after previewing it\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a2e57478.24d50fe6.js b/assets/js/a2e57478.24d50fe6.js deleted file mode 100644 index 02945a56f83..00000000000 --- a/assets/js/a2e57478.24d50fe6.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7061],{3905:(e,r,t)=>{t.d(r,{Zo:()=>l,kt:()=>m});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function s(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var i=n.createContext({}),p=function(e){var r=n.useContext(i),t=r;return e&&(t="function"==typeof e?e(r):s(s({},r),e)),t},l=function(e){var r=p(e.components);return n.createElement(i.Provider,{value:r},e.children)},u={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},d=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),d=p(t),m=o,f=d["".concat(i,".").concat(m)]||d[m]||u[m]||a;return t?n.createElement(f,s(s({ref:r},l),{},{components:t})):n.createElement(f,s({ref:r},l))}));function m(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=t.length,s=new Array(a);s[0]=d;var c={};for(var i in r)hasOwnProperty.call(r,i)&&(c[i]=r[i]);c.originalType=e,c.mdxType="string"==typeof e?e:o,s[1]=c;for(var p=2;p{t.r(r),t.d(r,{assets:()=>i,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>p});var n=t(87462),o=(t(67294),t(3905));const a={},s="kusion workspace create",c={unversionedId:"reference/commands/kusion-workspace-create",id:"version-v0.11/reference/commands/kusion-workspace-create",title:"kusion workspace create",description:"Create a new workspace",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-create.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-create",permalink:"/docs/reference/commands/kusion-workspace-create",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-create.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion version",permalink:"/docs/reference/commands/kusion-version"},next:{title:"kusion workspace delete",permalink:"/docs/reference/commands/kusion-workspace-delete"}},i={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:r,...t}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-create"},"kusion workspace create"),(0,o.kt)("p",null,"Create a new workspace"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command creates a workspace with specified name and configuration file, where the file must be in the YAML format."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace create\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Create a workspace\n kusion workspace create dev -f dev.yaml\n \n # Create a workspace and set as current\n kusion workspace create dev -f dev.yaml --current\n \n # Create a workspace in a specified backend\n kusion workspace create prod -f prod.yaml --backend oss-prod\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string the backend name\n --current set the creating workspace as current\n -f, --file string the path of workspace configuration file\n -h, --help help for create\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a2e57478.ea1a93b5.js b/assets/js/a2e57478.ea1a93b5.js new file mode 100644 index 00000000000..d16d9152d0a --- /dev/null +++ b/assets/js/a2e57478.ea1a93b5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7061],{3905:(e,r,t)=>{t.d(r,{Zo:()=>l,kt:()=>f});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function s(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var i=n.createContext({}),p=function(e){var r=n.useContext(i),t=r;return e&&(t="function"==typeof e?e(r):s(s({},r),e)),t},l=function(e){var r=p(e.components);return n.createElement(i.Provider,{value:r},e.children)},u={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},d=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),d=p(t),f=o,m=d["".concat(i,".").concat(f)]||d[f]||u[f]||a;return t?n.createElement(m,s(s({ref:r},l),{},{components:t})):n.createElement(m,s({ref:r},l))}));function f(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=t.length,s=new Array(a);s[0]=d;var c={};for(var i in r)hasOwnProperty.call(r,i)&&(c[i]=r[i]);c.originalType=e,c.mdxType="string"==typeof e?e:o,s[1]=c;for(var p=2;p{t.r(r),t.d(r,{assets:()=>i,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>p});var n=t(87462),o=(t(67294),t(3905));const a={},s="kusion workspace create",c={unversionedId:"reference/commands/kusion-workspace-create",id:"version-v0.11/reference/commands/kusion-workspace-create",title:"kusion workspace create",description:"Create a new workspace",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-create.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-create",permalink:"/docs/reference/commands/kusion-workspace-create",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-create.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion version",permalink:"/docs/reference/commands/kusion-version"},next:{title:"kusion workspace delete",permalink:"/docs/reference/commands/kusion-workspace-delete"}},i={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:r,...t}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-create"},"kusion workspace create"),(0,o.kt)("p",null,"Create a new workspace"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command creates a workspace with specified name and configuration file, where the file must be in the YAML format."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace create\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Create a workspace\n kusion workspace create dev -f dev.yaml\n \n # Create a workspace and set as current\n kusion workspace create dev -f dev.yaml --current\n \n # Create a workspace in a specified backend\n kusion workspace create prod -f prod.yaml --backend oss-prod\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string the backend name\n --current set the creating workspace as current\n -f, --file string the path of workspace configuration file\n -h, --help help for create\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a3522fac.18e9a347.js b/assets/js/a3522fac.18e9a347.js new file mode 100644 index 00000000000..cd8aebb2e91 --- /dev/null +++ b/assets/js/a3522fac.18e9a347.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7130],{3905:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>u});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},m=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),d=p(n),u=a,k=d["".concat(s,".").concat(u)]||d[u]||c[u]||l;return n?r.createElement(k,i(i({ref:t},m),{},{components:n})):r.createElement(k,i({ref:t},m))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,i=new Array(l);i[0]=d;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o.mdxType="string"==typeof e?e:a,i[1]=o;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>c,frontMatter:()=>l,metadata:()=>o,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const l={},i="container",o={unversionedId:"reference/modules/developer-schemas/internal/container/container",id:"reference/modules/developer-schemas/internal/container/container",title:"container",description:"Schema Container",source:"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/internal/container/container.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/internal/container",slug:"/reference/modules/developer-schemas/internal/container/",permalink:"/docs/next/reference/modules/developer-schemas/internal/container/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/1-developer-schemas/internal/container/container.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"common",permalink:"/docs/next/reference/modules/developer-schemas/internal/common"},next:{title:"lifecycle",permalink:"/docs/next/reference/modules/developer-schemas/internal/container/lifecycle/"}},s={},p=[{value:"Schema Container",id:"schema-container",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Schema FileSpec",id:"schema-filespec",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3}],m={toc:p};function c(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"container"},"container"),(0,a.kt)("h2",{id:"schema-container"},"Schema Container"),(0,a.kt)("p",null,"Container describes how the Application's tasks are expected to be run. Depending on",(0,a.kt)("br",null),"the replicas parameter 1 or more containers can be created from each template."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"args")),(0,a.kt)("td",{parentName:"tr",align:null},"[str]"),(0,a.kt)("td",{parentName:"tr",align:null},"Arguments to the entrypoint.",(0,a.kt)("br",null),"Args will overwrite the CMD value set in the Dockfile, otherwise the Docker",(0,a.kt)("br",null),"image's CMD is used if this is not provided."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"command")),(0,a.kt)("td",{parentName:"tr",align:null},"[str]"),(0,a.kt)("td",{parentName:"tr",align:null},"Entrypoint array. Not executed within a shell.",(0,a.kt)("br",null),"Command will overwrite the ENTRYPOINT value set in the Dockfile, otherwise the Docker",(0,a.kt)("br",null),"image's ENTRYPOINT is used if this is not provided."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"dirs")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Collection of volumes mount into the container's filesystem.",(0,a.kt)("br",null),"The dirs parameter is a dict with the key being the folder name in the container and the value",(0,a.kt)("br",null),"being the referenced volume."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"env")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"List of environment variables to set in the container.",(0,a.kt)("br",null),"The value of the environment variable may be static text or a value from a secret."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"files")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:",(0,a.kt)("a",{parentName:"td",href:"#filespec"},"FileSpec"),"}"),(0,a.kt)("td",{parentName:"tr",align:null},"List of files to create in the container.",(0,a.kt)("br",null),"The files parameter is a dict with the key being the file name in the container and the value",(0,a.kt)("br",null),"being the target file specification."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"image")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Image refers to the Docker image name to run for this container.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/images"},"https://kubernetes.io/docs/concepts/containers/images")),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"lifecycle")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/container/lifecycle/#schema-lifecycle"},"lc.Lifecycle")),(0,a.kt)("td",{parentName:"tr",align:null},"Lifecycle refers to actions that the management system should take in response to container lifecycle events."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"livenessProbe")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,a.kt)("td",{parentName:"tr",align:null},"LivenessProbe indicates if a running process is healthy.",(0,a.kt)("br",null),"Container will be restarted if the probe fails."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"readinessProbe")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,a.kt)("td",{parentName:"tr",align:null},"ReadinessProbe indicates whether an application is available to handle requests."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"resources")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Map of resource requirements the container should run with.",(0,a.kt)("br",null),"The resources parameter is a dict with the key being the resource name and the value being",(0,a.kt)("br",null),"the resource value."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"startupProbe")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,a.kt)("td",{parentName:"tr",align:null},"StartupProbe indicates that the container has started for the first time.",(0,a.kt)("br",null),"Container will be restarted if the probe fails."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"workingDir")),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"The working directory of the running process defined in entrypoint.",(0,a.kt)("br",null),"Default container runtime will be used if this is not specified."),(0,a.kt)("td",{parentName:"tr",align:null})))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container as c\n\nweb = c.Container {\n image: "nginx:latest"\n command: ["/bin/sh", "-c", "echo hi"]\n env: {\n "name": "value"\n }\n resources: {\n "cpu": "2"\n "memory": "4Gi"\n }\n}\n')),(0,a.kt)("h2",{id:"schema-filespec"},"Schema FileSpec"),(0,a.kt)("p",null,"FileSpec defines the target file in a Container."),(0,a.kt)("h3",{id:"attributes-1"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"content")),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"File content in plain text."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"contentFrom")),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Source for the file content, reference to a secret of configmap value."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"mode")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Mode bits used to set permissions on this file, must be an octal value",(0,a.kt)("br",null),"between 0000 and 0777 or a decimal value between 0 and 511"),(0,a.kt)("td",{parentName:"tr",align:null},'"0644"')))),(0,a.kt)("h3",{id:"examples-1"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container as c\n\ntmpFile = c.FileSpec {\n content: "some file contents"\n mode: "0777"\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a3522fac.69c8cc5a.js b/assets/js/a3522fac.69c8cc5a.js deleted file mode 100644 index d12c81d5a68..00000000000 --- a/assets/js/a3522fac.69c8cc5a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7130],{3905:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>u});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},m=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),d=p(n),u=a,k=d["".concat(s,".").concat(u)]||d[u]||c[u]||l;return n?r.createElement(k,i(i({ref:t},m),{},{components:n})):r.createElement(k,i({ref:t},m))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,i=new Array(l);i[0]=d;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o.mdxType="string"==typeof e?e:a,i[1]=o;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>c,frontMatter:()=>l,metadata:()=>o,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const l={},i="container",o={unversionedId:"reference/modules/developer-schemas/internal/container/container",id:"reference/modules/developer-schemas/internal/container/container",title:"container",description:"Schema Container",source:"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/internal/container/container.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/internal/container",slug:"/reference/modules/developer-schemas/internal/container/",permalink:"/docs/next/reference/modules/developer-schemas/internal/container/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/1-developer-schemas/internal/container/container.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"common",permalink:"/docs/next/reference/modules/developer-schemas/internal/common"},next:{title:"lifecycle",permalink:"/docs/next/reference/modules/developer-schemas/internal/container/lifecycle/"}},s={},p=[{value:"Schema Container",id:"schema-container",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Schema FileSpec",id:"schema-filespec",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3}],m={toc:p};function c(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"container"},"container"),(0,a.kt)("h2",{id:"schema-container"},"Schema Container"),(0,a.kt)("p",null,"Container describes how the Application's tasks are expected to be run. Depending on",(0,a.kt)("br",null),"the replicas parameter 1 or more containers can be created from each template."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"args")),(0,a.kt)("td",{parentName:"tr",align:null},"[str]"),(0,a.kt)("td",{parentName:"tr",align:null},"Arguments to the entrypoint.",(0,a.kt)("br",null),"Args will overwrite the CMD value set in the Dockfile, otherwise the Docker",(0,a.kt)("br",null),"image's CMD is used if this is not provided."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"command")),(0,a.kt)("td",{parentName:"tr",align:null},"[str]"),(0,a.kt)("td",{parentName:"tr",align:null},"Entrypoint array. Not executed within a shell.",(0,a.kt)("br",null),"Command will overwrite the ENTRYPOINT value set in the Dockfile, otherwise the Docker",(0,a.kt)("br",null),"image's ENTRYPOINT is used if this is not provided."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"dirs")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Collection of volumes mount into the container's filesystem.",(0,a.kt)("br",null),"The dirs parameter is a dict with the key being the folder name in the container and the value",(0,a.kt)("br",null),"being the referenced volume."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"env")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"List of environment variables to set in the container.",(0,a.kt)("br",null),"The value of the environment variable may be static text or a value from a secret."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"files")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:",(0,a.kt)("a",{parentName:"td",href:"#filespec"},"FileSpec"),"}"),(0,a.kt)("td",{parentName:"tr",align:null},"List of files to create in the container.",(0,a.kt)("br",null),"The files parameter is a dict with the key being the file name in the container and the value",(0,a.kt)("br",null),"being the target file specification."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"image")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Image refers to the Docker image name to run for this container.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/images"},"https://kubernetes.io/docs/concepts/containers/images")),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"lifecycle")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/container/lifecycle/#schema-lifecycle"},"lc.Lifecycle")),(0,a.kt)("td",{parentName:"tr",align:null},"Lifecycle refers to actions that the management system should take in response to container lifecycle events."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"livenessProbe")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,a.kt)("td",{parentName:"tr",align:null},"LivenessProbe indicates if a running process is healthy.",(0,a.kt)("br",null),"Container will be restarted if the probe fails."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"readinessProbe")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,a.kt)("td",{parentName:"tr",align:null},"ReadinessProbe indicates whether an application is available to handle requests."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"resources")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Map of resource requirements the container should run with.",(0,a.kt)("br",null),"The resources parameter is a dict with the key being the resource name and the value being",(0,a.kt)("br",null),"the resource value."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"startupProbe")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,a.kt)("td",{parentName:"tr",align:null},"StartupProbe indicates that the container has started for the first time.",(0,a.kt)("br",null),"Container will be restarted if the probe fails."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"workingDir")),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"The working directory of the running process defined in entrypoint.",(0,a.kt)("br",null),"Default container runtime will be used if this is not specified."),(0,a.kt)("td",{parentName:"tr",align:null})))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container as c\n\nweb = c.Container {\n image: "nginx:latest"\n command: ["/bin/sh", "-c", "echo hi"]\n env: {\n "name": "value"\n }\n resources: {\n "cpu": "2"\n "memory": "4Gi"\n }\n}\n')),(0,a.kt)("h2",{id:"schema-filespec"},"Schema FileSpec"),(0,a.kt)("p",null,"FileSpec defines the target file in a Container."),(0,a.kt)("h3",{id:"attributes-1"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"content")),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"File content in plain text."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"contentFrom")),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Source for the file content, reference to a secret of configmap value."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"mode")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Mode bits used to set permissions on this file, must be an octal value",(0,a.kt)("br",null),"between 0000 and 0777 or a decimal value between 0 and 511"),(0,a.kt)("td",{parentName:"tr",align:null},'"0644"')))),(0,a.kt)("h3",{id:"examples-1"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container as c\n\ntmpFile = c.FileSpec {\n content: "some file contents"\n mode: "0777"\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a3e670f9.da664c98.js b/assets/js/a3e670f9.da664c98.js deleted file mode 100644 index 1ac6268e540..00000000000 --- a/assets/js/a3e670f9.da664c98.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2052],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>u});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),m=p(n),u=i,k=m["".concat(s,".").concat(u)]||m[u]||c[u]||o;return n?a.createElement(k,r(r({ref:t},d),{},{components:n})):a.createElement(k,r({ref:t},d))}));function u(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,r=new Array(o);r[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>r,default:()=>c,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var a=n(87462),i=(n(67294),n(3905));const o={sidebar_position:2},r="KCL Basics",l={unversionedId:"config-walkthrough/kcl_basics",id:"version-v0.9/config-walkthrough/kcl_basics",title:"KCL Basics",description:"Table of Content",source:"@site/docs_versioned_docs/version-v0.9/config-walkthrough/kcl_basics.md",sourceDirName:"config-walkthrough",slug:"/config-walkthrough/kcl_basics",permalink:"/docs/v0.9/config-walkthrough/kcl_basics",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/config-walkthrough/kcl_basics.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"kusion",previous:{title:"Configuration File Overview",permalink:"/docs/v0.9/config-walkthrough/overview"},next:{title:"Base and Override",permalink:"/docs/v0.9/config-walkthrough/base_override"}},s={},p=[{value:"Table of Content",id:"table-of-content",level:2},{value:"Variable assignments",id:"variable-assignments",level:2},{value:"Common built-in types",id:"common-built-in-types",level:2},{value:"Lists and maps",id:"lists-and-maps",level:2},{value:"Conditional statements",id:"conditional-statements",level:2},{value:"The : and = operator",id:"the--and--operator",level:2},{value:"Advanced KCL capabilities",id:"advanced-kcl-capabilities",level:2}],d={toc:p};function c(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"kcl-basics"},"KCL Basics"),(0,i.kt)("h2",{id:"table-of-content"},"Table of Content"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#variable-assignments"},"Variable assignments")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#common-built-in-types"},"Common built-in types")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#lists-and-maps"},"Lists and maps")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#conditional-statements"},"Conditional statements")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#the--and--operator"},"The : and = operator")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#advanced-kcl-capabilities"},"Advanced KCL capabilities"))),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/"},"KCL")," is the choice of configuration language consumed by Kusion. KCL is an open source constraint-based record and functional language. KCL works well with a large number of complex configurations via modern programming language technology and practice, and is committed to provide better modularity, scalability, stability and extensibility."),(0,i.kt)("h2",{id:"variable-assignments"},"Variable assignments"),(0,i.kt)("p",null,"There are two ways to initialize a variable in KCL. You can either use the ",(0,i.kt)("inlineCode",{parentName:"p"},":")," operator or the ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operator. We will discuss the difference between them in ",(0,i.kt)("a",{parentName:"p",href:"#the--and--operator"},"this section later"),"."),(0,i.kt)("p",null,"Here are the two ways to create a variable and initialize it:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'foo = "Foo" # Declare a variable named `foo` and its value is a string literal "Foo"\nbar: "Bar" # Declare a variable named `bar` and its value is a string literal "Bar"\n')),(0,i.kt)("p",null,"You will be able to override a variable assignment via the ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operator. We will discuss this in depth in the ",(0,i.kt)("a",{parentName:"p",href:"#the--and--operator"},(0,i.kt)("inlineCode",{parentName:"a"},":")," and ",(0,i.kt)("inlineCode",{parentName:"a"},"=")," operator section"),"."),(0,i.kt)("h2",{id:"common-built-in-types"},"Common built-in types"),(0,i.kt)("p",null,"KCL supports ",(0,i.kt)("inlineCode",{parentName:"p"},"int"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"float"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"bool")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"string")," as the built-in types."),(0,i.kt)("p",null,"Other types are defined in the packages that are imported into the application configuration files. One such example would be the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," object (or ",(0,i.kt)("inlineCode",{parentName:"p"},"Container"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Probe"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Port")," object, etc) that are defined in the ",(0,i.kt)("inlineCode",{parentName:"p"},"catalog")," repository."),(0,i.kt)("h2",{id:"lists-and-maps"},"Lists and maps"),(0,i.kt)("p",null,"Lists are represented using the ",(0,i.kt)("inlineCode",{parentName:"p"},"[]")," notation.\nAn example of lists:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"list0 = [1, 2, 3]\nlist1 = [4, 5, 6]\njoined_list = list0 + list1 # [1, 2, 3, 4, 5, 6]\n")),(0,i.kt)("p",null,"Maps are represented using the ",(0,i.kt)("inlineCode",{parentName:"p"},"{}")," notation.\nAn example of maps:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"a = {\"one\" = 1, \"two\" = 2, \"three\" = 3}\nb = {'one' = 1, 'two' = 2, 'three' = 3}\nassert a == b # True\nassert len(a) == 3 # True\n")),(0,i.kt)("h2",{id:"conditional-statements"},"Conditional statements"),(0,i.kt)("p",null,"You can also use basic control flow statements when writing the configuration file."),(0,i.kt)("p",null,"An example that sets the value of ",(0,i.kt)("inlineCode",{parentName:"p"},"replicas")," conditionally based on the value of ",(0,i.kt)("inlineCode",{parentName:"p"},"containers.myapp.resources.cpu"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\n\nmyapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: ""\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1 if containers.myapp.resources.cpu == "500m" else 2\n }\n}\n')),(0,i.kt)("p",null,"For more details on KCL's control flow statements, please refer to the ",(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/reference/lang/tour#control-flow-statements"},"KCL documentation"),"."),(0,i.kt)("h2",{id:"the--and--operator"},"The ",(0,i.kt)("inlineCode",{parentName:"h2"},":")," and ",(0,i.kt)("inlineCode",{parentName:"h2"},"=")," operator"),(0,i.kt)("p",null,"You might have noticed there is a mixed usage of the ",(0,i.kt)("inlineCode",{parentName:"p"},":")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," in the samples above."),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("strong",{parentName:"p"},"TLDR: The recommendation is to use ",(0,i.kt)("inlineCode",{parentName:"strong"},":")," in the common configurations, and ",(0,i.kt)("inlineCode",{parentName:"strong"},"=")," for override in the environment-specific configurations."))),(0,i.kt)("p",null,"In KCL:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},":")," represents a union-ed value assignment. In the pattern ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier: E")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier: T E"),", the value of the expression ",(0,i.kt)("inlineCode",{parentName:"li"},"E")," with optional type annotation ",(0,i.kt)("inlineCode",{parentName:"li"},"T")," will be merged and union-ed into the element value."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"=")," represents a value override. In the pattern ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier = E")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier = T E"),", The value of the expression ",(0,i.kt)("inlineCode",{parentName:"li"},"E")," with optional type annotation ",(0,i.kt)("inlineCode",{parentName:"li"},"T")," will override the ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier")," attribute value.")),(0,i.kt)("p",null,"Let's take a look at an example:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"# This is one configuration that will be merged.\nconfig: Config {\n data.d1 = 1\n}\n# This is another configuration that will be merged.\nconfig: Config {\n data.d2 = 2\n}\n")),(0,i.kt)("p",null,"The above is equivalent to the snippet below since the two expressions for ",(0,i.kt)("inlineCode",{parentName:"p"},"config")," get merged/union-ed into one:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"config: Config {\n data.d1 = 1\n data.d2 = 1\n}\n")),(0,i.kt)("p",null,"whereas using the ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operators will result in a different outcome:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"# This is first configuration.\nconfig = Config {\n data.d1 = 1\n}\n# This is second configuration that will override the prior one.\nconfig = Config {\n data.d2 = 2\n}\n")),(0,i.kt)("p",null,"The config above results in:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"config: Config {\n data.d2 = 2\n}\n")),(0,i.kt)("p",null,"Please note that the ",(0,i.kt)("inlineCode",{parentName:"p"},":")," attribute operator represents an idempotent merge operation, and an error will be thrown when the values that need to be merged conflict with each other."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"data0 = {id: 1} | {id: 2} # Error\uff1aconflicting values between {'id': 2} and {'id': 1}\ndata1 = {id: 1} | {id = 2} # Ok, the value of `data` is {\"id\": 2}\n")),(0,i.kt)("p",null,"More about ",(0,i.kt)("inlineCode",{parentName:"p"},":")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operator can be found in the ",(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/reference/lang/tour#config-operations"},"KCL documentation"),"."),(0,i.kt)("h2",{id:"advanced-kcl-capabilities"},"Advanced KCL capabilities"),(0,i.kt)("p",null,"For more advanced KCL capabilities, please visit the ",(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/user_docs/support/faq-kcl"},"KCL website"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a3e670f9.f9e02389.js b/assets/js/a3e670f9.f9e02389.js new file mode 100644 index 00000000000..c99fd586549 --- /dev/null +++ b/assets/js/a3e670f9.f9e02389.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2052],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>u});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),m=p(n),u=i,k=m["".concat(s,".").concat(u)]||m[u]||c[u]||o;return n?a.createElement(k,r(r({ref:t},d),{},{components:n})):a.createElement(k,r({ref:t},d))}));function u(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,r=new Array(o);r[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>r,default:()=>c,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var a=n(87462),i=(n(67294),n(3905));const o={sidebar_position:2},r="KCL Basics",l={unversionedId:"config-walkthrough/kcl_basics",id:"version-v0.9/config-walkthrough/kcl_basics",title:"KCL Basics",description:"Table of Content",source:"@site/docs_versioned_docs/version-v0.9/config-walkthrough/kcl_basics.md",sourceDirName:"config-walkthrough",slug:"/config-walkthrough/kcl_basics",permalink:"/docs/v0.9/config-walkthrough/kcl_basics",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/config-walkthrough/kcl_basics.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"kusion",previous:{title:"Configuration File Overview",permalink:"/docs/v0.9/config-walkthrough/overview"},next:{title:"Base and Override",permalink:"/docs/v0.9/config-walkthrough/base_override"}},s={},p=[{value:"Table of Content",id:"table-of-content",level:2},{value:"Variable assignments",id:"variable-assignments",level:2},{value:"Common built-in types",id:"common-built-in-types",level:2},{value:"Lists and maps",id:"lists-and-maps",level:2},{value:"Conditional statements",id:"conditional-statements",level:2},{value:"The : and = operator",id:"the--and--operator",level:2},{value:"Advanced KCL capabilities",id:"advanced-kcl-capabilities",level:2}],d={toc:p};function c(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"kcl-basics"},"KCL Basics"),(0,i.kt)("h2",{id:"table-of-content"},"Table of Content"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#variable-assignments"},"Variable assignments")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#common-built-in-types"},"Common built-in types")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#lists-and-maps"},"Lists and maps")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#conditional-statements"},"Conditional statements")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#the--and--operator"},"The : and = operator")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#advanced-kcl-capabilities"},"Advanced KCL capabilities"))),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/"},"KCL")," is the choice of configuration language consumed by Kusion. KCL is an open source constraint-based record and functional language. KCL works well with a large number of complex configurations via modern programming language technology and practice, and is committed to provide better modularity, scalability, stability and extensibility."),(0,i.kt)("h2",{id:"variable-assignments"},"Variable assignments"),(0,i.kt)("p",null,"There are two ways to initialize a variable in KCL. You can either use the ",(0,i.kt)("inlineCode",{parentName:"p"},":")," operator or the ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operator. We will discuss the difference between them in ",(0,i.kt)("a",{parentName:"p",href:"#the--and--operator"},"this section later"),"."),(0,i.kt)("p",null,"Here are the two ways to create a variable and initialize it:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'foo = "Foo" # Declare a variable named `foo` and its value is a string literal "Foo"\nbar: "Bar" # Declare a variable named `bar` and its value is a string literal "Bar"\n')),(0,i.kt)("p",null,"You will be able to override a variable assignment via the ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operator. We will discuss this in depth in the ",(0,i.kt)("a",{parentName:"p",href:"#the--and--operator"},(0,i.kt)("inlineCode",{parentName:"a"},":")," and ",(0,i.kt)("inlineCode",{parentName:"a"},"=")," operator section"),"."),(0,i.kt)("h2",{id:"common-built-in-types"},"Common built-in types"),(0,i.kt)("p",null,"KCL supports ",(0,i.kt)("inlineCode",{parentName:"p"},"int"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"float"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"bool")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"string")," as the built-in types."),(0,i.kt)("p",null,"Other types are defined in the packages that are imported into the application configuration files. One such example would be the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," object (or ",(0,i.kt)("inlineCode",{parentName:"p"},"Container"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Probe"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Port")," object, etc) that are defined in the ",(0,i.kt)("inlineCode",{parentName:"p"},"catalog")," repository."),(0,i.kt)("h2",{id:"lists-and-maps"},"Lists and maps"),(0,i.kt)("p",null,"Lists are represented using the ",(0,i.kt)("inlineCode",{parentName:"p"},"[]")," notation.\nAn example of lists:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"list0 = [1, 2, 3]\nlist1 = [4, 5, 6]\njoined_list = list0 + list1 # [1, 2, 3, 4, 5, 6]\n")),(0,i.kt)("p",null,"Maps are represented using the ",(0,i.kt)("inlineCode",{parentName:"p"},"{}")," notation.\nAn example of maps:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"a = {\"one\" = 1, \"two\" = 2, \"three\" = 3}\nb = {'one' = 1, 'two' = 2, 'three' = 3}\nassert a == b # True\nassert len(a) == 3 # True\n")),(0,i.kt)("h2",{id:"conditional-statements"},"Conditional statements"),(0,i.kt)("p",null,"You can also use basic control flow statements when writing the configuration file."),(0,i.kt)("p",null,"An example that sets the value of ",(0,i.kt)("inlineCode",{parentName:"p"},"replicas")," conditionally based on the value of ",(0,i.kt)("inlineCode",{parentName:"p"},"containers.myapp.resources.cpu"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\n\nmyapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: ""\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1 if containers.myapp.resources.cpu == "500m" else 2\n }\n}\n')),(0,i.kt)("p",null,"For more details on KCL's control flow statements, please refer to the ",(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/reference/lang/tour#control-flow-statements"},"KCL documentation"),"."),(0,i.kt)("h2",{id:"the--and--operator"},"The ",(0,i.kt)("inlineCode",{parentName:"h2"},":")," and ",(0,i.kt)("inlineCode",{parentName:"h2"},"=")," operator"),(0,i.kt)("p",null,"You might have noticed there is a mixed usage of the ",(0,i.kt)("inlineCode",{parentName:"p"},":")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," in the samples above."),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("strong",{parentName:"p"},"TLDR: The recommendation is to use ",(0,i.kt)("inlineCode",{parentName:"strong"},":")," in the common configurations, and ",(0,i.kt)("inlineCode",{parentName:"strong"},"=")," for override in the environment-specific configurations."))),(0,i.kt)("p",null,"In KCL:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},":")," represents a union-ed value assignment. In the pattern ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier: E")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier: T E"),", the value of the expression ",(0,i.kt)("inlineCode",{parentName:"li"},"E")," with optional type annotation ",(0,i.kt)("inlineCode",{parentName:"li"},"T")," will be merged and union-ed into the element value."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"=")," represents a value override. In the pattern ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier = E")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier = T E"),", The value of the expression ",(0,i.kt)("inlineCode",{parentName:"li"},"E")," with optional type annotation ",(0,i.kt)("inlineCode",{parentName:"li"},"T")," will override the ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier")," attribute value.")),(0,i.kt)("p",null,"Let's take a look at an example:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"# This is one configuration that will be merged.\nconfig: Config {\n data.d1 = 1\n}\n# This is another configuration that will be merged.\nconfig: Config {\n data.d2 = 2\n}\n")),(0,i.kt)("p",null,"The above is equivalent to the snippet below since the two expressions for ",(0,i.kt)("inlineCode",{parentName:"p"},"config")," get merged/union-ed into one:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"config: Config {\n data.d1 = 1\n data.d2 = 1\n}\n")),(0,i.kt)("p",null,"whereas using the ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operators will result in a different outcome:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"# This is first configuration.\nconfig = Config {\n data.d1 = 1\n}\n# This is second configuration that will override the prior one.\nconfig = Config {\n data.d2 = 2\n}\n")),(0,i.kt)("p",null,"The config above results in:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"config: Config {\n data.d2 = 2\n}\n")),(0,i.kt)("p",null,"Please note that the ",(0,i.kt)("inlineCode",{parentName:"p"},":")," attribute operator represents an idempotent merge operation, and an error will be thrown when the values that need to be merged conflict with each other."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"data0 = {id: 1} | {id: 2} # Error\uff1aconflicting values between {'id': 2} and {'id': 1}\ndata1 = {id: 1} | {id = 2} # Ok, the value of `data` is {\"id\": 2}\n")),(0,i.kt)("p",null,"More about ",(0,i.kt)("inlineCode",{parentName:"p"},":")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operator can be found in the ",(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/reference/lang/tour#config-operations"},"KCL documentation"),"."),(0,i.kt)("h2",{id:"advanced-kcl-capabilities"},"Advanced KCL capabilities"),(0,i.kt)("p",null,"For more advanced KCL capabilities, please visit the ",(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/user_docs/support/faq-kcl"},"KCL website"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a61b46cc.60ee14bb.js b/assets/js/a61b46cc.60ee14bb.js deleted file mode 100644 index 22ff15f2f67..00000000000 --- a/assets/js/a61b46cc.60ee14bb.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8427],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>h});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},d=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=s(n),h=o,m=u["".concat(p,".").concat(h)]||u[h]||c[h]||i;return n?r.createElement(m,a(a({ref:t},d),{},{components:n})):r.createElement(m,a({ref:t},d))}));function h(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=u;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:o,a[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>c,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var r=n(87462),o=(n(67294),n(3905));const i={},a="Expose Service",l={unversionedId:"guides/working-with-k8s/service",id:"version-v0.9/guides/working-with-k8s/service",title:"Expose Service",description:"You can determine how to expose your service in the AppConfiguration model via the ports field (under the workload schemas). The ports field defines a list of all the Ports you want to expose for the application (and their corresponding listening ports on the container, if they don't match the service ports), so that it can be consumed by other applications.",source:"@site/docs_versioned_docs/version-v0.9/guides/working-with-k8s/3-service.md",sourceDirName:"guides/working-with-k8s",slug:"/guides/working-with-k8s/service",permalink:"/docs/v0.9/guides/working-with-k8s/service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/guides/working-with-k8s/3-service.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{},sidebar:"kusion",previous:{title:"Configure Containers",permalink:"/docs/v0.9/guides/working-with-k8s/container"},next:{title:"Upgrade Image",permalink:"/docs/v0.9/guides/working-with-k8s/image-upgrade"}},p={},s=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],d={toc:s};function c(e){let{components:t,...i}=e;return(0,o.kt)("wrapper",(0,r.Z)({},d,i,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"expose-service"},"Expose Service"),(0,o.kt)("p",null,"You can determine how to expose your service in the ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model via the ",(0,o.kt)("inlineCode",{parentName:"p"},"ports")," field (under the ",(0,o.kt)("inlineCode",{parentName:"p"},"workload")," schemas). The ",(0,o.kt)("inlineCode",{parentName:"p"},"ports")," field defines a list of all the ",(0,o.kt)("inlineCode",{parentName:"p"},"Port"),"s you want to expose for the application (and their corresponding listening ports on the container, if they don't match the service ports), so that it can be consumed by other applications."),(0,o.kt)("p",null,"Unless explicitly defined, each of the ports exposed is by default exposed privately as a ",(0,o.kt)("inlineCode",{parentName:"p"},"ClusterIP")," type service. You can expose a port publicly by specifying the ",(0,o.kt)("inlineCode",{parentName:"p"},"exposeInternet")," field in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Port")," schema. At the moment, the implementation for publicly access is done via Load Balancer type service backed by cloud providers. Ingress will be supported in a future version of kusion."),(0,o.kt)("p",null,"For the ",(0,o.kt)("inlineCode",{parentName:"p"},"Port")," schema reference, please see ",(0,o.kt)("a",{parentName:"p",href:"../../reference/model/catalog_models/workload/doc_service#schema-port"},"here")," for more details."),(0,o.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,o.kt)("p",null,"Please refer to the ",(0,o.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,o.kt)("p",null,"The example below also requires you to have ",(0,o.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will generate a ",(0,o.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,o.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the project directory."),(0,o.kt)("h2",{id:"example"},"Example"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"helloworld/dev/main.k"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-py"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.network as n\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "helloworld": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v4"\n env: {\n "env1": "VALUE"\n "env2": "VALUE2"\n }\n resources: {\n "cpu": "500m"\n "memory": "512M"\n }\n # Configure an HTTP readiness probe\n readinessProbe: p.Probe {\n probeHandler: p.Http {\n url: "http://localhost:80"\n }\n initialDelaySeconds: 10\n }\n }\n }\n replicas: 2\n ports: [\n n.Port {\n port: 8080\n targetPort: 80\n }\n ]\n }\n}\n')),(0,o.kt)("p",null,"The code above changes the service port to expose from ",(0,o.kt)("inlineCode",{parentName:"p"},"80")," in the last guide to ",(0,o.kt)("inlineCode",{parentName:"p"},"8080"),", but still targeting the container port ",(0,o.kt)("inlineCode",{parentName:"p"},"80")," because that's what the application is listening on."),(0,o.kt)("h2",{id:"applying"},"Applying"),(0,o.kt)("p",null,"Re-run steps in ",(0,o.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", new service configuration can be applied."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:helloworld UnChanged\n* \u251c\u2500 v1:Service:helloworld:helloworld-dev-helloworld-private Update\n* \u2514\u2500 apps/v1:Deployment:helloworld:helloworld-dev-helloworld UnChanged\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:helloworld, skip \n SUCCESS Update v1:Service:helloworld:helloworld-dev-helloworld-private success \n SUCCESS UnChanged apps/v1:Deployment:helloworld:helloworld-dev-helloworld, skip \nUnChanged apps/v1:Deployment:helloworld:helloworld-dev-helloworld, skip [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,o.kt)("h2",{id:"validation"},"Validation"),(0,o.kt)("p",null,"We can verify the Kubernetes service now has the updated attributes (mapping service port 8080 to container port 80) as defined in the ",(0,o.kt)("inlineCode",{parentName:"p"},"ports")," configuration:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kubectl get svc -n helloworld -o yaml\n...\n spec:\n ...\n ports:\n - name: helloworld-dev-helloworld-private-8080-tcp\n port: 8080\n protocol: TCP\n targetPort: 80\n...\n")),(0,o.kt)("p",null,"Exposing service port 8080:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kubectl port-forward svc/helloworld-dev-helloworld-private -n helloworld 30000:8080\n")),(0,o.kt)("p",null,"Open browser and visit ",(0,o.kt)("a",{parentName:"p",href:"http://127.0.0.1:30000"},"http://127.0.0.1:30000"),", the application should be up and running\uff1a"),(0,o.kt)("p",null,(0,o.kt)("img",{alt:"app-preview",src:n(92287).Z,width:"1830",height:"330"})))}c.isMDXComponent=!0},92287:(e,t,n)=>{n.d(t,{Z:()=>r});const r=n.p+"assets/images/app-preview-de5274f4267fa725d2a65099e47c6c2c.png"}}]); \ No newline at end of file diff --git a/assets/js/a61b46cc.a0cda03b.js b/assets/js/a61b46cc.a0cda03b.js new file mode 100644 index 00000000000..2e432329c3b --- /dev/null +++ b/assets/js/a61b46cc.a0cda03b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8427],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>h});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},d=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=s(n),h=o,m=u["".concat(p,".").concat(h)]||u[h]||c[h]||i;return n?r.createElement(m,a(a({ref:t},d),{},{components:n})):r.createElement(m,a({ref:t},d))}));function h(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=u;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:o,a[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>c,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var r=n(87462),o=(n(67294),n(3905));const i={},a="Expose Service",l={unversionedId:"guides/working-with-k8s/service",id:"version-v0.9/guides/working-with-k8s/service",title:"Expose Service",description:"You can determine how to expose your service in the AppConfiguration model via the ports field (under the workload schemas). The ports field defines a list of all the Ports you want to expose for the application (and their corresponding listening ports on the container, if they don't match the service ports), so that it can be consumed by other applications.",source:"@site/docs_versioned_docs/version-v0.9/guides/working-with-k8s/3-service.md",sourceDirName:"guides/working-with-k8s",slug:"/guides/working-with-k8s/service",permalink:"/docs/v0.9/guides/working-with-k8s/service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/guides/working-with-k8s/3-service.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{},sidebar:"kusion",previous:{title:"Configure Containers",permalink:"/docs/v0.9/guides/working-with-k8s/container"},next:{title:"Upgrade Image",permalink:"/docs/v0.9/guides/working-with-k8s/image-upgrade"}},p={},s=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],d={toc:s};function c(e){let{components:t,...i}=e;return(0,o.kt)("wrapper",(0,r.Z)({},d,i,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"expose-service"},"Expose Service"),(0,o.kt)("p",null,"You can determine how to expose your service in the ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model via the ",(0,o.kt)("inlineCode",{parentName:"p"},"ports")," field (under the ",(0,o.kt)("inlineCode",{parentName:"p"},"workload")," schemas). The ",(0,o.kt)("inlineCode",{parentName:"p"},"ports")," field defines a list of all the ",(0,o.kt)("inlineCode",{parentName:"p"},"Port"),"s you want to expose for the application (and their corresponding listening ports on the container, if they don't match the service ports), so that it can be consumed by other applications."),(0,o.kt)("p",null,"Unless explicitly defined, each of the ports exposed is by default exposed privately as a ",(0,o.kt)("inlineCode",{parentName:"p"},"ClusterIP")," type service. You can expose a port publicly by specifying the ",(0,o.kt)("inlineCode",{parentName:"p"},"exposeInternet")," field in the ",(0,o.kt)("inlineCode",{parentName:"p"},"Port")," schema. At the moment, the implementation for publicly access is done via Load Balancer type service backed by cloud providers. Ingress will be supported in a future version of kusion."),(0,o.kt)("p",null,"For the ",(0,o.kt)("inlineCode",{parentName:"p"},"Port")," schema reference, please see ",(0,o.kt)("a",{parentName:"p",href:"../../reference/model/catalog_models/workload/doc_service#schema-port"},"here")," for more details."),(0,o.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,o.kt)("p",null,"Please refer to the ",(0,o.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,o.kt)("p",null,"The example below also requires you to have ",(0,o.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will generate a ",(0,o.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,o.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the project directory."),(0,o.kt)("h2",{id:"example"},"Example"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"helloworld/dev/main.k"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-py"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.network as n\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "helloworld": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v4"\n env: {\n "env1": "VALUE"\n "env2": "VALUE2"\n }\n resources: {\n "cpu": "500m"\n "memory": "512M"\n }\n # Configure an HTTP readiness probe\n readinessProbe: p.Probe {\n probeHandler: p.Http {\n url: "http://localhost:80"\n }\n initialDelaySeconds: 10\n }\n }\n }\n replicas: 2\n ports: [\n n.Port {\n port: 8080\n targetPort: 80\n }\n ]\n }\n}\n')),(0,o.kt)("p",null,"The code above changes the service port to expose from ",(0,o.kt)("inlineCode",{parentName:"p"},"80")," in the last guide to ",(0,o.kt)("inlineCode",{parentName:"p"},"8080"),", but still targeting the container port ",(0,o.kt)("inlineCode",{parentName:"p"},"80")," because that's what the application is listening on."),(0,o.kt)("h2",{id:"applying"},"Applying"),(0,o.kt)("p",null,"Re-run steps in ",(0,o.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", new service configuration can be applied."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:helloworld UnChanged\n* \u251c\u2500 v1:Service:helloworld:helloworld-dev-helloworld-private Update\n* \u2514\u2500 apps/v1:Deployment:helloworld:helloworld-dev-helloworld UnChanged\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:helloworld, skip \n SUCCESS Update v1:Service:helloworld:helloworld-dev-helloworld-private success \n SUCCESS UnChanged apps/v1:Deployment:helloworld:helloworld-dev-helloworld, skip \nUnChanged apps/v1:Deployment:helloworld:helloworld-dev-helloworld, skip [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,o.kt)("h2",{id:"validation"},"Validation"),(0,o.kt)("p",null,"We can verify the Kubernetes service now has the updated attributes (mapping service port 8080 to container port 80) as defined in the ",(0,o.kt)("inlineCode",{parentName:"p"},"ports")," configuration:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kubectl get svc -n helloworld -o yaml\n...\n spec:\n ...\n ports:\n - name: helloworld-dev-helloworld-private-8080-tcp\n port: 8080\n protocol: TCP\n targetPort: 80\n...\n")),(0,o.kt)("p",null,"Exposing service port 8080:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kubectl port-forward svc/helloworld-dev-helloworld-private -n helloworld 30000:8080\n")),(0,o.kt)("p",null,"Open browser and visit ",(0,o.kt)("a",{parentName:"p",href:"http://127.0.0.1:30000"},"http://127.0.0.1:30000"),", the application should be up and running\uff1a"),(0,o.kt)("p",null,(0,o.kt)("img",{alt:"app-preview",src:n(92287).Z,width:"1830",height:"330"})))}c.isMDXComponent=!0},92287:(e,t,n)=>{n.d(t,{Z:()=>r});const r=n.p+"assets/images/app-preview-de5274f4267fa725d2a65099e47c6c2c.png"}}]); \ No newline at end of file diff --git a/assets/js/a6996c29.227566bd.js b/assets/js/a6996c29.227566bd.js new file mode 100644 index 00000000000..c21927a626e --- /dev/null +++ b/assets/js/a6996c29.227566bd.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6248],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=o.createContext({}),u=function(e){var t=o.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},p=function(e){var t=u(e.components);return o.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=u(n),m=r,f=d["".concat(s,".").concat(m)]||d[m]||c[m]||i;return n?o.createElement(f,a(a({ref:t},p),{},{components:n})):o.createElement(f,a({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,a=new Array(i);a[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,a[1]=l;for(var u=2;u{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>a,default:()=>c,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var o=n(87462),r=(n(67294),n(3905));const i={},a="kusion build",l={unversionedId:"reference/commands/kusion-build",id:"version-v0.10/reference/commands/kusion-build",title:"kusion build",description:"Build Kusion modules in a Stack to the Intent",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-build.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-build",permalink:"/docs/v0.10/reference/commands/kusion-build",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-build.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion apply",permalink:"/docs/v0.10/reference/commands/kusion-apply"},next:{title:"kusion compile",permalink:"/docs/v0.10/reference/commands/kusion-compile"}},s={},u=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],p={toc:u};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,o.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"kusion-build"},"kusion build"),(0,r.kt)("p",null,"Build Kusion modules in a Stack to the Intent"),(0,r.kt)("h3",{id:"synopsis"},"Synopsis"),(0,r.kt)("p",null,"Build Kusion modules in a Stack to the Intent"),(0,r.kt)("p",null," The command must be executed in a Stack or by specifying a Stack directory with the -w flag. You can provide a list of arguments to replace the placeholders defined in KCL, and use the --output flag to output the built results to a file"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kusion build [flags]\n")),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"}," # Build main.k with arguments\n kusion build -D name=test -D age=18\n \n # Build main.k with work directory\n kusion build -w appops/demo/dev\n \n # Build configurations and write result into an output.yaml\n kusion build -o output.yaml\n \n # Build configurations with arguments from settings.yaml\n kusion build -Y settings.yaml\n \n # Build without output style and color\n kusion build --no-style=true\n")),(0,r.kt)("h3",{id:"options"},"Options"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"}," -D, --argument stringToString Specify the top-level argument (default [])\n -h, --help help for build\n --no-style Disable the output style and color\n -o, --output string Specify the output file\n -Y, --setting strings Specify the command line setting files\n -w, --workdir string Specify the work directory\n")),(0,r.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,r.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of KusionStack")),(0,r.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a6996c29.8a862112.js b/assets/js/a6996c29.8a862112.js deleted file mode 100644 index 7141c7786e0..00000000000 --- a/assets/js/a6996c29.8a862112.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6248],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=o.createContext({}),u=function(e){var t=o.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},p=function(e){var t=u(e.components);return o.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=u(n),m=r,f=d["".concat(s,".").concat(m)]||d[m]||c[m]||i;return n?o.createElement(f,a(a({ref:t},p),{},{components:n})):o.createElement(f,a({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,a=new Array(i);a[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,a[1]=l;for(var u=2;u{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>a,default:()=>c,frontMatter:()=>i,metadata:()=>l,toc:()=>u});var o=n(87462),r=(n(67294),n(3905));const i={},a="kusion build",l={unversionedId:"reference/commands/kusion-build",id:"version-v0.10/reference/commands/kusion-build",title:"kusion build",description:"Build Kusion modules in a Stack to the Intent",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-build.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-build",permalink:"/docs/v0.10/reference/commands/kusion-build",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-build.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion apply",permalink:"/docs/v0.10/reference/commands/kusion-apply"},next:{title:"kusion compile",permalink:"/docs/v0.10/reference/commands/kusion-compile"}},s={},u=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],p={toc:u};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,o.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"kusion-build"},"kusion build"),(0,r.kt)("p",null,"Build Kusion modules in a Stack to the Intent"),(0,r.kt)("h3",{id:"synopsis"},"Synopsis"),(0,r.kt)("p",null,"Build Kusion modules in a Stack to the Intent"),(0,r.kt)("p",null," The command must be executed in a Stack or by specifying a Stack directory with the -w flag. You can provide a list of arguments to replace the placeholders defined in KCL, and use the --output flag to output the built results to a file"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kusion build [flags]\n")),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"}," # Build main.k with arguments\n kusion build -D name=test -D age=18\n \n # Build main.k with work directory\n kusion build -w appops/demo/dev\n \n # Build configurations and write result into an output.yaml\n kusion build -o output.yaml\n \n # Build configurations with arguments from settings.yaml\n kusion build -Y settings.yaml\n \n # Build without output style and color\n kusion build --no-style=true\n")),(0,r.kt)("h3",{id:"options"},"Options"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"}," -D, --argument stringToString Specify the top-level argument (default [])\n -h, --help help for build\n --no-style Disable the output style and color\n -o, --output string Specify the output file\n -Y, --setting strings Specify the command line setting files\n -w, --workdir string Specify the work directory\n")),(0,r.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,r.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of KusionStack")),(0,r.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a8efa3a6.37e7878c.js b/assets/js/a8efa3a6.37e7878c.js deleted file mode 100644 index 2314265d9c3..00000000000 --- a/assets/js/a8efa3a6.37e7878c.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7690],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),l=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=l(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),d=l(n),f=o,m=d["".concat(s,".").concat(f)]||d[f]||u[f]||a;return n?r.createElement(m,i(i({ref:t},c),{},{components:n})):r.createElement(m,i({ref:t},c))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=d;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p.mdxType="string"==typeof e?e:o,i[1]=p;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>p,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={},i="kusion apply",p={unversionedId:"reference/commands/kusion-apply",id:"version-v0.11/reference/commands/kusion-apply",title:"kusion apply",description:"Apply the operational intent of various resources to multiple runtimes",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-apply.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-apply",permalink:"/docs/reference/commands/kusion-apply",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-apply.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Kusion Commands",permalink:"/docs/reference/commands/"},next:{title:"kusion config get",permalink:"/docs/reference/commands/kusion-config-get"}},s={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],c={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-apply"},"kusion apply"),(0,o.kt)("p",null,"Apply the operational intent of various resources to multiple runtimes"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Apply a series of resource changes within the stack."),(0,o.kt)("p",null," Create, update or delete resources according to the operational intent within a stack. By default, Kusion will generate an execution preview and prompt for your approval before performing any actions. You can review the preview details and make a decision to proceed with the actions or abort them."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion apply [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Apply with specified work directory\n kusion apply -w /path/to/workdir\n \n # Apply with specified arguments\n kusion apply -D name=test -D age=18\n \n # Skip interactive approval of preview details before applying\n kusion apply --yes\n \n # Apply without output style and color\n kusion apply --no-style=true\n \n # Apply with localhost port forwarding\n kusion apply --port-forward=8080\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -a, --all --detail Automatically show all preview details, combined use with flag --detail\n --backend string The backend to use, supports 'local', 'oss' and 's3'.\n -d, --detail Automatically show preview details with interactive options (default true)\n --dry-run Preview the execution effect (always successful) without actually applying the changes\n -h, --help help for apply\n --ignore-fields strings Ignore differences of target fields\n --no-style no-style sets to RawOutput mode and disables all of styling\n --operator string Specify the operator\n -o, --output string Specify the output format\n --port-forward int Forward the specified port from local to service\n --watch After creating/updating/deleting the requested object, watch for changes\n -w, --workdir string The work directory to run Kusion CLI.\n --workspace string The name of target workspace to operate in.\n -y, --yes Automatically approve and perform the update after previewing it\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a8efa3a6.adf8fbfd.js b/assets/js/a8efa3a6.adf8fbfd.js new file mode 100644 index 00000000000..c5a8524ee38 --- /dev/null +++ b/assets/js/a8efa3a6.adf8fbfd.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7690],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),l=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=l(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),d=l(n),f=o,m=d["".concat(s,".").concat(f)]||d[f]||u[f]||a;return n?r.createElement(m,i(i({ref:t},c),{},{components:n})):r.createElement(m,i({ref:t},c))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=d;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p.mdxType="string"==typeof e?e:o,i[1]=p;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>p,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={},i="kusion apply",p={unversionedId:"reference/commands/kusion-apply",id:"version-v0.11/reference/commands/kusion-apply",title:"kusion apply",description:"Apply the operational intent of various resources to multiple runtimes",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-apply.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-apply",permalink:"/docs/reference/commands/kusion-apply",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-apply.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Kusion Commands",permalink:"/docs/reference/commands/"},next:{title:"kusion config get",permalink:"/docs/reference/commands/kusion-config-get"}},s={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],c={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-apply"},"kusion apply"),(0,o.kt)("p",null,"Apply the operational intent of various resources to multiple runtimes"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Apply a series of resource changes within the stack."),(0,o.kt)("p",null," Create, update or delete resources according to the operational intent within a stack. By default, Kusion will generate an execution preview and prompt for your approval before performing any actions. You can review the preview details and make a decision to proceed with the actions or abort them."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion apply [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Apply with specified work directory\n kusion apply -w /path/to/workdir\n \n # Apply with specified arguments\n kusion apply -D name=test -D age=18\n \n # Skip interactive approval of preview details before applying\n kusion apply --yes\n \n # Apply without output style and color\n kusion apply --no-style=true\n \n # Apply with localhost port forwarding\n kusion apply --port-forward=8080\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -a, --all --detail Automatically show all preview details, combined use with flag --detail\n --backend string The backend to use, supports 'local', 'oss' and 's3'.\n -d, --detail Automatically show preview details with interactive options (default true)\n --dry-run Preview the execution effect (always successful) without actually applying the changes\n -h, --help help for apply\n --ignore-fields strings Ignore differences of target fields\n --no-style no-style sets to RawOutput mode and disables all of styling\n --operator string Specify the operator\n -o, --output string Specify the output format\n --port-forward int Forward the specified port from local to service\n --watch After creating/updating/deleting the requested object, watch for changes\n -w, --workdir string The work directory to run Kusion CLI.\n --workspace string The name of target workspace to operate in.\n -y, --yes Automatically approve and perform the update after previewing it\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a8fa00b4.f3fdcbf2.js b/assets/js/a8fa00b4.02a7cc6f.js similarity index 52% rename from assets/js/a8fa00b4.f3fdcbf2.js rename to assets/js/a8fa00b4.02a7cc6f.js index 6d18f3ac0d0..c7c15954206 100644 --- a/assets/js/a8fa00b4.f3fdcbf2.js +++ b/assets/js/a8fa00b4.02a7cc6f.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6014],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var o=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function a(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var c=o.createContext({}),l=function(e){var n=o.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},p=function(e){var n=l(e.components);return o.createElement(c.Provider,{value:n},e.children)},f={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},u=o.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=l(t),m=r,d=u["".concat(c,".").concat(m)]||u[m]||f[m]||i;return t?o.createElement(d,a(a({ref:n},p),{},{components:t})):o.createElement(d,a({ref:n},p))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,a=new Array(i);a[0]=u;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,a[1]=s;for(var l=2;l{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>a,default:()=>f,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var o=t(87462),r=(t(67294),t(3905));const i={},a="kusion config",s={unversionedId:"reference/commands/kusion-config",id:"version-v0.11/reference/commands/kusion-config",title:"kusion config",description:"Interact with the Kusion config",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-config.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-config",permalink:"/docs/reference/commands/kusion-config",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-config.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion config unset",permalink:"/docs/reference/commands/kusion-config-unset"},next:{title:"kusion destroy",permalink:"/docs/reference/commands/kusion-destroy"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:l};function f(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,o.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"kusion-config"},"kusion config"),(0,r.kt)("p",null,"Interact with the Kusion config"),(0,r.kt)("h3",{id:"synopsis"},"Synopsis"),(0,r.kt)("p",null,"Config contains the operation of Kusion configurations."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kusion config [flags]\n")),(0,r.kt)("h3",{id:"options"},"Options"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"}," -h, --help help for config\n")),(0,r.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,r.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-config-get"},"kusion config get"),"\t - Get a config item"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-config-list"},"kusion config list"),"\t - List all config items"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-config-set"},"kusion config set"),"\t - Set a config item"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-config-unset"},"kusion config unset"),"\t - Unset a config item")),(0,r.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}f.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6014],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var o=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function a(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var c=o.createContext({}),l=function(e){var n=o.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},p=function(e){var n=l(e.components);return o.createElement(c.Provider,{value:n},e.children)},f={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},u=o.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=l(t),m=r,d=u["".concat(c,".").concat(m)]||u[m]||f[m]||i;return t?o.createElement(d,a(a({ref:n},p),{},{components:t})):o.createElement(d,a({ref:n},p))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,a=new Array(i);a[0]=u;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,a[1]=s;for(var l=2;l{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>a,default:()=>f,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var o=t(87462),r=(t(67294),t(3905));const i={},a="kusion config",s={unversionedId:"reference/commands/kusion-config",id:"version-v0.11/reference/commands/kusion-config",title:"kusion config",description:"Interact with the Kusion config",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-config.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-config",permalink:"/docs/reference/commands/kusion-config",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-config.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion config unset",permalink:"/docs/reference/commands/kusion-config-unset"},next:{title:"kusion destroy",permalink:"/docs/reference/commands/kusion-destroy"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:l};function f(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,o.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"kusion-config"},"kusion config"),(0,r.kt)("p",null,"Interact with the Kusion config"),(0,r.kt)("h3",{id:"synopsis"},"Synopsis"),(0,r.kt)("p",null,"Config contains the operation of Kusion configurations."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kusion config [flags]\n")),(0,r.kt)("h3",{id:"options"},"Options"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"}," -h, --help help for config\n")),(0,r.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,r.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-config-get"},"kusion config get"),"\t - Get a config item"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-config-list"},"kusion config list"),"\t - List all config items"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-config-set"},"kusion config set"),"\t - Set a config item"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-config-unset"},"kusion config unset"),"\t - Unset a config item")),(0,r.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a932aaa1.0003ecd5.js b/assets/js/a932aaa1.0003ecd5.js new file mode 100644 index 00000000000..1b0f2e1c3c1 --- /dev/null +++ b/assets/js/a932aaa1.0003ecd5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6657],{3905:(e,t,a)=>{a.d(t,{Zo:()=>m,kt:()=>c});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},m=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),u=s(a),c=r,k=u["".concat(p,".").concat(c)]||u[c]||d[c]||l;return a?n.createElement(k,i(i({ref:t},m),{},{components:a})):n.createElement(k,i({ref:t},m))}));function c(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,i=new Array(l);i[0]=u;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var s=2;s{a.r(t),a.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>d,frontMatter:()=>l,metadata:()=>o,toc:()=>s});var n=a(87462),r=(a(67294),a(3905));const l={},i="job",o={unversionedId:"reference/modules/developer-schemas/workload/job",id:"reference/modules/developer-schemas/workload/job",title:"job",description:"Schemas",source:"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/workload/job.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/workload",slug:"/reference/modules/developer-schemas/workload/job",permalink:"/docs/next/reference/modules/developer-schemas/workload/job",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/1-developer-schemas/workload/job.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"opsrule",permalink:"/docs/next/reference/modules/developer-schemas/opsrule/"},next:{title:"service",permalink:"/docs/next/reference/modules/developer-schemas/workload/service"}},p={},s=[{value:"Schemas",id:"schemas",level:2},{value:"Schema Job",id:"schema-job",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Base Schema",id:"base-schema",level:3},{value:"Schema Container",id:"schema-container",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3},{value:"Schema FileSpec",id:"schema-filespec",level:2},{value:"Attributes",id:"attributes-2",level:3},{value:"Examples",id:"examples-2",level:3},{value:"Schema Lifecycle",id:"schema-lifecycle",level:3},{value:"Attributes",id:"attributes-3",level:4},{value:"Examples",id:"examples-3",level:4},{value:"Schema Exec",id:"schema-exec",level:3},{value:"Attributes",id:"attributes-4",level:4},{value:"Examples",id:"examples-4",level:4},{value:"Schema Http",id:"schema-http",level:3},{value:"Attributes",id:"attributes-5",level:4},{value:"Examples",id:"examples-5",level:4},{value:"Schema Probe",id:"schema-probe",level:3},{value:"Attributes",id:"attributes-6",level:4},{value:"Examples",id:"examples-6",level:4},{value:"Schema Tcp",id:"schema-tcp",level:3},{value:"Attributes",id:"attributes-7",level:4},{value:"Examples",id:"examples-7",level:4},{value:"Schema Secret",id:"schema-secret",level:2},{value:"Attributes",id:"attributes-8",level:3},{value:"Examples",id:"examples-8",level:3}],m={toc:s};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},m,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"job"},"job"),(0,r.kt)("h2",{id:"schemas"},"Schemas"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-job"},"Job"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-container"},"Container"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-filespec"},"Filespec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-lifecycle"},"LifeCycle")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-probe"},"Probe"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-exec"},"Exec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-http"},"Http")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-tcp"},"Tcp")))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-secret"},"Secret"))))),(0,r.kt)("h2",{id:"schema-job"},"Schema Job"),(0,r.kt)("p",null,"Job is a kind of workload profile that describes how to run your application code. This",(0,r.kt)("br",null),"is typically used for tasks that take from a few seconds to a few days to complete."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"annotations")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"containers")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:",(0,r.kt)("a",{parentName:"td",href:"../internal/container#schema-container"},"Container"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Containers defines the templates of containers to be ran.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers"},"https://kubernetes.io/docs/concepts/containers")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"labels")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Labels are key/value pairs that are attached to the workload."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"replicas")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Number of container replicas based on this configuration that should be ran."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"schedule")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The scheduling strategy in Cron format. More info: ",(0,r.kt)("a",{parentName:"td",href:"https://en.wikipedia.org/wiki/Cron"},"https://en.wikipedia.org/wiki/Cron"),"."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"secrets")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:",(0,r.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/secret/#schema-secret"},"Secret"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Secrets can be used to store small amount of sensitive data e.g. password, token."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'# Instantiate a job with busybox image and runs every hour\n\nimport kam.workload as wl\nimport kam.workload.container as c\n\nechoJob : wl.Job {\n containers: {\n "busybox": c.Container{\n image: "busybox:1.28"\n command: ["/bin/sh", "-c", "echo hello"]\n }\n }\n schedule: "0 * * * *"\n}\n')),(0,r.kt)("h3",{id:"base-schema"},"Base Schema"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../internal/common#schema-workloadbase"},"WorkloadBase")),(0,r.kt)("h2",{id:"schema-container"},"Schema Container"),(0,r.kt)("p",null,"Container describes how the Application's tasks are expected to be run. Depending on",(0,r.kt)("br",null),"the replicas parameter 1 or more containers can be created from each template."),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"args")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Arguments to the entrypoint.",(0,r.kt)("br",null),"Args will overwrite the CMD value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's CMD is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Entrypoint array. Not executed within a shell.",(0,r.kt)("br",null),"Command will overwrite the ENTRYPOINT value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's ENTRYPOINT is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"dirs")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of volumes mount into the container's filesystem.",(0,r.kt)("br",null),"The dirs parameter is a dict with the key being the folder name in the container and the value",(0,r.kt)("br",null),"being the referenced volume."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"env")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"List of environment variables to set in the container.",(0,r.kt)("br",null),"The value of the environment variable may be static text or a value from a secret."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"files")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:",(0,r.kt)("a",{parentName:"td",href:"#filespec"},"FileSpec"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"List of files to create in the container.",(0,r.kt)("br",null),"The files parameter is a dict with the key being the file name in the container and the value",(0,r.kt)("br",null),"being the target file specification."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"image")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Image refers to the Docker image name to run for this container.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/images"},"https://kubernetes.io/docs/concepts/containers/images")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/container/lifecycle/#schema-lifecycle"},"lc.Lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},"Lifecycle refers to actions that the management system should take in response to container lifecycle events."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"livenessProbe")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"LivenessProbe indicates if a running process is healthy.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"readinessProbe")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"ReadinessProbe indicates whether an application is available to handle requests."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"resources")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Map of resource requirements the container should run with.",(0,r.kt)("br",null),"The resources parameter is a dict with the key being the resource name and the value being",(0,r.kt)("br",null),"the resource value."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"startupProbe")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"StartupProbe indicates that the container has started for the first time.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"workingDir")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The working directory of the running process defined in entrypoint.",(0,r.kt)("br",null),"Default container runtime will be used if this is not specified."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container as c\n\nweb = c.Container {\n image: "nginx:latest"\n command: ["/bin/sh", "-c", "echo hi"]\n env: {\n "name": "value"\n }\n resources: {\n "cpu": "2"\n "memory": "4Gi"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-filespec"},"Schema FileSpec"),(0,r.kt)("p",null,"FileSpec defines the target file in a Container."),(0,r.kt)("h3",{id:"attributes-2"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"content")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"File content in plain text."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"contentFrom")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Source for the file content, reference to a secret of configmap value."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"mode")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Mode bits used to set permissions on this file, must be an octal value",(0,r.kt)("br",null),"between 0000 and 0777 or a decimal value between 0 and 511"),(0,r.kt)("td",{parentName:"tr",align:null},'"0644"')))),(0,r.kt)("h3",{id:"examples-2"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container as c\n\ntmpFile = c.FileSpec {\n content: "some file contents"\n mode: "0777"\n}\n')),(0,r.kt)("h3",{id:"schema-lifecycle"},"Schema Lifecycle"),(0,r.kt)("p",null,"Lifecycle describes actions that the management system should take in response to container lifecycle events."),(0,r.kt)("h4",{id:"attributes-3"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"postStart")),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null},"The action to be taken after a container is created.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"preStop")),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null},"The action to be taken before a container is terminated due to an API request or",(0,r.kt)("br",null),"management event such as liveness/startup probe failure, preemption, resource contention, etc.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"))))),(0,r.kt)("h4",{id:"examples-3"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\nimport kam.workload.container.lifecycle as lc\n\nlifecycleHook = lc.Lifecycle {\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n postStart: p.Http {\n url: "http://localhost:80"\n }\n}\n')),(0,r.kt)("h3",{id:"schema-exec"},"Schema Exec"),(0,r.kt)("p",null,'Exec describes a "run in container" action.'),(0,r.kt)("h4",{id:"attributes-4"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"The command line to execute inside the container."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-4"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\nexecProbe = p.Exec {\n command: ["probe.sh"]\n}\n')),(0,r.kt)("h3",{id:"schema-http"},"Schema Http"),(0,r.kt)("p",null,"Http describes an action based on HTTP Get requests."),(0,r.kt)("h4",{id:"attributes-5"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"headers")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of custom headers to set in the request"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The full qualified url to send HTTP requests."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-5"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\nhttpProbe = p.Http {\n url: "http://localhost:80"\n headers: {\n "X-HEADER": "VALUE"\n }\n}\n')),(0,r.kt)("h3",{id:"schema-probe"},"Schema Probe"),(0,r.kt)("p",null,"Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic. There are three probe types: readiness, liveness, and startup."),(0,r.kt)("h4",{id:"attributes-6"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"failureThreshold")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimum consecutive failures for the probe to be considered failed after having succeeded."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"initialDelaySeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"The number of seconds before health checking is activated.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"periodSeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"How often (in seconds) to perform the probe."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"probeHandler")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#exec"},"Exec")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#http"},"Http")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#tcp"},"Tcp"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"successThreshold")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimum consecutive successes for the probe to be considered successful after having failed."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"terminationGracePeriod")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Duration in seconds before terminate gracefully upon probe failure."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"timeoutSeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"The number of seconds after which the probe times out.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-6"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\nprobe = p.Probe {\n probeHandler: p.Http {\n path: "/healthz"\n }\n initialDelaySeconds: 10\n}\n')),(0,r.kt)("h3",{id:"schema-tcp"},"Schema Tcp"),(0,r.kt)("p",null,"Tcp describes an action based on opening a socket."),(0,r.kt)("h4",{id:"attributes-7"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The full qualified url to open a socket."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-7"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\ntcpProbe = p.Tcp {\n url: "tcp://localhost:1234"\n}\n')),(0,r.kt)("h2",{id:"schema-secret"},"Schema Secret"),(0,r.kt)("p",null,"Secret can be used to store sensitive data."),(0,r.kt)("h3",{id:"attributes-8"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"data")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Data contains the non-binary secret data in string form."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"immutable")),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"Immutable, if set to true, ensures that data stored in the Secret cannot be updated."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"params")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of parameters used to facilitate programmatic handling of secret data."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},'"basic"'),(0,r.kt)("td",{parentName:"tr",align:null},'"token"'),(0,r.kt)("td",{parentName:"tr",align:null},'"opaque"')))),(0,r.kt)("h3",{id:"examples-8"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.secret as sec\n\nbasicAuth = sec.Secret {\n type: "basic"\n data: {\n "username": ""\n "password": ""\n }\n}\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a932aaa1.34a3a6e8.js b/assets/js/a932aaa1.34a3a6e8.js deleted file mode 100644 index 0252d72f8cb..00000000000 --- a/assets/js/a932aaa1.34a3a6e8.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6657],{3905:(e,t,a)=>{a.d(t,{Zo:()=>m,kt:()=>c});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},m=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),u=s(a),c=r,k=u["".concat(p,".").concat(c)]||u[c]||d[c]||l;return a?n.createElement(k,i(i({ref:t},m),{},{components:a})):n.createElement(k,i({ref:t},m))}));function c(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,i=new Array(l);i[0]=u;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var s=2;s{a.r(t),a.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>d,frontMatter:()=>l,metadata:()=>o,toc:()=>s});var n=a(87462),r=(a(67294),a(3905));const l={},i="job",o={unversionedId:"reference/modules/developer-schemas/workload/job",id:"reference/modules/developer-schemas/workload/job",title:"job",description:"Schemas",source:"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/workload/job.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/workload",slug:"/reference/modules/developer-schemas/workload/job",permalink:"/docs/next/reference/modules/developer-schemas/workload/job",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/1-developer-schemas/workload/job.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"opsrule",permalink:"/docs/next/reference/modules/developer-schemas/opsrule/"},next:{title:"service",permalink:"/docs/next/reference/modules/developer-schemas/workload/service"}},p={},s=[{value:"Schemas",id:"schemas",level:2},{value:"Schema Job",id:"schema-job",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Base Schema",id:"base-schema",level:3},{value:"Schema Container",id:"schema-container",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3},{value:"Schema FileSpec",id:"schema-filespec",level:2},{value:"Attributes",id:"attributes-2",level:3},{value:"Examples",id:"examples-2",level:3},{value:"Schema Lifecycle",id:"schema-lifecycle",level:3},{value:"Attributes",id:"attributes-3",level:4},{value:"Examples",id:"examples-3",level:4},{value:"Schema Exec",id:"schema-exec",level:3},{value:"Attributes",id:"attributes-4",level:4},{value:"Examples",id:"examples-4",level:4},{value:"Schema Http",id:"schema-http",level:3},{value:"Attributes",id:"attributes-5",level:4},{value:"Examples",id:"examples-5",level:4},{value:"Schema Probe",id:"schema-probe",level:3},{value:"Attributes",id:"attributes-6",level:4},{value:"Examples",id:"examples-6",level:4},{value:"Schema Tcp",id:"schema-tcp",level:3},{value:"Attributes",id:"attributes-7",level:4},{value:"Examples",id:"examples-7",level:4},{value:"Schema Secret",id:"schema-secret",level:2},{value:"Attributes",id:"attributes-8",level:3},{value:"Examples",id:"examples-8",level:3}],m={toc:s};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},m,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"job"},"job"),(0,r.kt)("h2",{id:"schemas"},"Schemas"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-job"},"Job"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-container"},"Container"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-filespec"},"Filespec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-lifecycle"},"LifeCycle")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-probe"},"Probe"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-exec"},"Exec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-http"},"Http")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-tcp"},"Tcp")))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-secret"},"Secret"))))),(0,r.kt)("h2",{id:"schema-job"},"Schema Job"),(0,r.kt)("p",null,"Job is a kind of workload profile that describes how to run your application code. This",(0,r.kt)("br",null),"is typically used for tasks that take from a few seconds to a few days to complete."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"annotations")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"containers")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:",(0,r.kt)("a",{parentName:"td",href:"../internal/container#schema-container"},"Container"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Containers defines the templates of containers to be ran.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers"},"https://kubernetes.io/docs/concepts/containers")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"labels")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Labels are key/value pairs that are attached to the workload."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"replicas")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Number of container replicas based on this configuration that should be ran."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"schedule")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The scheduling strategy in Cron format. More info: ",(0,r.kt)("a",{parentName:"td",href:"https://en.wikipedia.org/wiki/Cron"},"https://en.wikipedia.org/wiki/Cron"),"."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"secrets")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:",(0,r.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/secret/#schema-secret"},"Secret"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Secrets can be used to store small amount of sensitive data e.g. password, token."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'# Instantiate a job with busybox image and runs every hour\n\nimport kam.workload as wl\nimport kam.workload.container as c\n\nechoJob : wl.Job {\n containers: {\n "busybox": c.Container{\n image: "busybox:1.28"\n command: ["/bin/sh", "-c", "echo hello"]\n }\n }\n schedule: "0 * * * *"\n}\n')),(0,r.kt)("h3",{id:"base-schema"},"Base Schema"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../internal/common#schema-workloadbase"},"WorkloadBase")),(0,r.kt)("h2",{id:"schema-container"},"Schema Container"),(0,r.kt)("p",null,"Container describes how the Application's tasks are expected to be run. Depending on",(0,r.kt)("br",null),"the replicas parameter 1 or more containers can be created from each template."),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"args")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Arguments to the entrypoint.",(0,r.kt)("br",null),"Args will overwrite the CMD value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's CMD is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Entrypoint array. Not executed within a shell.",(0,r.kt)("br",null),"Command will overwrite the ENTRYPOINT value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's ENTRYPOINT is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"dirs")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of volumes mount into the container's filesystem.",(0,r.kt)("br",null),"The dirs parameter is a dict with the key being the folder name in the container and the value",(0,r.kt)("br",null),"being the referenced volume."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"env")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"List of environment variables to set in the container.",(0,r.kt)("br",null),"The value of the environment variable may be static text or a value from a secret."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"files")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:",(0,r.kt)("a",{parentName:"td",href:"#filespec"},"FileSpec"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"List of files to create in the container.",(0,r.kt)("br",null),"The files parameter is a dict with the key being the file name in the container and the value",(0,r.kt)("br",null),"being the target file specification."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"image")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Image refers to the Docker image name to run for this container.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/images"},"https://kubernetes.io/docs/concepts/containers/images")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/container/lifecycle/#schema-lifecycle"},"lc.Lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},"Lifecycle refers to actions that the management system should take in response to container lifecycle events."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"livenessProbe")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"LivenessProbe indicates if a running process is healthy.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"readinessProbe")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"ReadinessProbe indicates whether an application is available to handle requests."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"resources")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Map of resource requirements the container should run with.",(0,r.kt)("br",null),"The resources parameter is a dict with the key being the resource name and the value being",(0,r.kt)("br",null),"the resource value."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"startupProbe")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/next/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"StartupProbe indicates that the container has started for the first time.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"workingDir")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The working directory of the running process defined in entrypoint.",(0,r.kt)("br",null),"Default container runtime will be used if this is not specified."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container as c\n\nweb = c.Container {\n image: "nginx:latest"\n command: ["/bin/sh", "-c", "echo hi"]\n env: {\n "name": "value"\n }\n resources: {\n "cpu": "2"\n "memory": "4Gi"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-filespec"},"Schema FileSpec"),(0,r.kt)("p",null,"FileSpec defines the target file in a Container."),(0,r.kt)("h3",{id:"attributes-2"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"content")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"File content in plain text."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"contentFrom")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Source for the file content, reference to a secret of configmap value."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"mode")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Mode bits used to set permissions on this file, must be an octal value",(0,r.kt)("br",null),"between 0000 and 0777 or a decimal value between 0 and 511"),(0,r.kt)("td",{parentName:"tr",align:null},'"0644"')))),(0,r.kt)("h3",{id:"examples-2"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container as c\n\ntmpFile = c.FileSpec {\n content: "some file contents"\n mode: "0777"\n}\n')),(0,r.kt)("h3",{id:"schema-lifecycle"},"Schema Lifecycle"),(0,r.kt)("p",null,"Lifecycle describes actions that the management system should take in response to container lifecycle events."),(0,r.kt)("h4",{id:"attributes-3"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"postStart")),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null},"The action to be taken after a container is created.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"preStop")),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null},"The action to be taken before a container is terminated due to an API request or",(0,r.kt)("br",null),"management event such as liveness/startup probe failure, preemption, resource contention, etc.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"))))),(0,r.kt)("h4",{id:"examples-3"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\nimport kam.workload.container.lifecycle as lc\n\nlifecycleHook = lc.Lifecycle {\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n postStart: p.Http {\n url: "http://localhost:80"\n }\n}\n')),(0,r.kt)("h3",{id:"schema-exec"},"Schema Exec"),(0,r.kt)("p",null,'Exec describes a "run in container" action.'),(0,r.kt)("h4",{id:"attributes-4"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"The command line to execute inside the container."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-4"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\nexecProbe = p.Exec {\n command: ["probe.sh"]\n}\n')),(0,r.kt)("h3",{id:"schema-http"},"Schema Http"),(0,r.kt)("p",null,"Http describes an action based on HTTP Get requests."),(0,r.kt)("h4",{id:"attributes-5"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"headers")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of custom headers to set in the request"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The full qualified url to send HTTP requests."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-5"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\nhttpProbe = p.Http {\n url: "http://localhost:80"\n headers: {\n "X-HEADER": "VALUE"\n }\n}\n')),(0,r.kt)("h3",{id:"schema-probe"},"Schema Probe"),(0,r.kt)("p",null,"Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic. There are three probe types: readiness, liveness, and startup."),(0,r.kt)("h4",{id:"attributes-6"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"failureThreshold")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimum consecutive failures for the probe to be considered failed after having succeeded."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"initialDelaySeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"The number of seconds before health checking is activated.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"periodSeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"How often (in seconds) to perform the probe."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"probeHandler")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#exec"},"Exec")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#http"},"Http")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#tcp"},"Tcp"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"successThreshold")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimum consecutive successes for the probe to be considered successful after having failed."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"terminationGracePeriod")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Duration in seconds before terminate gracefully upon probe failure."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"timeoutSeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"The number of seconds after which the probe times out.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-6"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\nprobe = p.Probe {\n probeHandler: p.Http {\n path: "/healthz"\n }\n initialDelaySeconds: 10\n}\n')),(0,r.kt)("h3",{id:"schema-tcp"},"Schema Tcp"),(0,r.kt)("p",null,"Tcp describes an action based on opening a socket."),(0,r.kt)("h4",{id:"attributes-7"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The full qualified url to open a socket."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-7"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\ntcpProbe = p.Tcp {\n url: "tcp://localhost:1234"\n}\n')),(0,r.kt)("h2",{id:"schema-secret"},"Schema Secret"),(0,r.kt)("p",null,"Secret can be used to store sensitive data."),(0,r.kt)("h3",{id:"attributes-8"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"data")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Data contains the non-binary secret data in string form."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"immutable")),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"Immutable, if set to true, ensures that data stored in the Secret cannot be updated."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"params")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of parameters used to facilitate programmatic handling of secret data."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},'"basic"'),(0,r.kt)("td",{parentName:"tr",align:null},'"token"'),(0,r.kt)("td",{parentName:"tr",align:null},'"opaque"')))),(0,r.kt)("h3",{id:"examples-8"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.secret as sec\n\nbasicAuth = sec.Secret {\n type: "basic"\n data: {\n "username": ""\n "password": ""\n }\n}\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a93b393b.27db29b6.js b/assets/js/a93b393b.27db29b6.js new file mode 100644 index 00000000000..fb7db7c163d --- /dev/null +++ b/assets/js/a93b393b.27db29b6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3643],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=a.createContext({}),l=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=l(e.components);return a.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=l(n),m=o,f=d["".concat(p,".").concat(m)]||d[m]||u[m]||r;return n?a.createElement(f,i(i({ref:t},c),{},{components:n})):a.createElement(f,i({ref:t},c))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,i=new Array(r);i[0]=d;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>u,frontMatter:()=>r,metadata:()=>s,toc:()=>l});var a=n(87462),o=(n(67294),n(3905));const r={id:"kusion-vs-x"},i="Kusion vs Other Software",s={unversionedId:"what-is-kusion/kusion-vs-x",id:"version-v0.11/what-is-kusion/kusion-vs-x",title:"Kusion vs Other Software",description:"It can be difficult to understand how different software compare to each other. Is one a replacement for the other? Are they complementary? etc. In this section, we compare Kusion to other software.",source:"@site/docs_versioned_docs/version-v0.11/1-what-is-kusion/2-kusion-vs-x.md",sourceDirName:"1-what-is-kusion",slug:"/what-is-kusion/kusion-vs-x",permalink:"/docs/what-is-kusion/kusion-vs-x",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/1-what-is-kusion/2-kusion-vs-x.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"kusion-vs-x"},sidebar:"kusion",previous:{title:"Overview",permalink:"/docs/"},next:{title:"Install Kusion",permalink:"/docs/getting-started/install-kusion"}},p={},l=[],c={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-vs-other-software"},"Kusion vs Other Software"),(0,o.kt)("p",null,"It can be difficult to understand how different software compare to each other. Is one a replacement for the other? Are they complementary? etc. In this section, we compare Kusion to other software."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. GitOps (ArgoCD, FluxCD, etc.)")),(0,o.kt)("p",null,"According to the ",(0,o.kt)("a",{parentName:"p",href:"https://opengitops.dev/"},"open GitOps principles"),", GitOps systems typically have its desired state expressed declaratively, continuously observe actual system state and attempt to apply the desired state. In the design of Kusion toolchain, we refer to those principles but have no intention to reinvent any GitOps systems wheel. "),(0,o.kt)("p",null,"Kusion adopts your GitOps process and improves it with richness of features. The declarative ",(0,o.kt)("a",{parentName:"p",href:"../concepts/app-configuration"},"AppConfiguration")," model can be used to express desired intent, once intent is declared ",(0,o.kt)("a",{parentName:"p",href:"../reference/commands"},"Kusion CLI")," takes the role to make production match intent as safely as possible. "),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. PaaS (Heroku, Vercel, etc.)")),(0,o.kt)("p",null,"Kusion shares the same goal with traditional PaaS platforms to provide application delivery and management capabilities. The intuitive difference from the full functionality PaaS platforms is that Kusion is a client-side toolchain, not a complete PaaS platform. "),(0,o.kt)("p",null,"Also traditional PaaS platforms typically constrain the type of applications they can run but there is no such constrain for Kusion which means Kusion provides greater flexibility."),(0,o.kt)("p",null,"Kusion allows you to have platform-like features without the constraints of a traditional PaaS. However, Kusion is not attempting to replace any PaaS platforms, instead Kusion can be used to deploy to a platform such as Heroku."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. KubeVela")),(0,o.kt)("p",null,"KubeVela is a modern software delivery and management control plane which makes it easier to deploy and operate applications on top of Kubernetes."),(0,o.kt)("p",null,"Although some might initially perceive an overlap between Kusion and KubeVela, they are in fact complementary and can be integrated to work together. As a lightweight, purely client-side tool, coupled with corresponding ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion-module-framework"},"Generator")," implementation, Kusion can render ",(0,o.kt)("a",{parentName:"p",href:"../concepts/app-configuration"},"AppConfiguration")," schema to generate CRD resources for KubeVela and leverage KubeVela's control plane to implement application delivery."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. Helm")),(0,o.kt)("p",null,"The concept of Helm originates from the ",(0,o.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Package_manager"},"package management")," mechanism of the operating system. It is a package management tool based on templated YAML files and supports the execution and management of resources in the package. "),(0,o.kt)("p",null,"Kusion is not a package manager. Kusion naturally provides a superset of Helm capabilities with the modeled key-value pairs, so that developers can use Kusion directly as a programable alternative to avoid the pain of writing text templates. For users who have adopted Helm, the stack compilation results in Kusion can be packaged and used in Helm format."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. Kubernetes")),(0,o.kt)("p",null,'Kubernetes(K8s) is a container scheduling and management runtime widely used around the world, an "operating system" core for containers, and a platform for building platforms. Above the Kubernetes API layer, Kusion aims to provide app-centric ',(0,o.kt)("strong",{parentName:"p"},"abstraction")," and unified ",(0,o.kt)("strong",{parentName:"p"},"workspace"),", better ",(0,o.kt)("strong",{parentName:"p"},"user experience")," and automation ",(0,o.kt)("strong",{parentName:"p"},"workflow"),", and helps developers build the app delivery model easily and collaboratively."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a93b393b.e801a22b.js b/assets/js/a93b393b.e801a22b.js deleted file mode 100644 index 7047e50c60c..00000000000 --- a/assets/js/a93b393b.e801a22b.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3643],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=a.createContext({}),l=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=l(e.components);return a.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=l(n),m=o,f=d["".concat(p,".").concat(m)]||d[m]||u[m]||r;return n?a.createElement(f,i(i({ref:t},c),{},{components:n})):a.createElement(f,i({ref:t},c))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,i=new Array(r);i[0]=d;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>u,frontMatter:()=>r,metadata:()=>s,toc:()=>l});var a=n(87462),o=(n(67294),n(3905));const r={id:"kusion-vs-x"},i="Kusion vs Other Software",s={unversionedId:"what-is-kusion/kusion-vs-x",id:"version-v0.11/what-is-kusion/kusion-vs-x",title:"Kusion vs Other Software",description:"It can be difficult to understand how different software compare to each other. Is one a replacement for the other? Are they complementary? etc. In this section, we compare Kusion to other software.",source:"@site/docs_versioned_docs/version-v0.11/1-what-is-kusion/2-kusion-vs-x.md",sourceDirName:"1-what-is-kusion",slug:"/what-is-kusion/kusion-vs-x",permalink:"/docs/what-is-kusion/kusion-vs-x",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/1-what-is-kusion/2-kusion-vs-x.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"kusion-vs-x"},sidebar:"kusion",previous:{title:"Overview",permalink:"/docs/"},next:{title:"Install Kusion",permalink:"/docs/getting-started/install-kusion"}},p={},l=[],c={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-vs-other-software"},"Kusion vs Other Software"),(0,o.kt)("p",null,"It can be difficult to understand how different software compare to each other. Is one a replacement for the other? Are they complementary? etc. In this section, we compare Kusion to other software."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. GitOps (ArgoCD, FluxCD, etc.)")),(0,o.kt)("p",null,"According to the ",(0,o.kt)("a",{parentName:"p",href:"https://opengitops.dev/"},"open GitOps principles"),", GitOps systems typically have its desired state expressed declaratively, continuously observe actual system state and attempt to apply the desired state. In the design of Kusion toolchain, we refer to those principles but have no intention to reinvent any GitOps systems wheel. "),(0,o.kt)("p",null,"Kusion adopts your GitOps process and improves it with richness of features. The declarative ",(0,o.kt)("a",{parentName:"p",href:"../concepts/app-configuration"},"AppConfiguration")," model can be used to express desired intent, once intent is declared ",(0,o.kt)("a",{parentName:"p",href:"../reference/commands"},"Kusion CLI")," takes the role to make production match intent as safely as possible. "),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. PaaS (Heroku, Vercel, etc.)")),(0,o.kt)("p",null,"Kusion shares the same goal with traditional PaaS platforms to provide application delivery and management capabilities. The intuitive difference from the full functionality PaaS platforms is that Kusion is a client-side toolchain, not a complete PaaS platform. "),(0,o.kt)("p",null,"Also traditional PaaS platforms typically constrain the type of applications they can run but there is no such constrain for Kusion which means Kusion provides greater flexibility."),(0,o.kt)("p",null,"Kusion allows you to have platform-like features without the constraints of a traditional PaaS. However, Kusion is not attempting to replace any PaaS platforms, instead Kusion can be used to deploy to a platform such as Heroku."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. KubeVela")),(0,o.kt)("p",null,"KubeVela is a modern software delivery and management control plane which makes it easier to deploy and operate applications on top of Kubernetes."),(0,o.kt)("p",null,"Although some might initially perceive an overlap between Kusion and KubeVela, they are in fact complementary and can be integrated to work together. As a lightweight, purely client-side tool, coupled with corresponding ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion-module-framework"},"Generator")," implementation, Kusion can render ",(0,o.kt)("a",{parentName:"p",href:"../concepts/app-configuration"},"AppConfiguration")," schema to generate CRD resources for KubeVela and leverage KubeVela's control plane to implement application delivery."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. Helm")),(0,o.kt)("p",null,"The concept of Helm originates from the ",(0,o.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Package_manager"},"package management")," mechanism of the operating system. It is a package management tool based on templated YAML files and supports the execution and management of resources in the package. "),(0,o.kt)("p",null,"Kusion is not a package manager. Kusion naturally provides a superset of Helm capabilities with the modeled key-value pairs, so that developers can use Kusion directly as a programable alternative to avoid the pain of writing text templates. For users who have adopted Helm, the stack compilation results in Kusion can be packaged and used in Helm format."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. Kubernetes")),(0,o.kt)("p",null,'Kubernetes(K8s) is a container scheduling and management runtime widely used around the world, an "operating system" core for containers, and a platform for building platforms. Above the Kubernetes API layer, Kusion aims to provide app-centric ',(0,o.kt)("strong",{parentName:"p"},"abstraction")," and unified ",(0,o.kt)("strong",{parentName:"p"},"workspace"),", better ",(0,o.kt)("strong",{parentName:"p"},"user experience")," and automation ",(0,o.kt)("strong",{parentName:"p"},"workflow"),", and helps developers build the app delivery model easily and collaboratively."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a9c8d21a.5730115f.js b/assets/js/a9c8d21a.5730115f.js new file mode 100644 index 00000000000..c1affd6b65d --- /dev/null +++ b/assets/js/a9c8d21a.5730115f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5194],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),p=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},l=function(e){var t=p(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=p(n),m=o,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||i;return n?r.createElement(f,a(a({ref:t},l),{},{components:n})):r.createElement(f,a({ref:t},l))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=u;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>p});var r=n(87462),o=(n(67294),n(3905));const i={},a="kusion init",s={unversionedId:"reference/commands/kusion-init",id:"version-v0.11/reference/commands/kusion-init",title:"kusion init",description:"Initialize the scaffolding for a demo project",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-init.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-init",permalink:"/docs/reference/commands/kusion-init",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-init.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion generate",permalink:"/docs/reference/commands/kusion-generate"},next:{title:"kusion mod init",permalink:"/docs/reference/commands/kusion-mod-init"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function d(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-init"},"kusion init"),(0,o.kt)("p",null,"Initialize the scaffolding for a demo project"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command initializes the scaffolding for a demo project with the name of the current directory to help users quickly get started."),(0,o.kt)("p",null," Note that target directory needs to be an empty directory."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion init [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Initialize a demo project with the name of the current directory\n mkdir quickstart && cd quickstart\n kusion init\n \n # Initialize the demo project in a different target directory\n kusion init --target projects/my-demo-project\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for init\n -t, --target string specify the target directory\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/a9c8d21a.917f5173.js b/assets/js/a9c8d21a.917f5173.js deleted file mode 100644 index 204eff8d859..00000000000 --- a/assets/js/a9c8d21a.917f5173.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5194],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=l(n),m=o,f=u["".concat(c,".").concat(m)]||u[m]||d[m]||i;return n?r.createElement(f,a(a({ref:t},p),{},{components:n})):r.createElement(f,a({ref:t},p))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=u;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const i={},a="kusion init",s={unversionedId:"reference/commands/kusion-init",id:"version-v0.11/reference/commands/kusion-init",title:"kusion init",description:"Initialize the scaffolding for a demo project",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-init.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-init",permalink:"/docs/reference/commands/kusion-init",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-init.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion generate",permalink:"/docs/reference/commands/kusion-generate"},next:{title:"kusion mod init",permalink:"/docs/reference/commands/kusion-mod-init"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:l};function d(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-init"},"kusion init"),(0,o.kt)("p",null,"Initialize the scaffolding for a demo project"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command initializes the scaffolding for a demo project with the name of the current directory to help users quickly get started."),(0,o.kt)("p",null," Note that target directory needs to be an empty directory."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion init [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Initialize a demo project with the name of the current directory\n mkdir quickstart && cd quickstart\n kusion init\n \n # Initialize the demo project in a different target directory\n kusion init --target projects/my-demo-project\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for init\n -t, --target string specify the target directory\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/abc4e0a8.0265feac.js b/assets/js/abc4e0a8.0265feac.js new file mode 100644 index 00000000000..369d071dd13 --- /dev/null +++ b/assets/js/abc4e0a8.0265feac.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2204],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var i=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=i.createContext({}),p=function(e){var t=i.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},c=function(e){var t=p(e.components);return i.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},d=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(n),m=a,k=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return n?i.createElement(k,r(r({ref:t},c),{},{components:n})):i.createElement(k,r({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,r=new Array(o);r[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,r[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>r,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var i=n(87462),a=(n(67294),n(3905));const o={id:"overview"},r="Configuration File Overview",l={unversionedId:"configuration-walkthrough/overview",id:"configuration-walkthrough/overview",title:"Configuration File Overview",description:"Kusion consumes one or more declarative configuration files (written in KCL) that describe the application, and delivers intent to the target runtime including Kubernetes, clouds, or on-prem infrastructure.",source:"@site/docs/kusion/4-configuration-walkthrough/1-overview.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/overview",permalink:"/docs/next/configuration-walkthrough/overview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/4-configuration-walkthrough/1-overview.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"overview"},sidebar:"kusion",previous:{title:"How Kusion Works?",permalink:"/docs/next/concepts/how-kusion-works"},next:{title:"KCL Basics",permalink:"/docs/next/configuration-walkthrough/kcl-basics"}},s={},p=[{value:"Table of Content",id:"table-of-content",level:2},{value:"Directory Structure",id:"directory-structure",level:2},{value:"AppConfiguration Model",id:"appconfiguration-model",level:2},{value:"Authoring Configuration Files",id:"authoring-configuration-files",level:2},{value:"Identifying KCL file",id:"identifying-kcl-file",level:3},{value:"KCL Schemas and KAM",id:"kcl-schemas-and-kam",level:3},{value:"Kusion Modules",id:"kusion-modules",level:3},{value:"Import Statements",id:"import-statements",level:3},{value:"Understanding kcl.mod",id:"understanding-kclmod",level:3},{value:"Building Blocks",id:"building-blocks",level:3},{value:"Instantiating an application",id:"instantiating-an-application",level:3},{value:"Using kusion init",id:"using-kusion-init",level:3},{value:"Using references",id:"using-references",level:3}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,i.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"configuration-file-overview"},"Configuration File Overview"),(0,a.kt)("p",null,"Kusion consumes one or more declarative configuration files (written in KCL) that describe the application, and delivers intent to the target runtime including Kubernetes, clouds, or on-prem infrastructure."),(0,a.kt)("p",null,"This documentation series walks you through the odds and ends of managing such configuration files."),(0,a.kt)("h2",{id:"table-of-content"},"Table of Content"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#configuration-file-overview"},"Configuration File Overview"),(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#table-of-content"},"Table of Content")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#directory-structure"},"Directory Structure")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#appconfiguration-model"},"AppConfiguration Model")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#authoring-configuration-files"},"Authoring Configuration Files"),(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#identifying-kcl-file"},"Identifying KCL file")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#kcl-schemas-and-kam"},"KCL Schemas and KAM")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#kusion-modules"},"Kusion Modules")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#import-statements"},"Import Statements")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#understanding-kclmod"},"Understanding kcl.mod")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#building-blocks"},"Building Blocks")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#instantiating-an-application"},"Instantiating an application")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#using-kusion-init"},"Using ",(0,a.kt)("inlineCode",{parentName:"a"},"kusion init"))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#using-references"},"Using references"))))))),(0,a.kt)("h2",{id:"directory-structure"},"Directory Structure"),(0,a.kt)("p",null,"Kusion expects the configuration file to be placed in a certain directory structure because it might need some metadata (that is not stored in the application configuration itself) in order to proceed."),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"See ",(0,a.kt)("a",{parentName:"p",href:"../concepts/project/overview"},"Project")," and ",(0,a.kt)("a",{parentName:"p",href:"../concepts/stack/overview"},"Stack")," for more details about Project and Stack.")),(0,a.kt)("p",null,"A sample multi-stack directory structure looks like the following:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"~/playground$ tree multi-stack-project/\nmulti-stack-project/\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 base\n\u2502\xa0\xa0 \u2514\u2500\u2500 base.k\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u251c\u2500\u2500 prod\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n")),(0,a.kt)("p",null,"In general, the directory structure follows a hierarchy where the top-level is the project configurations, and the sub-directories represent stack-level configurations."),(0,a.kt)("p",null,"You may notice there is a ",(0,a.kt)("inlineCode",{parentName:"p"},"base")," directory besides all the stacks. The ",(0,a.kt)("inlineCode",{parentName:"p"},"base")," directory is not mandatory, but rather a place to store common configurations between different stacks. A common pattern we observed is to use stacks to represent different stages (dev, stage, prod, etc.) in the software development lifecycle, and/or different deployment targets (azure-eastus, aws-us-east-1, etc). A project can have as many stacks as needed."),(0,a.kt)("p",null,"In practice, the applications deployed into dev and prod might very likely end up with a similar set of configurations except a few fields such as the application image (dev might be on newer versions), resource requirements (prod might require more resources), etc."),(0,a.kt)("p",null,"As a general best practice, we recommend managing the common configurations in ",(0,a.kt)("inlineCode",{parentName:"p"},"base.k")," as much as possible to minimize duplicate code. We will cover how override works in ",(0,a.kt)("a",{parentName:"p",href:"base-override"},"Base and Override"),"."),(0,a.kt)("h2",{id:"appconfiguration-model"},"AppConfiguration Model"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," is the out-of-the-box model we build that describes an application. It serves as the declarative intent for a given application."),(0,a.kt)("p",null,"The schema for ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," is defined in the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kam/blob/main/v1/app_configuration.k"},"KusionStack/kam")," repository. It is designed as a unified, application-centric model that encapsulates the comprehensive configuration details and in the meantime, hides the complexity of the infrastructure as much as possible."),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," consists of multiple sub-components that each represent either the application workload itself, its dependencies (in the form of ",(0,a.kt)("a",{parentName:"p",href:"../concepts/kusion-module/overview"},"Kusion Modules"),"), relevant workflows or operational expectations. We will deep dive into the details on how to author each of these elements in this upcoming documentation series."),(0,a.kt)("p",null,"For more details on the ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),", please refer to the ",(0,a.kt)("a",{parentName:"p",href:"../concepts/app-configuration"},"design documentation"),"."),(0,a.kt)("h2",{id:"authoring-configuration-files"},"Authoring Configuration Files"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://kcl-lang.io/"},"KCL")," is the choice of configuration language consumed by Kusion. KCL is an open-source constraint-based record and functional language. KCL works well with a large number of complex configurations via modern programming language technology and practice, and is committed to provide better modularity, scalability, stability and extensibility."),(0,a.kt)("h3",{id:"identifying-kcl-file"},"Identifying KCL file"),(0,a.kt)("p",null,"KCL files are identified with ",(0,a.kt)("inlineCode",{parentName:"p"},".k")," suffix in the filename."),(0,a.kt)("h3",{id:"kcl-schemas-and-kam"},"KCL Schemas and KAM"),(0,a.kt)("p",null,"Similar to most modern General Programming Languages (GPLs), KCL provide packages that are used to organize collections of related KCL source files into modular and re-usable units."),(0,a.kt)("p",null,"In the context of Kusion, we abstracted a core set of KCL Schemas (such as the aforementioned ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"Workload"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"Container"),", etc)that represent the concepts that we believe that are relatively universal and developer-friendly, also known as ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kam"},"Kusion Application Model"),", or KAM."),(0,a.kt)("h3",{id:"kusion-modules"},"Kusion Modules"),(0,a.kt)("p",null,"To extend the capabilities beyond the core KAM model, we use a concept known as ",(0,a.kt)("a",{parentName:"p",href:"../concepts/kusion-module/overview"},"Kusion Modules")," to define components that could best abstract the capabilities during an application delivery. We provide a collection of official out-of-the-box Kusion Modules that represents the most common capabilities. They are maintained in ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/orgs/KusionStack/packages"},"KusionStack's GitHub container registry"),". When authoring an application configuration file, you can simply declare said Kusion Modules as dependencies and import them to declare ship-time capabilities that the application requires."),(0,a.kt)("p",null,"If the modules in the KusionStack container registry does not meet the needs of your applications, Kusion provides the necessary mechanisms to extend with custom-built Kusion Modules. You can always create and publish your own module, then import the new module in your application configuration written in KCL."),(0,a.kt)("p",null,"For the steps to develop your own module, please refer to the Module developer guide."),(0,a.kt)("h3",{id:"import-statements"},"Import Statements"),(0,a.kt)("p",null,"An example of the import looks like the following:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"### import from the official kam package\nimport kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\n\n### import kusion modules\nimport monitoring as m\nimport network.network as n\n")),(0,a.kt)("p",null,"Take ",(0,a.kt)("inlineCode",{parentName:"p"},"import kam.v1.workload as wl")," as an example, the ",(0,a.kt)("inlineCode",{parentName:"p"},".v1.workload")," part after ",(0,a.kt)("inlineCode",{parentName:"p"},"import kam")," represents the relative path of a specific schema to import. In this case, the ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," schema is defined under ",(0,a.kt)("inlineCode",{parentName:"p"},"v1/workload")," directory in the ",(0,a.kt)("inlineCode",{parentName:"p"},"kam")," package."),(0,a.kt)("h3",{id:"understanding-kclmod"},"Understanding kcl.mod"),(0,a.kt)("p",null,"Much similar to the concept of ",(0,a.kt)("inlineCode",{parentName:"p"},"go.mod"),", Kusion uses ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," as the source of truth to manage metadata (such as package name, dependencies, etc.) for the current package. Kusion will also auto-generate a ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod.lock")," as the dependency lock file."),(0,a.kt)("p",null,"The most common usage for ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," is to manage the dependency of your application configuration file. "),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"Please note this ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," will be automatically generated if you are using ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init")," to initialize a project with a template. You will only need to modify this file if you are modifying the project metadata outside the initialization process, such as upgrading the dependency version or adding a new dependency altogether, etc.")),(0,a.kt)("p",null,"There are 3 sections in a ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"package"),", representing the metadata for the current package."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dependencies"),", describing the packages the current package depends on. Supports referencing either a git repository or an OCI artifact."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"profile"),", defining the behavior for Kusion. In the example below, it describes the list of files Kusion should look for when parsing the application configuration.")),(0,a.kt)("p",null,"An example of ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'[package]\nname = "multi-stack-project"\nedition = "0.5.0"\nversion = "0.1.0"\n\n[dependencies]\nmonitoring = { oci = "oci://ghcr.io/kusionstack/monitoring", tag = "0.1.0" }\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\n# Uncomment the line below to use your own modified module\n# my-module = { oci = "oci://ghcr.io/my-repository/my-package", tag = "my-version" }\n\n[profile]\nentries = ["../base/base.k", "main.k"]\n')),(0,a.kt)("h3",{id:"building-blocks"},"Building Blocks"),(0,a.kt)("p",null,"Configuration files consist of building blocks that are made of instances of schemas. An ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance consists of several child schemas, most of which are optional. The only mandatory one is the ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," instance. We will take a closer look in the ",(0,a.kt)("a",{parentName:"p",href:"workload"},"workload walkthrough"),". The order of the building blocks does NOT matter."),(0,a.kt)("p",null,"The major building blocks as of version ",(0,a.kt)("inlineCode",{parentName:"p"},"0.11.0"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {}\n ...\n }\n secrets: {}\n ...\n }\n # optional dependencies, usually expressed in kusion modules\n accessories: {\n ...\n }\n ...\n}\n')),(0,a.kt)("p",null,"We will deep dive into each one of the building blocks in this documentation series."),(0,a.kt)("h3",{id:"instantiating-an-application"},"Instantiating an application"),(0,a.kt)("p",null,"In Kusion's out-of-the-box experience, an application is identified with an instance of ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),". You may have more than one application in the same project or stack."),(0,a.kt)("p",null,"Here's an example of a configuration that can be consumed by Kusion (assuming it is placed inside the proper directory structure that includes project and stack configurations, with a ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," present):"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network.network as n\n\ngocity: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "gocity": c.Container {\n image = "howieyuen/gocity:latest"\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n public: True\n }\n ]\n }\n }\n}\n')),(0,a.kt)("p",null,"Don't worry about what ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"n.Network")," stand for at the moment. We will deep dive into each one of them in this upcoming documentation series."),(0,a.kt)("h3",{id:"using-kusion-init"},"Using ",(0,a.kt)("inlineCode",{parentName:"h3"},"kusion init")),(0,a.kt)("p",null,"Kusion offers a ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init")," sub-command which initializes a new project using some pre-built templates, which saves you from the hassle of manually building the aforementioned directory structure that Kusion expects."),(0,a.kt)("p",null,"There is a built-in template ",(0,a.kt)("inlineCode",{parentName:"p"},"single-stack-sample")," in the Kusion binary that can be used offline. "),(0,a.kt)("p",null,"We also maintain a ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion-templates"},"kusion-templates repository")," that hosts a list of more comprehensive project scaffolds. You can access them via ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init --online")," command which requires connectivity to ",(0,a.kt)("inlineCode",{parentName:"p"},"github.com"),"."),(0,a.kt)("p",null,"The pre-built templates are meant to help you get off the ground quickly with some simple out-of-the-box examples. You can refer to the ",(0,a.kt)("a",{parentName:"p",href:"../getting-started/deliver-quickstart"},"QuickStart documentation")," for some step-by-step tutorials."),(0,a.kt)("h3",{id:"using-references"},"Using references"),(0,a.kt)("p",null,"The reference documentation for the ",(0,a.kt)("inlineCode",{parentName:"p"},"kam")," package and the official Kusion Modules is located in ",(0,a.kt)("a",{parentName:"p",href:"../reference/modules/developer-schemas/app-configuration"},"Reference"),"."),(0,a.kt)("p",null,"If you are using them out of the box, the reference documentation provides a comprehensive view for each schema involved, including all the attribute names and description, their types, default value if any, and whether a particular attribute is required or not. There will also be an example attached to each schema reference."),(0,a.kt)("p",null,"We will also deep dive into some common examples in the upcoming sections."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/abc4e0a8.f41be974.js b/assets/js/abc4e0a8.f41be974.js deleted file mode 100644 index 5a5a74f9575..00000000000 --- a/assets/js/abc4e0a8.f41be974.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2204],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var i=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=i.createContext({}),p=function(e){var t=i.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},c=function(e){var t=p(e.components);return i.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},d=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(n),m=a,k=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return n?i.createElement(k,r(r({ref:t},c),{},{components:n})):i.createElement(k,r({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,r=new Array(o);r[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,r[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>r,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var i=n(87462),a=(n(67294),n(3905));const o={id:"overview"},r="Configuration File Overview",l={unversionedId:"configuration-walkthrough/overview",id:"configuration-walkthrough/overview",title:"Configuration File Overview",description:"Kusion consumes one or more declarative configuration files (written in KCL) that describe the application, and delivers intent to the target runtime including Kubernetes, clouds, or on-prem infrastructure.",source:"@site/docs/kusion/4-configuration-walkthrough/1-overview.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/overview",permalink:"/docs/next/configuration-walkthrough/overview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/4-configuration-walkthrough/1-overview.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"overview"},sidebar:"kusion",previous:{title:"How Kusion Works?",permalink:"/docs/next/concepts/how-kusion-works"},next:{title:"KCL Basics",permalink:"/docs/next/configuration-walkthrough/kcl-basics"}},s={},p=[{value:"Table of Content",id:"table-of-content",level:2},{value:"Directory Structure",id:"directory-structure",level:2},{value:"AppConfiguration Model",id:"appconfiguration-model",level:2},{value:"Authoring Configuration Files",id:"authoring-configuration-files",level:2},{value:"Identifying KCL file",id:"identifying-kcl-file",level:3},{value:"KCL Schemas and KAM",id:"kcl-schemas-and-kam",level:3},{value:"Kusion Modules",id:"kusion-modules",level:3},{value:"Import Statements",id:"import-statements",level:3},{value:"Understanding kcl.mod",id:"understanding-kclmod",level:3},{value:"Building Blocks",id:"building-blocks",level:3},{value:"Instantiating an application",id:"instantiating-an-application",level:3},{value:"Using kusion init",id:"using-kusion-init",level:3},{value:"Using references",id:"using-references",level:3}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,i.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"configuration-file-overview"},"Configuration File Overview"),(0,a.kt)("p",null,"Kusion consumes one or more declarative configuration files (written in KCL) that describe the application, and delivers intent to the target runtime including Kubernetes, clouds, or on-prem infrastructure."),(0,a.kt)("p",null,"This documentation series walks you through the odds and ends of managing such configuration files."),(0,a.kt)("h2",{id:"table-of-content"},"Table of Content"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#configuration-file-overview"},"Configuration File Overview"),(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#table-of-content"},"Table of Content")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#directory-structure"},"Directory Structure")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#appconfiguration-model"},"AppConfiguration Model")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#authoring-configuration-files"},"Authoring Configuration Files"),(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#identifying-kcl-file"},"Identifying KCL file")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#kcl-schemas-and-kam"},"KCL Schemas and KAM")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#kusion-modules"},"Kusion Modules")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#import-statements"},"Import Statements")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#understanding-kclmod"},"Understanding kcl.mod")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#building-blocks"},"Building Blocks")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#instantiating-an-application"},"Instantiating an application")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#using-kusion-init"},"Using ",(0,a.kt)("inlineCode",{parentName:"a"},"kusion init"))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"#using-references"},"Using references"))))))),(0,a.kt)("h2",{id:"directory-structure"},"Directory Structure"),(0,a.kt)("p",null,"Kusion expects the configuration file to be placed in a certain directory structure because it might need some metadata (that is not stored in the application configuration itself) in order to proceed."),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"See ",(0,a.kt)("a",{parentName:"p",href:"../concepts/project/overview"},"Project")," and ",(0,a.kt)("a",{parentName:"p",href:"../concepts/stack/overview"},"Stack")," for more details about Project and Stack.")),(0,a.kt)("p",null,"A sample multi-stack directory structure looks like the following:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"~/playground$ tree multi-stack-project/\nmulti-stack-project/\n\u251c\u2500\u2500 README.md\n\u251c\u2500\u2500 base\n\u2502\xa0\xa0 \u2514\u2500\u2500 base.k\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u251c\u2500\u2500 prod\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n")),(0,a.kt)("p",null,"In general, the directory structure follows a hierarchy where the top-level is the project configurations, and the sub-directories represent stack-level configurations."),(0,a.kt)("p",null,"You may notice there is a ",(0,a.kt)("inlineCode",{parentName:"p"},"base")," directory besides all the stacks. The ",(0,a.kt)("inlineCode",{parentName:"p"},"base")," directory is not mandatory, but rather a place to store common configurations between different stacks. A common pattern we observed is to use stacks to represent different stages (dev, stage, prod, etc.) in the software development lifecycle, and/or different deployment targets (azure-eastus, aws-us-east-1, etc). A project can have as many stacks as needed."),(0,a.kt)("p",null,"In practice, the applications deployed into dev and prod might very likely end up with a similar set of configurations except a few fields such as the application image (dev might be on newer versions), resource requirements (prod might require more resources), etc."),(0,a.kt)("p",null,"As a general best practice, we recommend managing the common configurations in ",(0,a.kt)("inlineCode",{parentName:"p"},"base.k")," as much as possible to minimize duplicate code. We will cover how override works in ",(0,a.kt)("a",{parentName:"p",href:"base-override"},"Base and Override"),"."),(0,a.kt)("h2",{id:"appconfiguration-model"},"AppConfiguration Model"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," is the out-of-the-box model we build that describes an application. It serves as the declarative intent for a given application."),(0,a.kt)("p",null,"The schema for ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," is defined in the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kam/blob/main/v1/app_configuration.k"},"KusionStack/kam")," repository. It is designed as a unified, application-centric model that encapsulates the comprehensive configuration details and in the meantime, hides the complexity of the infrastructure as much as possible."),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," consists of multiple sub-components that each represent either the application workload itself, its dependencies (in the form of ",(0,a.kt)("a",{parentName:"p",href:"../concepts/kusion-module/overview"},"Kusion Modules"),"), relevant workflows or operational expectations. We will deep dive into the details on how to author each of these elements in this upcoming documentation series."),(0,a.kt)("p",null,"For more details on the ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),", please refer to the ",(0,a.kt)("a",{parentName:"p",href:"../concepts/app-configuration"},"design documentation"),"."),(0,a.kt)("h2",{id:"authoring-configuration-files"},"Authoring Configuration Files"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://kcl-lang.io/"},"KCL")," is the choice of configuration language consumed by Kusion. KCL is an open-source constraint-based record and functional language. KCL works well with a large number of complex configurations via modern programming language technology and practice, and is committed to provide better modularity, scalability, stability and extensibility."),(0,a.kt)("h3",{id:"identifying-kcl-file"},"Identifying KCL file"),(0,a.kt)("p",null,"KCL files are identified with ",(0,a.kt)("inlineCode",{parentName:"p"},".k")," suffix in the filename."),(0,a.kt)("h3",{id:"kcl-schemas-and-kam"},"KCL Schemas and KAM"),(0,a.kt)("p",null,"Similar to most modern General Programming Languages (GPLs), KCL provide packages that are used to organize collections of related KCL source files into modular and re-usable units."),(0,a.kt)("p",null,"In the context of Kusion, we abstracted a core set of KCL Schemas (such as the aforementioned ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"Workload"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"Container"),", etc)that represent the concepts that we believe that are relatively universal and developer-friendly, also known as ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kam"},"Kusion Application Model"),", or KAM."),(0,a.kt)("h3",{id:"kusion-modules"},"Kusion Modules"),(0,a.kt)("p",null,"To extend the capabilities beyond the core KAM model, we use a concept known as ",(0,a.kt)("a",{parentName:"p",href:"../concepts/kusion-module/overview"},"Kusion Modules")," to define components that could best abstract the capabilities during an application delivery. We provide a collection of official out-of-the-box Kusion Modules that represents the most common capabilities. They are maintained in ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/orgs/KusionStack/packages"},"KusionStack's GitHub container registry"),". When authoring an application configuration file, you can simply declare said Kusion Modules as dependencies and import them to declare ship-time capabilities that the application requires."),(0,a.kt)("p",null,"If the modules in the KusionStack container registry does not meet the needs of your applications, Kusion provides the necessary mechanisms to extend with custom-built Kusion Modules. You can always create and publish your own module, then import the new module in your application configuration written in KCL."),(0,a.kt)("p",null,"For the steps to develop your own module, please refer to the Module developer guide."),(0,a.kt)("h3",{id:"import-statements"},"Import Statements"),(0,a.kt)("p",null,"An example of the import looks like the following:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"### import from the official kam package\nimport kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\n\n### import kusion modules\nimport monitoring as m\nimport network.network as n\n")),(0,a.kt)("p",null,"Take ",(0,a.kt)("inlineCode",{parentName:"p"},"import kam.v1.workload as wl")," as an example, the ",(0,a.kt)("inlineCode",{parentName:"p"},".v1.workload")," part after ",(0,a.kt)("inlineCode",{parentName:"p"},"import kam")," represents the relative path of a specific schema to import. In this case, the ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," schema is defined under ",(0,a.kt)("inlineCode",{parentName:"p"},"v1/workload")," directory in the ",(0,a.kt)("inlineCode",{parentName:"p"},"kam")," package."),(0,a.kt)("h3",{id:"understanding-kclmod"},"Understanding kcl.mod"),(0,a.kt)("p",null,"Much similar to the concept of ",(0,a.kt)("inlineCode",{parentName:"p"},"go.mod"),", Kusion uses ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," as the source of truth to manage metadata (such as package name, dependencies, etc.) for the current package. Kusion will also auto-generate a ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod.lock")," as the dependency lock file."),(0,a.kt)("p",null,"The most common usage for ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," is to manage the dependency of your application configuration file. "),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"Please note this ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," will be automatically generated if you are using ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init")," to initialize a project with a template. You will only need to modify this file if you are modifying the project metadata outside the initialization process, such as upgrading the dependency version or adding a new dependency altogether, etc.")),(0,a.kt)("p",null,"There are 3 sections in a ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," file:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"package"),", representing the metadata for the current package."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"dependencies"),", describing the packages the current package depends on. Supports referencing either a git repository or an OCI artifact."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"profile"),", defining the behavior for Kusion. In the example below, it describes the list of files Kusion should look for when parsing the application configuration.")),(0,a.kt)("p",null,"An example of ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'[package]\nname = "multi-stack-project"\nedition = "0.5.0"\nversion = "0.1.0"\n\n[dependencies]\nmonitoring = { oci = "oci://ghcr.io/kusionstack/monitoring", tag = "0.1.0" }\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\n# Uncomment the line below to use your own modified module\n# my-module = { oci = "oci://ghcr.io/my-repository/my-package", tag = "my-version" }\n\n[profile]\nentries = ["../base/base.k", "main.k"]\n')),(0,a.kt)("h3",{id:"building-blocks"},"Building Blocks"),(0,a.kt)("p",null,"Configuration files consist of building blocks that are made of instances of schemas. An ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance consists of several child schemas, most of which are optional. The only mandatory one is the ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," instance. We will take a closer look in the ",(0,a.kt)("a",{parentName:"p",href:"workload"},"workload walkthrough"),". The order of the building blocks does NOT matter."),(0,a.kt)("p",null,"The major building blocks as of version ",(0,a.kt)("inlineCode",{parentName:"p"},"0.11.0"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {}\n ...\n }\n secrets: {}\n ...\n }\n # optional dependencies, usually expressed in kusion modules\n accessories: {\n ...\n }\n ...\n}\n')),(0,a.kt)("p",null,"We will deep dive into each one of the building blocks in this documentation series."),(0,a.kt)("h3",{id:"instantiating-an-application"},"Instantiating an application"),(0,a.kt)("p",null,"In Kusion's out-of-the-box experience, an application is identified with an instance of ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),". You may have more than one application in the same project or stack."),(0,a.kt)("p",null,"Here's an example of a configuration that can be consumed by Kusion (assuming it is placed inside the proper directory structure that includes project and stack configurations, with a ",(0,a.kt)("inlineCode",{parentName:"p"},"kcl.mod")," present):"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network.network as n\n\ngocity: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "gocity": c.Container {\n image = "howieyuen/gocity:latest"\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n public: True\n }\n ]\n }\n }\n}\n')),(0,a.kt)("p",null,"Don't worry about what ",(0,a.kt)("inlineCode",{parentName:"p"},"workload")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"n.Network")," stand for at the moment. We will deep dive into each one of them in this upcoming documentation series."),(0,a.kt)("h3",{id:"using-kusion-init"},"Using ",(0,a.kt)("inlineCode",{parentName:"h3"},"kusion init")),(0,a.kt)("p",null,"Kusion offers a ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init")," sub-command which initializes a new project using some pre-built templates, which saves you from the hassle of manually building the aforementioned directory structure that Kusion expects."),(0,a.kt)("p",null,"There is a built-in template ",(0,a.kt)("inlineCode",{parentName:"p"},"single-stack-sample")," in the Kusion binary that can be used offline. "),(0,a.kt)("p",null,"We also maintain a ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion-templates"},"kusion-templates repository")," that hosts a list of more comprehensive project scaffolds. You can access them via ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init --online")," command which requires connectivity to ",(0,a.kt)("inlineCode",{parentName:"p"},"github.com"),"."),(0,a.kt)("p",null,"The pre-built templates are meant to help you get off the ground quickly with some simple out-of-the-box examples. You can refer to the ",(0,a.kt)("a",{parentName:"p",href:"../getting-started/deliver-quickstart"},"QuickStart documentation")," for some step-by-step tutorials."),(0,a.kt)("h3",{id:"using-references"},"Using references"),(0,a.kt)("p",null,"The reference documentation for the ",(0,a.kt)("inlineCode",{parentName:"p"},"kam")," package and the official Kusion Modules is located in ",(0,a.kt)("a",{parentName:"p",href:"../reference/modules/developer-schemas/app-configuration"},"Reference"),"."),(0,a.kt)("p",null,"If you are using them out of the box, the reference documentation provides a comprehensive view for each schema involved, including all the attribute names and description, their types, default value if any, and whether a particular attribute is required or not. There will also be an example attached to each schema reference."),(0,a.kt)("p",null,"We will also deep dive into some common examples in the upcoming sections."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ac6eab16.4263d3ab.js b/assets/js/ac6eab16.3499020a.js similarity index 55% rename from assets/js/ac6eab16.4263d3ab.js rename to assets/js/ac6eab16.3499020a.js index 35892451eb8..b63eb519035 100644 --- a/assets/js/ac6eab16.4263d3ab.js +++ b/assets/js/ac6eab16.3499020a.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9345],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>d});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),m=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},p=function(e){var t=m(e.components);return n.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=m(r),d=o,h=u["".concat(s,".").concat(d)]||u[d]||c[d]||a;return r?n.createElement(h,l(l({ref:t},p),{},{components:r})):n.createElement(h,l({ref:t},p))}));function d(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,l=new Array(a);l[0]=u;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,l[1]=i;for(var m=2;m{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>m});var n=r(87462),o=(r(67294),r(3905));const a={},l="prometheus",i={unversionedId:"reference/modules/catalog-models/monitoring/prometheus",id:"version-v0.10/reference/modules/catalog-models/monitoring/prometheus",title:"prometheus",description:"Schema Prometheus",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/monitoring/prometheus.md",sourceDirName:"6-reference/2-modules/1-catalog-models/monitoring",slug:"/reference/modules/catalog-models/monitoring/prometheus",permalink:"/docs/v0.10/reference/modules/catalog-models/monitoring/prometheus",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/monitoring/prometheus.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"secret",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/secret/"},next:{title:"opsrule",permalink:"/docs/v0.10/reference/modules/catalog-models/trait/opsrule"}},s={},m=[{value:"Schema Prometheus",id:"schema-prometheus",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:m};function c(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"prometheus"},"prometheus"),(0,o.kt)("h2",{id:"schema-prometheus"},"Schema Prometheus"),(0,o.kt)("p",null,"Prometheus can be used to define monitoring requirements"),(0,o.kt)("h3",{id:"attributes"},"Attributes"),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,o.kt)("th",{parentName:"tr",align:null},"Type"),(0,o.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,o.kt)("th",{parentName:"tr",align:null},"Required"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"path"),(0,o.kt)("br",null),"The path to scrape metrics from."),(0,o.kt)("td",{parentName:"tr",align:null},"str"),(0,o.kt)("td",{parentName:"tr",align:null},"/metrics"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"port"),(0,o.kt)("br",null),"The port to scrape metrics from. When using Prometheus operator, this needs to be the port NAME. Otherwise, this can be a port name or a number."),(0,o.kt)("td",{parentName:"tr",align:null},"str"),(0,o.kt)("td",{parentName:"tr",align:null},"container ports when scraping pod (monitorType is pod) and service port when scraping service (monitorType is service)"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")))),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.monitoring as m\n\nmonitoring: m.Prometheus{\n path: "/metrics"\n port: "web"\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9345],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>d});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),m=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},p=function(e){var t=m(e.components);return n.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=m(r),d=o,h=u["".concat(s,".").concat(d)]||u[d]||c[d]||a;return r?n.createElement(h,l(l({ref:t},p),{},{components:r})):n.createElement(h,l({ref:t},p))}));function d(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,l=new Array(a);l[0]=u;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,l[1]=i;for(var m=2;m{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>m});var n=r(87462),o=(r(67294),r(3905));const a={},l="prometheus",i={unversionedId:"reference/modules/catalog-models/monitoring/prometheus",id:"version-v0.10/reference/modules/catalog-models/monitoring/prometheus",title:"prometheus",description:"Schema Prometheus",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/monitoring/prometheus.md",sourceDirName:"6-reference/2-modules/1-catalog-models/monitoring",slug:"/reference/modules/catalog-models/monitoring/prometheus",permalink:"/docs/v0.10/reference/modules/catalog-models/monitoring/prometheus",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/monitoring/prometheus.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"secret",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/secret/"},next:{title:"opsrule",permalink:"/docs/v0.10/reference/modules/catalog-models/trait/opsrule"}},s={},m=[{value:"Schema Prometheus",id:"schema-prometheus",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:m};function c(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"prometheus"},"prometheus"),(0,o.kt)("h2",{id:"schema-prometheus"},"Schema Prometheus"),(0,o.kt)("p",null,"Prometheus can be used to define monitoring requirements"),(0,o.kt)("h3",{id:"attributes"},"Attributes"),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,o.kt)("th",{parentName:"tr",align:null},"Type"),(0,o.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,o.kt)("th",{parentName:"tr",align:null},"Required"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"path"),(0,o.kt)("br",null),"The path to scrape metrics from."),(0,o.kt)("td",{parentName:"tr",align:null},"str"),(0,o.kt)("td",{parentName:"tr",align:null},"/metrics"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"port"),(0,o.kt)("br",null),"The port to scrape metrics from. When using Prometheus operator, this needs to be the port NAME. Otherwise, this can be a port name or a number."),(0,o.kt)("td",{parentName:"tr",align:null},"str"),(0,o.kt)("td",{parentName:"tr",align:null},"container ports when scraping pod (monitorType is pod) and service port when scraping service (monitorType is service)"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")))),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.monitoring as m\n\nmonitoring: m.Prometheus{\n path: "/metrics"\n port: "web"\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/acb8ea0c.6bdeb423.js b/assets/js/acb8ea0c.6bdeb423.js deleted file mode 100644 index 098484e7a67..00000000000 --- a/assets/js/acb8ea0c.6bdeb423.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5101],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),u=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},c=function(e){var t=u(e.components);return n.createElement(l.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=u(a),m=r,h=d["".concat(l,".").concat(m)]||d[m]||p[m]||o;return a?n.createElement(h,i(i({ref:t},c),{},{components:a})):n.createElement(h,i({ref:t},c))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,i=new Array(o);i[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var u=2;u{a.d(t,{Z:()=>i});var n=a(67294),r=a(86010);const o="tabItem_Ymn6";function i(e){let{children:t,hidden:a,className:i}=e;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(o,i),hidden:a},t)}},74866:(e,t,a)=>{a.d(t,{Z:()=>S});var n=a(87462),r=a(67294),o=a(86010),i=a(12466),s=a(76775),l=a(91980),u=a(67392),c=a(50012);function p(e){return function(e){var t;return(null==(t=r.Children.map(e,(e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})))?void 0:t.filter(Boolean))??[]}(e).map((e=>{let{props:{value:t,label:a,attributes:n,default:r}}=e;return{value:t,label:a,attributes:n,default:r}}))}function d(e){const{values:t,children:a}=e;return(0,r.useMemo)((()=>{const e=t??p(a);return function(e){const t=(0,u.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,a])}function m(e){let{value:t,tabValues:a}=e;return a.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:a}=e;const n=(0,s.k6)(),o=function(e){let{queryString:t=!1,groupId:a}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!a)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return a??null}({queryString:t,groupId:a});return[(0,l._X)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(n.location.search);t.set(o,e),n.replace({...n.location,search:t.toString()})}),[o,n])]}function f(e){const{defaultValue:t,queryString:a=!1,groupId:n}=e,o=d(e),[i,s]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:a}=e;if(0===a.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:a}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${a.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const n=a.find((e=>e.default))??a[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:o}))),[l,u]=h({queryString:a,groupId:n}),[p,f]=function(e){let{groupId:t}=e;const a=function(e){return e?`docusaurus.tab.${e}`:null}(t),[n,o]=(0,c.Nk)(a);return[n,(0,r.useCallback)((e=>{a&&o.set(e)}),[a,o])]}({groupId:n}),k=(()=>{const e=l??p;return m({value:e,tabValues:o})?e:null})();(0,r.useLayoutEffect)((()=>{k&&s(k)}),[k]);return{selectedValue:i,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);s(e),u(e),f(e)}),[u,f,o]),tabValues:o}}var k=a(72389);const g="tabList__CuJ",b="tabItem_LNqP";function y(e){let{className:t,block:a,selectedValue:s,selectValue:l,tabValues:u}=e;const c=[],{blockElementScrollPositionUntilNextRender:p}=(0,i.o5)(),d=e=>{const t=e.currentTarget,a=c.indexOf(t),n=u[a].value;n!==s&&(p(t),l(n))},m=e=>{var t;let a=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=c.indexOf(e.currentTarget)+1;a=c[t]??c[0];break}case"ArrowLeft":{const t=c.indexOf(e.currentTarget)-1;a=c[t]??c[c.length-1];break}}null==(t=a)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":a},t)},u.map((e=>{let{value:t,label:a,attributes:i}=e;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,key:t,ref:e=>c.push(e),onKeyDown:m,onClick:d},i,{className:(0,o.Z)("tabs__item",b,null==i?void 0:i.className,{"tabs__item--active":s===t})}),a??t)})))}function v(e){let{lazy:t,children:a,selectedValue:n}=e;const o=(Array.isArray(a)?a:[a]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===n));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==n}))))}function w(e){const t=f(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",g)},r.createElement(y,(0,n.Z)({},e,t)),r.createElement(v,(0,n.Z)({},e,t)))}function S(e){const t=(0,k.Z)();return r.createElement(w,(0,n.Z)({key:String(t)},e))}},77546:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>s,metadata:()=>u,toc:()=>p});var n=a(87462),r=(a(67294),a(3905)),o=a(74866),i=a(85162);const s={id:"databse"},l="Managed Databases",u={unversionedId:"configuration-walkthrough/databse",id:"version-v0.11/configuration-walkthrough/databse",title:"Managed Databases",description:"You could also specify a database needed for the application. That can be achieved via a mysql or a postgres module (or bring-your-own-module) in the accessories field in AppConfiguration to achieve that.",source:"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/6-database.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/databse",permalink:"/docs/configuration-walkthrough/databse",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/6-database.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:6,frontMatter:{id:"databse"},sidebar:"kusion",previous:{title:"Application Networking",permalink:"/docs/configuration-walkthrough/networking"},next:{title:"Secrets",permalink:"/docs/configuration-walkthrough/secret"}},c={},p=[{value:"Import",id:"import",level:2},{value:"Types of Database offerings",id:"types-of-database-offerings",level:2},{value:"Cloud Credentials and Permissions",id:"cloud-credentials-and-permissions",level:2},{value:"Configure Database",id:"configure-database",level:2},{value:"Provision a Cloud Database",id:"provision-a-cloud-database",level:3},{value:"AWS RDS Instance",id:"aws-rds-instance",level:4},{value:"AliCloud RDS Instance",id:"alicloud-rds-instance",level:4},{value:"Local Database",id:"local-database",level:3},{value:"Database Credentials",id:"database-credentials",level:2},{value:"Configure Network Access",id:"configure-network-access",level:2},{value:"Subnet ID",id:"subnet-id",level:3},{value:"Private Routing",id:"private-routing",level:3}],d={toc:p};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"managed-databases"},"Managed Databases"),(0,r.kt)("p",null,"You could also specify a database needed for the application. That can be achieved via a ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql")," or a ",(0,r.kt)("inlineCode",{parentName:"p"},"postgres")," module (or bring-your-own-module) in the ",(0,r.kt)("inlineCode",{parentName:"p"},"accessories")," field in ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," to achieve that."),(0,r.kt)("p",null,"You can currently have several databases with ",(0,r.kt)("strong",{parentName:"p"},"different database names")," for an application at the same time."),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"kam")," package and the ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql")," Kusion Module. For more details on KCL package and module import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"/docs/configuration-walkthrough/overview#configuration-file-overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport mysql.mysql\nimport postgres.postgres\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"kcl.mod")," must contain reference to the ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql")," module or ",(0,r.kt)("inlineCode",{parentName:"p"},"postgres")," module:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'#...\n\n[dependencies]\nmysql = { oci = "oci://ghcr.io/kusionstack/mysql", tag = "0.1.0" }\npostgres = { oci = "oci://ghcr.io/kusionstack/postgres", tag = "0.1.0" }\n#...\n')),(0,r.kt)("h2",{id:"types-of-database-offerings"},"Types of Database offerings"),(0,r.kt)("p",null,"As of version 0.11.0, Kusion supports the following database offerings on the cloud:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"MySQL and PostgreSQL Relational Database Service (RDS) on ",(0,r.kt)("a",{parentName:"li",href:"https://aws.amazon.com/rds/"},"AWS")),(0,r.kt)("li",{parentName:"ul"},"MySQL and PostgreSQL Relational Database Service (RDS) on ",(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/product/databases"},"AliCloud"))),(0,r.kt)("p",null,"More database types on more cloud vendors will be added in the future."),(0,r.kt)("p",null,"Alternatively, Kusion also supports creating a database at ",(0,r.kt)("inlineCode",{parentName:"p"},"localhost")," for local testing needs. A local database is quicker to stand up and easier to manage. It also eliminates the need for an account and any relevant costs with the cloud providers in the case that a local testing environment is sufficient."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"You do need a local Kubernetes cluster to run the local database workloads. You can refer to ",(0,r.kt)("a",{parentName:"p",href:"https://minikube.sigs.k8s.io/docs/start/"},"Minikube")," or ",(0,r.kt)("a",{parentName:"p",href:"https://kind.sigs.k8s.io/docs/user/quick-start/"},"Kind")," to get started.\nTo see an end-to-end use case for standing up a local testing environment including a local database, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"/docs/getting-started/deliver-quickstart"},"Kusion Quickstart"),".")),(0,r.kt)("h2",{id:"cloud-credentials-and-permissions"},"Cloud Credentials and Permissions"),(0,r.kt)("p",null,"Kusion provisions databases on the cloud via ",(0,r.kt)("a",{parentName:"p",href:"https://www.terraform.io/"},"terraform")," providers. For it to create ",(0,r.kt)("em",{parentName:"p"},"any")," cloud resources, it requires a set of credentials that belongs to an account that has the appropriate write access so the terraform provider can be initialized properly."),(0,r.kt)("p",null,"For AWS, the environment variables needed:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'export AWS_ACCESS_KEY_ID="xxxxxxxxxxx" # replace it with your AccessKey\nexport AWS_SECRET_ACCESS_KEY="xxxxxxx" # replace it with your SecretKey\nexport AWS_REGION=us-east-1 # replace it with your region\n')),(0,r.kt)("p",null,"For AliCloud, the environment variables needed:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'export ALICLOUD_ACCESS_KEY="xxxxxxxxx" # replace it with your AccessKey\nexport ALICLOUD_SECRET_KEY="xxxxxxxxx" # replace it with your SecretKey\nexport ALICLOUD_REGION=cn-hangzhou # replace it with your region\n')),(0,r.kt)("p",null,"The user account that owns these credentials would need to have the proper permission policies attached to create databases and security groups. If you are using the cloud-managed policies, the policies needed to provision a database and configure firewall rules are listed below."),(0,r.kt)("p",null,"For AWS:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AmazonVPCFullAccess")," for creating and managing database firewall rules via security group"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AmazonRDSFullAccess")," for creating and managing RDS instances")),(0,r.kt)("p",null,"For AliCloud:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AliyunVPCFullAccess")," for creating and managing database firewall rules via security group"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AliyunRDSFullAccess")," for creating and managing RDS instances")),(0,r.kt)("p",null,"Alternatively, you can use customer managed policies if the cloud provider built-in policies don't meet your needs. The list of permissions needed are in the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonRDSFullAccess.html#AmazonRDSFullAccess-json"},"AmazonRDSFullAccess Policy Document")," and ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonVPCFullAccess.html"},"AmazonVPCFullAccess Policy Document"),". It will most likely be a subset of the permissions in the policy documents."),(0,r.kt)("h2",{id:"configure-database"},"Configure Database"),(0,r.kt)("h3",{id:"provision-a-cloud-database"},"Provision a Cloud Database"),(0,r.kt)("p",null,"Assuming the steps in the ",(0,r.kt)("a",{parentName:"p",href:"#cloud-credentials-and-permissions"},"Cloud Credentials and Permissions")," section is setup properly, you can now provision cloud databases via Kusion."),(0,r.kt)("h4",{id:"aws-rds-instance"},"AWS RDS Instance"),(0,r.kt)("p",null,"To provision an AWS RDS instance with MySQL v8.0 or PostgreSQL v14.0, you can append the following YAML file to your own workspace configurations and update the corresponding workspace with command ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace update"),". "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'# MySQL configurations for AWS RDS\nmodules: \n kusionstack/mysql@0.1.0:\n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n securityIPs: \n - 0.0.0.0/0\n suffix: "-mysql"\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'# PostgreSQL configurations for AWS RDS\nmodules: \n kusionstack/postgres@0.1.0:\n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n securityIPs: \n - 0.0.0.0/0\n suffix: "-postgres"\n')))),(0,r.kt)("p",null,"For KCL configuration file declarations: "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'wordpress: ac.AppConfiguration {\n # ...\n accessories: {\n "mysql": mysql.MySQL {\n type: "cloud"\n version: "8.0"\n }\n }\n}\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'pgadmin: ac.AppConfiguration {\n # ...\n accessories: {\n "postgres": postgres.PostgreSQL {\n type: "cloud"\n version: "14.0"\n }\n }\n}\n')))),(0,r.kt)("p",null,"It's highly recommended to replace ",(0,r.kt)("inlineCode",{parentName:"p"},"0.0.0.0/0")," and closely manage the whitelist of IPs that can access the database for security purposes. The ",(0,r.kt)("inlineCode",{parentName:"p"},"0.0.0.0/0")," in the example above or if ",(0,r.kt)("inlineCode",{parentName:"p"},"securityIPs")," is omitted altogether will allow connections from anywhere which would typically be a security bad practice."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"instanceType")," field determines the computation and memory capacity of the RDS instance. The ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.micro")," instance type in the example above represents the ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3")," instance class with a size of ",(0,r.kt)("inlineCode",{parentName:"p"},"micro"),". In the same ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3")," instance family there are also ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.small"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.medium"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.2xlarge"),", etc."),(0,r.kt)("p",null,"The full list of supported ",(0,r.kt)("inlineCode",{parentName:"p"},"instanceType")," values can be found ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html#Concepts.DBInstanceClass.Support"},"here"),"."),(0,r.kt)("p",null,"You can also adjust the storage capacity for the database instance by changing the ",(0,r.kt)("inlineCode",{parentName:"p"},"size")," field which is storage size measured in gigabytes. The minimum is 20. More details can be found ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#Concepts.Storage.GeneralSSD"},"here"),"."),(0,r.kt)("h4",{id:"alicloud-rds-instance"},"AliCloud RDS Instance"),(0,r.kt)("p",null,"To provision an Alicloud RDS instance with MySQL or PostgreSQL, you can append the following YAML file to your own workspace configurations and update the corresponding workspace with command ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace update"),". Note that AliCloud RDS has several additional fields such as ",(0,r.kt)("inlineCode",{parentName:"p"},"category"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting"),":"),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'# MySQL configurations for Alicloud RDS\nmodules: \n kusionstack/mysql@0.1.0: \n default: \n cloud: alicloud\n size: 20\n instanceType: mysql.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n securityIPs: \n - 0.0.0.0/0\n suffix: "-mysql"\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'# PostgreSQL configurations for Alicloud RDS\nmodules: \n kusionstack/postgres@0.1.0:\n default:\n cloud: alicloud\n size: 20\n instanceType: pg.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n securityIPs: \n - 0.0.0.0/0\n suffix: "-postgres"\n')))),(0,r.kt)("p",null,"For KCL configuration file declarations: "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'wordpress: ac.AppConfiguration {\n # ...\n accessories: {\n "mysql": mysql.MySQL {\n type: "cloud"\n version: "8.0"\n }\n }\n}\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'pgadmin: ac.AppConfiguration {\n # ...\n accessories: {\n "postgres": postgres.PostgreSQL {\n type: "cloud"\n version: "14.0"\n }\n }\n}\n')))),(0,r.kt)("p",null,"We will walkthrough ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting")," in the ",(0,r.kt)("a",{parentName:"p",href:"#configure-network-access"},"Configure Network Access")," section."),(0,r.kt)("p",null,"The full list of supported ",(0,r.kt)("inlineCode",{parentName:"p"},"instanceType")," values can be found in:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/apsaradb-rds-for-mysql/primary-apsaradb-rds-for-mysql-instance-types#concept-2096487"},"MySQL instance types(x86)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/apsaradb-rds-for-postgresql/primary-apsaradb-rds-for-postgresql-instance-types#concept-2096578"},"PostgreSQL instance types"))),(0,r.kt)("h3",{id:"local-database"},"Local Database"),(0,r.kt)("p",null,"To deploy a local database with MySQL v8.0 or PostgreSQL v14.0:"),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'wordpress: ac.AppConfiguration {\n # ...\n accessories: {\n "mysql": mysql.MySQL {\n type: "local"\n version: "8.0"\n }\n }\n}\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'pgadmin: ac.AppConfiguration {\n # ...\n accessories: {\n "postgres": postgres.PostgreSQL {\n type: "local"\n version: "14.0"\n }\n }\n}\n')))),(0,r.kt)("h2",{id:"database-credentials"},"Database Credentials"),(0,r.kt)("p",null,"There is no need to manage the database credentials manually. Kusion will automatically generate a random password, set it as the credential when creating the database, and then inject the hostname, username and password into the application runtime."),(0,r.kt)("p",null,"You have the option to BYO (Bring Your Own) username for the database credential by specifying the ",(0,r.kt)("inlineCode",{parentName:"p"},"username")," attribute in the ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n kusionstack/mysql@0.1.0:\n default:\n # ...\n username: "my_username"\n')),(0,r.kt)("p",null,"You ",(0,r.kt)("strong",{parentName:"p"},"cannot")," bring your own password. The password will always be managed by Kusion automatically."),(0,r.kt)("p",null,"The database credentials are injected into the environment variables of the application container. You can access them via the following env vars:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"# env | grep KUSION_DB\nKUSION_DB_HOST_WORDPRESS_MYSQL=wordpress.xxxxxxxx.us-east-1.rds.amazonaws.com\nKUSION_DB_USERNAME_WORDPRESS_MYSQL=xxxxxxxxx\nKUSION_DB_PASSWORD_WORDPRESS_MYSQL=xxxxxxxxx\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about the environment of database credentials injected by Kusion can be found at ",(0,r.kt)("a",{parentName:"p",href:"/docs/reference/modules/developer-schemas/database/mysql#credentials-and-connectivity"},"mysql credentials and connectivity")," and ",(0,r.kt)("a",{parentName:"p",href:"/docs/reference/modules/developer-schemas/database/postgres#credentials-and-connectivity"},"postgres credentials and connectivity"))),(0,r.kt)("p",null,"You can use these environment variables out of the box. Or most likely, your application might retrieve the connection details from a different set of environment variables. In that case, you can map the kusion environment variables to the ones expected by your application using the ",(0,r.kt)("inlineCode",{parentName:"p"},"$()")," expression. "),(0,r.kt)("p",null,"This example below will assign the value of ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_HOST_WORDPRESS_MYSQL")," into ",(0,r.kt)("inlineCode",{parentName:"p"},"WORDPRESS_DB_HOST"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_USERNAME_WORDPRESS_MYSQL")," into ",(0,r.kt)("inlineCode",{parentName:"p"},"WORDPRESS_DB_USER"),", likewise for ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_PASSWORD_WORDPRESS_MYSQL")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"WORDPRESS_DB_PASSWORD"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'wordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n wordpress: c.Container {\n image = "wordpress:6.3-apache"\n env: {\n "WORDPRESS_DB_HOST": "$(KUSION_DB_HOST_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD_WORDPRESS_MYSQL)"\n }\n # ...\n }\n }\n # ...\n }\n accessories: {\n # ...\n }\n}\n')),(0,r.kt)("h2",{id:"configure-network-access"},"Configure Network Access"),(0,r.kt)("p",null,"You can also optionally configure the network access to the database as part of the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),". This is highly recommended because it dramatically increases the security posture of your cloud environment in the means of least privilege principle."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"securityIPs")," field in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Database")," schema declares the list of network addresses that are allowed to access the database. The network addresses are in the ",(0,r.kt)("a",{parentName:"p",href:"https://aws.amazon.com/what-is/cidr/"},"CIDR notation")," and can be either a private IP range (",(0,r.kt)("a",{parentName:"p",href:"https://datatracker.ietf.org/doc/html/rfc1918"},"RFC-1918")," and ",(0,r.kt)("a",{parentName:"p",href:"https://datatracker.ietf.org/doc/html/rfc6598"},"RFC-6598")," address) or a public one."),(0,r.kt)("p",null,"If the database need to be accessed from a public location (which should most likely not be the case in a production environment), ",(0,r.kt)("inlineCode",{parentName:"p"},"securityIPs")," need to include the public IP address of the traffic source (For instance, if the RDS database needs to be accessed from your computer)."),(0,r.kt)("p",null,"To configure AWS RDS to restrict network access from a VPC with a CIDR of ",(0,r.kt)("inlineCode",{parentName:"p"},"10.0.1.0/24")," and a public IP of ",(0,r.kt)("inlineCode",{parentName:"p"},"103.192.227.125"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'modules: \n kusionstack/mysql@0.1.0: \n default: \n cloud: aws\n # ...\n securityIPs: \n - "10.0.1.0/24"\n - "103.192.227.125/32"\n')),(0,r.kt)("p",null,"Depending on the cloud provider, the default behavior of the database firewall settings may differ if omitted."),(0,r.kt)("h3",{id:"subnet-id"},"Subnet ID"),(0,r.kt)("p",null,"On AWS, you have the option to launch the RDS instance inside a specific VPC if a ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," is present in the application configuration. By default, if ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," is not provided, the RDS will be created in the default VPC for that account. However, the recommendation is to self-manage your VPCs to provider better isolation from a network security perspective."),(0,r.kt)("p",null,"On AliCloud, the ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," is required. The concept of subnet maps to VSwitch in AliCloud."),(0,r.kt)("p",null,"To place the RDS instance into a specific VPC on Alicloud:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'modules: \n kusionstack/mysql@0.1.0: \n default: \n cloud: alicloud\n # ...\n subnetID: "subnet-xxxxxxxxxxxxxxxx"\n')),(0,r.kt)("h3",{id:"private-routing"},"Private Routing"),(0,r.kt)("p",null,"There is an option to enforce private routing on certain cloud providers if both the workload and the database are running on the cloud."),(0,r.kt)("p",null,"On AliCloud, you can set the ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting")," flag to ",(0,r.kt)("inlineCode",{parentName:"p"},"True"),". The database host generated will be a private FQDN that is only resolvable and accessible from within the AliCloud VPCs. Setting ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting")," flag to ",(0,r.kt)("inlineCode",{parentName:"p"},"True")," when ",(0,r.kt)("inlineCode",{parentName:"p"},"type")," is ",(0,r.kt)("inlineCode",{parentName:"p"},"aws")," is a no-op."),(0,r.kt)("p",null,"To enforce private routing on AliCloud:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules: \n kusionstack/mysql@0.1.0: \n default: \n cloud: alicloud\n # ...\n privateRouting: true\n")),(0,r.kt)("p",null,"Kusion will then generate a private FQDN and inject it into the application runtime as the environment variable ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_HOST_")," for the application to use. A complete list of Kusion-managed environment variables for mysql database can be found ",(0,r.kt)("a",{parentName:"p",href:"/docs/reference/modules/developer-schemas/database/mysql#credentials-and-connectivity"},"here"),"."),(0,r.kt)("p",null,"Otherwise when using the public FQDN to connect to a database from the workload, the route will depend on cloud provider's routing preference. The options are generally either:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Travel as far as possible on the cloud provider's global backbone network, or also referred to as cold potato routing, or"),(0,r.kt)("li",{parentName:"ul"},"Egress as early as possible to the public Internet and re-enter the cloud provider's datacenter later, or also referred to as hot potato routing")),(0,r.kt)("p",null,"The prior generally has better performance but is also more expensive."),(0,r.kt)("p",null,"You can find a good read on the ",(0,r.kt)("a",{parentName:"p",href:"https://aws.amazon.com/blogs/architecture/internet-routing-and-traffic-engineering/"},"AWS Blog")," or the ",(0,r.kt)("a",{parentName:"p",href:"https://learn.microsoft.com/en-us/azure/virtual-network/ip-services/routing-preference-overview"},"Microsoft Learn"),"."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/acb8ea0c.84aa6e61.js b/assets/js/acb8ea0c.84aa6e61.js new file mode 100644 index 00000000000..8c7c80c1df2 --- /dev/null +++ b/assets/js/acb8ea0c.84aa6e61.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5101],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function o(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var l=n.createContext({}),u=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},c=function(e){var t=u(e.components);return n.createElement(l.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=u(a),m=r,h=d["".concat(l,".").concat(m)]||d[m]||p[m]||o;return a?n.createElement(h,i(i({ref:t},c),{},{components:a})):n.createElement(h,i({ref:t},c))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=a.length,i=new Array(o);i[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var u=2;u{a.d(t,{Z:()=>i});var n=a(67294),r=a(86010);const o="tabItem_Ymn6";function i(e){let{children:t,hidden:a,className:i}=e;return n.createElement("div",{role:"tabpanel",className:(0,r.Z)(o,i),hidden:a},t)}},74866:(e,t,a)=>{a.d(t,{Z:()=>S});var n=a(87462),r=a(67294),o=a(86010),i=a(12466),s=a(76775),l=a(91980),u=a(67392),c=a(50012);function p(e){return function(e){var t;return(null==(t=r.Children.map(e,(e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})))?void 0:t.filter(Boolean))??[]}(e).map((e=>{let{props:{value:t,label:a,attributes:n,default:r}}=e;return{value:t,label:a,attributes:n,default:r}}))}function d(e){const{values:t,children:a}=e;return(0,r.useMemo)((()=>{const e=t??p(a);return function(e){const t=(0,u.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,a])}function m(e){let{value:t,tabValues:a}=e;return a.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:a}=e;const n=(0,s.k6)(),o=function(e){let{queryString:t=!1,groupId:a}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!a)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return a??null}({queryString:t,groupId:a});return[(0,l._X)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(n.location.search);t.set(o,e),n.replace({...n.location,search:t.toString()})}),[o,n])]}function f(e){const{defaultValue:t,queryString:a=!1,groupId:n}=e,o=d(e),[i,s]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:a}=e;if(0===a.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:a}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${a.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const n=a.find((e=>e.default))??a[0];if(!n)throw new Error("Unexpected error: 0 tabValues");return n.value}({defaultValue:t,tabValues:o}))),[l,u]=h({queryString:a,groupId:n}),[p,f]=function(e){let{groupId:t}=e;const a=function(e){return e?`docusaurus.tab.${e}`:null}(t),[n,o]=(0,c.Nk)(a);return[n,(0,r.useCallback)((e=>{a&&o.set(e)}),[a,o])]}({groupId:n}),k=(()=>{const e=l??p;return m({value:e,tabValues:o})?e:null})();(0,r.useLayoutEffect)((()=>{k&&s(k)}),[k]);return{selectedValue:i,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);s(e),u(e),f(e)}),[u,f,o]),tabValues:o}}var k=a(72389);const g="tabList__CuJ",b="tabItem_LNqP";function y(e){let{className:t,block:a,selectedValue:s,selectValue:l,tabValues:u}=e;const c=[],{blockElementScrollPositionUntilNextRender:p}=(0,i.o5)(),d=e=>{const t=e.currentTarget,a=c.indexOf(t),n=u[a].value;n!==s&&(p(t),l(n))},m=e=>{var t;let a=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=c.indexOf(e.currentTarget)+1;a=c[t]??c[0];break}case"ArrowLeft":{const t=c.indexOf(e.currentTarget)-1;a=c[t]??c[c.length-1];break}}null==(t=a)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":a},t)},u.map((e=>{let{value:t,label:a,attributes:i}=e;return r.createElement("li",(0,n.Z)({role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,key:t,ref:e=>c.push(e),onKeyDown:m,onClick:d},i,{className:(0,o.Z)("tabs__item",b,null==i?void 0:i.className,{"tabs__item--active":s===t})}),a??t)})))}function v(e){let{lazy:t,children:a,selectedValue:n}=e;const o=(Array.isArray(a)?a:[a]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===n));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==n}))))}function w(e){const t=f(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",g)},r.createElement(y,(0,n.Z)({},e,t)),r.createElement(v,(0,n.Z)({},e,t)))}function S(e){const t=(0,k.Z)();return r.createElement(w,(0,n.Z)({key:String(t)},e))}},77546:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>c,contentTitle:()=>l,default:()=>m,frontMatter:()=>s,metadata:()=>u,toc:()=>p});var n=a(87462),r=(a(67294),a(3905)),o=a(74866),i=a(85162);const s={id:"databse"},l="Managed Databases",u={unversionedId:"configuration-walkthrough/databse",id:"version-v0.11/configuration-walkthrough/databse",title:"Managed Databases",description:"You could also specify a database needed for the application. That can be achieved via a mysql or a postgres module (or bring-your-own-module) in the accessories field in AppConfiguration to achieve that.",source:"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/6-database.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/databse",permalink:"/docs/configuration-walkthrough/databse",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/6-database.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:6,frontMatter:{id:"databse"},sidebar:"kusion",previous:{title:"Application Networking",permalink:"/docs/configuration-walkthrough/networking"},next:{title:"Secrets",permalink:"/docs/configuration-walkthrough/secret"}},c={},p=[{value:"Import",id:"import",level:2},{value:"Types of Database offerings",id:"types-of-database-offerings",level:2},{value:"Cloud Credentials and Permissions",id:"cloud-credentials-and-permissions",level:2},{value:"Configure Database",id:"configure-database",level:2},{value:"Provision a Cloud Database",id:"provision-a-cloud-database",level:3},{value:"AWS RDS Instance",id:"aws-rds-instance",level:4},{value:"AliCloud RDS Instance",id:"alicloud-rds-instance",level:4},{value:"Local Database",id:"local-database",level:3},{value:"Database Credentials",id:"database-credentials",level:2},{value:"Configure Network Access",id:"configure-network-access",level:2},{value:"Subnet ID",id:"subnet-id",level:3},{value:"Private Routing",id:"private-routing",level:3}],d={toc:p};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"managed-databases"},"Managed Databases"),(0,r.kt)("p",null,"You could also specify a database needed for the application. That can be achieved via a ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql")," or a ",(0,r.kt)("inlineCode",{parentName:"p"},"postgres")," module (or bring-your-own-module) in the ",(0,r.kt)("inlineCode",{parentName:"p"},"accessories")," field in ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," to achieve that."),(0,r.kt)("p",null,"You can currently have several databases with ",(0,r.kt)("strong",{parentName:"p"},"different database names")," for an application at the same time."),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"kam")," package and the ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql")," Kusion Module. For more details on KCL package and module import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"/docs/configuration-walkthrough/overview#configuration-file-overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport mysql.mysql\nimport postgres.postgres\n")),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"kcl.mod")," must contain reference to the ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql")," module or ",(0,r.kt)("inlineCode",{parentName:"p"},"postgres")," module:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'#...\n\n[dependencies]\nmysql = { oci = "oci://ghcr.io/kusionstack/mysql", tag = "0.1.0" }\npostgres = { oci = "oci://ghcr.io/kusionstack/postgres", tag = "0.1.0" }\n#...\n')),(0,r.kt)("h2",{id:"types-of-database-offerings"},"Types of Database offerings"),(0,r.kt)("p",null,"As of version 0.11.0, Kusion supports the following database offerings on the cloud:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"MySQL and PostgreSQL Relational Database Service (RDS) on ",(0,r.kt)("a",{parentName:"li",href:"https://aws.amazon.com/rds/"},"AWS")),(0,r.kt)("li",{parentName:"ul"},"MySQL and PostgreSQL Relational Database Service (RDS) on ",(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/product/databases"},"AliCloud"))),(0,r.kt)("p",null,"More database types on more cloud vendors will be added in the future."),(0,r.kt)("p",null,"Alternatively, Kusion also supports creating a database at ",(0,r.kt)("inlineCode",{parentName:"p"},"localhost")," for local testing needs. A local database is quicker to stand up and easier to manage. It also eliminates the need for an account and any relevant costs with the cloud providers in the case that a local testing environment is sufficient."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"You do need a local Kubernetes cluster to run the local database workloads. You can refer to ",(0,r.kt)("a",{parentName:"p",href:"https://minikube.sigs.k8s.io/docs/start/"},"Minikube")," or ",(0,r.kt)("a",{parentName:"p",href:"https://kind.sigs.k8s.io/docs/user/quick-start/"},"Kind")," to get started.\nTo see an end-to-end use case for standing up a local testing environment including a local database, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"/docs/getting-started/deliver-quickstart"},"Kusion Quickstart"),".")),(0,r.kt)("h2",{id:"cloud-credentials-and-permissions"},"Cloud Credentials and Permissions"),(0,r.kt)("p",null,"Kusion provisions databases on the cloud via ",(0,r.kt)("a",{parentName:"p",href:"https://www.terraform.io/"},"terraform")," providers. For it to create ",(0,r.kt)("em",{parentName:"p"},"any")," cloud resources, it requires a set of credentials that belongs to an account that has the appropriate write access so the terraform provider can be initialized properly."),(0,r.kt)("p",null,"For AWS, the environment variables needed:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'export AWS_ACCESS_KEY_ID="xxxxxxxxxxx" # replace it with your AccessKey\nexport AWS_SECRET_ACCESS_KEY="xxxxxxx" # replace it with your SecretKey\nexport AWS_REGION=us-east-1 # replace it with your region\n')),(0,r.kt)("p",null,"For AliCloud, the environment variables needed:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'export ALICLOUD_ACCESS_KEY="xxxxxxxxx" # replace it with your AccessKey\nexport ALICLOUD_SECRET_KEY="xxxxxxxxx" # replace it with your SecretKey\nexport ALICLOUD_REGION=cn-hangzhou # replace it with your region\n')),(0,r.kt)("p",null,"The user account that owns these credentials would need to have the proper permission policies attached to create databases and security groups. If you are using the cloud-managed policies, the policies needed to provision a database and configure firewall rules are listed below."),(0,r.kt)("p",null,"For AWS:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AmazonVPCFullAccess")," for creating and managing database firewall rules via security group"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AmazonRDSFullAccess")," for creating and managing RDS instances")),(0,r.kt)("p",null,"For AliCloud:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AliyunVPCFullAccess")," for creating and managing database firewall rules via security group"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"AliyunRDSFullAccess")," for creating and managing RDS instances")),(0,r.kt)("p",null,"Alternatively, you can use customer managed policies if the cloud provider built-in policies don't meet your needs. The list of permissions needed are in the ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonRDSFullAccess.html#AmazonRDSFullAccess-json"},"AmazonRDSFullAccess Policy Document")," and ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/aws-managed-policy/latest/reference/AmazonVPCFullAccess.html"},"AmazonVPCFullAccess Policy Document"),". It will most likely be a subset of the permissions in the policy documents."),(0,r.kt)("h2",{id:"configure-database"},"Configure Database"),(0,r.kt)("h3",{id:"provision-a-cloud-database"},"Provision a Cloud Database"),(0,r.kt)("p",null,"Assuming the steps in the ",(0,r.kt)("a",{parentName:"p",href:"#cloud-credentials-and-permissions"},"Cloud Credentials and Permissions")," section is setup properly, you can now provision cloud databases via Kusion."),(0,r.kt)("h4",{id:"aws-rds-instance"},"AWS RDS Instance"),(0,r.kt)("p",null,"To provision an AWS RDS instance with MySQL v8.0 or PostgreSQL v14.0, you can append the following YAML file to your own workspace configurations and update the corresponding workspace with command ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace update"),". "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'# MySQL configurations for AWS RDS\nmodules: \n kusionstack/mysql@0.1.0:\n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n securityIPs: \n - 0.0.0.0/0\n suffix: "-mysql"\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'# PostgreSQL configurations for AWS RDS\nmodules: \n kusionstack/postgres@0.1.0:\n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n securityIPs: \n - 0.0.0.0/0\n suffix: "-postgres"\n')))),(0,r.kt)("p",null,"For KCL configuration file declarations: "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'wordpress: ac.AppConfiguration {\n # ...\n accessories: {\n "mysql": mysql.MySQL {\n type: "cloud"\n version: "8.0"\n }\n }\n}\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'pgadmin: ac.AppConfiguration {\n # ...\n accessories: {\n "postgres": postgres.PostgreSQL {\n type: "cloud"\n version: "14.0"\n }\n }\n}\n')))),(0,r.kt)("p",null,"It's highly recommended to replace ",(0,r.kt)("inlineCode",{parentName:"p"},"0.0.0.0/0")," and closely manage the whitelist of IPs that can access the database for security purposes. The ",(0,r.kt)("inlineCode",{parentName:"p"},"0.0.0.0/0")," in the example above or if ",(0,r.kt)("inlineCode",{parentName:"p"},"securityIPs")," is omitted altogether will allow connections from anywhere which would typically be a security bad practice."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"instanceType")," field determines the computation and memory capacity of the RDS instance. The ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.micro")," instance type in the example above represents the ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3")," instance class with a size of ",(0,r.kt)("inlineCode",{parentName:"p"},"micro"),". In the same ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3")," instance family there are also ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.small"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.medium"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"db.t3.2xlarge"),", etc."),(0,r.kt)("p",null,"The full list of supported ",(0,r.kt)("inlineCode",{parentName:"p"},"instanceType")," values can be found ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html#Concepts.DBInstanceClass.Support"},"here"),"."),(0,r.kt)("p",null,"You can also adjust the storage capacity for the database instance by changing the ",(0,r.kt)("inlineCode",{parentName:"p"},"size")," field which is storage size measured in gigabytes. The minimum is 20. More details can be found ",(0,r.kt)("a",{parentName:"p",href:"https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#Concepts.Storage.GeneralSSD"},"here"),"."),(0,r.kt)("h4",{id:"alicloud-rds-instance"},"AliCloud RDS Instance"),(0,r.kt)("p",null,"To provision an Alicloud RDS instance with MySQL or PostgreSQL, you can append the following YAML file to your own workspace configurations and update the corresponding workspace with command ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace update"),". Note that AliCloud RDS has several additional fields such as ",(0,r.kt)("inlineCode",{parentName:"p"},"category"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting"),":"),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'# MySQL configurations for Alicloud RDS\nmodules: \n kusionstack/mysql@0.1.0: \n default: \n cloud: alicloud\n size: 20\n instanceType: mysql.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n securityIPs: \n - 0.0.0.0/0\n suffix: "-mysql"\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'# PostgreSQL configurations for Alicloud RDS\nmodules: \n kusionstack/postgres@0.1.0:\n default:\n cloud: alicloud\n size: 20\n instanceType: pg.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n securityIPs: \n - 0.0.0.0/0\n suffix: "-postgres"\n')))),(0,r.kt)("p",null,"For KCL configuration file declarations: "),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'wordpress: ac.AppConfiguration {\n # ...\n accessories: {\n "mysql": mysql.MySQL {\n type: "cloud"\n version: "8.0"\n }\n }\n}\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'pgadmin: ac.AppConfiguration {\n # ...\n accessories: {\n "postgres": postgres.PostgreSQL {\n type: "cloud"\n version: "14.0"\n }\n }\n}\n')))),(0,r.kt)("p",null,"We will walkthrough ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting")," in the ",(0,r.kt)("a",{parentName:"p",href:"#configure-network-access"},"Configure Network Access")," section."),(0,r.kt)("p",null,"The full list of supported ",(0,r.kt)("inlineCode",{parentName:"p"},"instanceType")," values can be found in:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/apsaradb-rds-for-mysql/primary-apsaradb-rds-for-mysql-instance-types#concept-2096487"},"MySQL instance types(x86)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/help/en/rds/apsaradb-rds-for-postgresql/primary-apsaradb-rds-for-postgresql-instance-types#concept-2096578"},"PostgreSQL instance types"))),(0,r.kt)("h3",{id:"local-database"},"Local Database"),(0,r.kt)("p",null,"To deploy a local database with MySQL v8.0 or PostgreSQL v14.0:"),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"MySQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'wordpress: ac.AppConfiguration {\n # ...\n accessories: {\n "mysql": mysql.MySQL {\n type: "local"\n version: "8.0"\n }\n }\n}\n'))),(0,r.kt)(i.Z,{value:"PostgreSQL",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'pgadmin: ac.AppConfiguration {\n # ...\n accessories: {\n "postgres": postgres.PostgreSQL {\n type: "local"\n version: "14.0"\n }\n }\n}\n')))),(0,r.kt)("h2",{id:"database-credentials"},"Database Credentials"),(0,r.kt)("p",null,"There is no need to manage the database credentials manually. Kusion will automatically generate a random password, set it as the credential when creating the database, and then inject the hostname, username and password into the application runtime."),(0,r.kt)("p",null,"You have the option to BYO (Bring Your Own) username for the database credential by specifying the ",(0,r.kt)("inlineCode",{parentName:"p"},"username")," attribute in the ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n kusionstack/mysql@0.1.0:\n default:\n # ...\n username: "my_username"\n')),(0,r.kt)("p",null,"You ",(0,r.kt)("strong",{parentName:"p"},"cannot")," bring your own password. The password will always be managed by Kusion automatically."),(0,r.kt)("p",null,"The database credentials are injected into the environment variables of the application container. You can access them via the following env vars:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"# env | grep KUSION_DB\nKUSION_DB_HOST_WORDPRESS_MYSQL=wordpress.xxxxxxxx.us-east-1.rds.amazonaws.com\nKUSION_DB_USERNAME_WORDPRESS_MYSQL=xxxxxxxxx\nKUSION_DB_PASSWORD_WORDPRESS_MYSQL=xxxxxxxxx\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about the environment of database credentials injected by Kusion can be found at ",(0,r.kt)("a",{parentName:"p",href:"/docs/reference/modules/developer-schemas/database/mysql#credentials-and-connectivity"},"mysql credentials and connectivity")," and ",(0,r.kt)("a",{parentName:"p",href:"/docs/reference/modules/developer-schemas/database/postgres#credentials-and-connectivity"},"postgres credentials and connectivity"))),(0,r.kt)("p",null,"You can use these environment variables out of the box. Or most likely, your application might retrieve the connection details from a different set of environment variables. In that case, you can map the kusion environment variables to the ones expected by your application using the ",(0,r.kt)("inlineCode",{parentName:"p"},"$()")," expression. "),(0,r.kt)("p",null,"This example below will assign the value of ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_HOST_WORDPRESS_MYSQL")," into ",(0,r.kt)("inlineCode",{parentName:"p"},"WORDPRESS_DB_HOST"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_USERNAME_WORDPRESS_MYSQL")," into ",(0,r.kt)("inlineCode",{parentName:"p"},"WORDPRESS_DB_USER"),", likewise for ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_PASSWORD_WORDPRESS_MYSQL")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"WORDPRESS_DB_PASSWORD"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'wordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n wordpress: c.Container {\n image = "wordpress:6.3-apache"\n env: {\n "WORDPRESS_DB_HOST": "$(KUSION_DB_HOST_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD_WORDPRESS_MYSQL)"\n }\n # ...\n }\n }\n # ...\n }\n accessories: {\n # ...\n }\n}\n')),(0,r.kt)("h2",{id:"configure-network-access"},"Configure Network Access"),(0,r.kt)("p",null,"You can also optionally configure the network access to the database as part of the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),". This is highly recommended because it dramatically increases the security posture of your cloud environment in the means of least privilege principle."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"securityIPs")," field in the ",(0,r.kt)("inlineCode",{parentName:"p"},"Database")," schema declares the list of network addresses that are allowed to access the database. The network addresses are in the ",(0,r.kt)("a",{parentName:"p",href:"https://aws.amazon.com/what-is/cidr/"},"CIDR notation")," and can be either a private IP range (",(0,r.kt)("a",{parentName:"p",href:"https://datatracker.ietf.org/doc/html/rfc1918"},"RFC-1918")," and ",(0,r.kt)("a",{parentName:"p",href:"https://datatracker.ietf.org/doc/html/rfc6598"},"RFC-6598")," address) or a public one."),(0,r.kt)("p",null,"If the database need to be accessed from a public location (which should most likely not be the case in a production environment), ",(0,r.kt)("inlineCode",{parentName:"p"},"securityIPs")," need to include the public IP address of the traffic source (For instance, if the RDS database needs to be accessed from your computer)."),(0,r.kt)("p",null,"To configure AWS RDS to restrict network access from a VPC with a CIDR of ",(0,r.kt)("inlineCode",{parentName:"p"},"10.0.1.0/24")," and a public IP of ",(0,r.kt)("inlineCode",{parentName:"p"},"103.192.227.125"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'modules: \n kusionstack/mysql@0.1.0: \n default: \n cloud: aws\n # ...\n securityIPs: \n - "10.0.1.0/24"\n - "103.192.227.125/32"\n')),(0,r.kt)("p",null,"Depending on the cloud provider, the default behavior of the database firewall settings may differ if omitted."),(0,r.kt)("h3",{id:"subnet-id"},"Subnet ID"),(0,r.kt)("p",null,"On AWS, you have the option to launch the RDS instance inside a specific VPC if a ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," is present in the application configuration. By default, if ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," is not provided, the RDS will be created in the default VPC for that account. However, the recommendation is to self-manage your VPCs to provider better isolation from a network security perspective."),(0,r.kt)("p",null,"On AliCloud, the ",(0,r.kt)("inlineCode",{parentName:"p"},"subnetID")," is required. The concept of subnet maps to VSwitch in AliCloud."),(0,r.kt)("p",null,"To place the RDS instance into a specific VPC on Alicloud:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'modules: \n kusionstack/mysql@0.1.0: \n default: \n cloud: alicloud\n # ...\n subnetID: "subnet-xxxxxxxxxxxxxxxx"\n')),(0,r.kt)("h3",{id:"private-routing"},"Private Routing"),(0,r.kt)("p",null,"There is an option to enforce private routing on certain cloud providers if both the workload and the database are running on the cloud."),(0,r.kt)("p",null,"On AliCloud, you can set the ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting")," flag to ",(0,r.kt)("inlineCode",{parentName:"p"},"True"),". The database host generated will be a private FQDN that is only resolvable and accessible from within the AliCloud VPCs. Setting ",(0,r.kt)("inlineCode",{parentName:"p"},"privateRouting")," flag to ",(0,r.kt)("inlineCode",{parentName:"p"},"True")," when ",(0,r.kt)("inlineCode",{parentName:"p"},"type")," is ",(0,r.kt)("inlineCode",{parentName:"p"},"aws")," is a no-op."),(0,r.kt)("p",null,"To enforce private routing on AliCloud:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules: \n kusionstack/mysql@0.1.0: \n default: \n cloud: alicloud\n # ...\n privateRouting: true\n")),(0,r.kt)("p",null,"Kusion will then generate a private FQDN and inject it into the application runtime as the environment variable ",(0,r.kt)("inlineCode",{parentName:"p"},"KUSION_DB_HOST_")," for the application to use. A complete list of Kusion-managed environment variables for mysql database can be found ",(0,r.kt)("a",{parentName:"p",href:"/docs/reference/modules/developer-schemas/database/mysql#credentials-and-connectivity"},"here"),"."),(0,r.kt)("p",null,"Otherwise when using the public FQDN to connect to a database from the workload, the route will depend on cloud provider's routing preference. The options are generally either:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Travel as far as possible on the cloud provider's global backbone network, or also referred to as cold potato routing, or"),(0,r.kt)("li",{parentName:"ul"},"Egress as early as possible to the public Internet and re-enter the cloud provider's datacenter later, or also referred to as hot potato routing")),(0,r.kt)("p",null,"The prior generally has better performance but is also more expensive."),(0,r.kt)("p",null,"You can find a good read on the ",(0,r.kt)("a",{parentName:"p",href:"https://aws.amazon.com/blogs/architecture/internet-routing-and-traffic-engineering/"},"AWS Blog")," or the ",(0,r.kt)("a",{parentName:"p",href:"https://learn.microsoft.com/en-us/azure/virtual-network/ip-services/routing-preference-overview"},"Microsoft Learn"),"."))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/b57a4a2d.56b941fa.js b/assets/js/b57a4a2d.56b941fa.js deleted file mode 100644 index 3baeebed80b..00000000000 --- a/assets/js/b57a4a2d.56b941fa.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2708],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var r=t(67294);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var s=r.createContext({}),l=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=l(e.components);return r.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},d=r.forwardRef((function(e,n){var t=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),d=l(t),m=i,g=d["".concat(s,".").concat(m)]||d[m]||u[m]||a;return t?r.createElement(g,o(o({ref:n},c),{},{components:t})):r.createElement(g,o({ref:n},c))}));function m(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var a=t.length,o=new Array(a);o[0]=d;var p={};for(var s in n)hasOwnProperty.call(n,s)&&(p[s]=n[s]);p.originalType=e,p.mdxType="string"==typeof e?e:i,o[1]=p;for(var l=2;l{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>a,metadata:()=>p,toc:()=>l});var r=t(87462),i=(t(67294),t(3905));const a={id:"resource-spec"},o="Configure Resource Specification",p={unversionedId:"user-guides/working-with-k8s/resource-spec",id:"user-guides/working-with-k8s/resource-spec",title:"Configure Resource Specification",description:"You can manage container-level resource specification in the AppConfiguration model via the resources field (under the Container schema).",source:"@site/docs/kusion/5-user-guides/2-working-with-k8s/5-resource-spec.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/resource-spec",permalink:"/docs/next/user-guides/working-with-k8s/resource-spec",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/5-user-guides/2-working-with-k8s/5-resource-spec.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:5,frontMatter:{id:"resource-spec"},sidebar:"kusion",previous:{title:"Upgrade Image",permalink:"/docs/next/user-guides/working-with-k8s/image-upgrade"},next:{title:"Set up Operational Rules",permalink:"/docs/next/user-guides/working-with-k8s/set-up-operational-rules"}},s={},l=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],c={toc:l};function u(e){let{components:n,...t}=e;return(0,i.kt)("wrapper",(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"configure-resource-specification"},"Configure Resource Specification"),(0,i.kt)("p",null,"You can manage container-level resource specification in the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model via the ",(0,i.kt)("inlineCode",{parentName:"p"},"resources")," field (under the ",(0,i.kt)("inlineCode",{parentName:"p"},"Container")," schema)."),(0,i.kt)("p",null,"For the full ",(0,i.kt)("inlineCode",{parentName:"p"},"Container")," schema reference, please see ",(0,i.kt)("a",{parentName:"p",href:"../../reference/modules/developer-schemas/workload/service#schema-container"},"here")," for more details."),(0,i.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,i.kt)("p",null,"Please refer to the ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,i.kt)("p",null,"The example below also requires you to have ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,i.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,i.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,i.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,i.kt)("h2",{id:"example"},"Example"),(0,i.kt)("p",null,"Update the resources value in ",(0,i.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-py"},'import kam.v1.app_configuration as ac\n\nhelloworld: ac.AppConfiguration {\n workload.containers.helloworld: {\n ...\n # before:\n # resources: {\n # "cpu": "500m"\n # "memory": "512M"\n # }\n # after: \n resources: {\n "cpu": "250m"\n "memory": "256Mi"\n }\n ...\n }\n}\n')),(0,i.kt)("p",null,"Everything else in ",(0,i.kt)("inlineCode",{parentName:"p"},"main.k")," stay the same."),(0,i.kt)("h2",{id:"applying"},"Applying"),(0,i.kt)("p",null,"Re-run steps in ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", resource scaling is completed."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private UnChanged\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Update\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS UnChanged v1:Service:simple-service:simple-service-dev-helloworld-private, skip \n SUCCESS Update apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \nUpdate apps/v1:Deployment:simple-service:simple-service-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,i.kt)("h2",{id:"validation"},"Validation"),(0,i.kt)("p",null,"We can verify the application container (in the deployment template) now has the updated resources attributes (cpu:250m, memory:256Mi) as defined in the container configuration:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"kubectl get deployment -n simple-service -o yaml\n...\n template:\n ...\n spec:\n containers:\n - env:\n ...\n image: gcr.io/google-samples/gb-frontend:v5\n ...\n resources:\n limits:\n cpu: 250m\n memory: 256Mi\n...\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/b57a4a2d.db2ba8b0.js b/assets/js/b57a4a2d.db2ba8b0.js new file mode 100644 index 00000000000..be3ad0978a2 --- /dev/null +++ b/assets/js/b57a4a2d.db2ba8b0.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2708],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var r=t(67294);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var s=r.createContext({}),l=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=l(e.components);return r.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},d=r.forwardRef((function(e,n){var t=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),d=l(t),m=i,g=d["".concat(s,".").concat(m)]||d[m]||u[m]||a;return t?r.createElement(g,o(o({ref:n},c),{},{components:t})):r.createElement(g,o({ref:n},c))}));function m(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var a=t.length,o=new Array(a);o[0]=d;var p={};for(var s in n)hasOwnProperty.call(n,s)&&(p[s]=n[s]);p.originalType=e,p.mdxType="string"==typeof e?e:i,o[1]=p;for(var l=2;l{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>a,metadata:()=>p,toc:()=>l});var r=t(87462),i=(t(67294),t(3905));const a={id:"resource-spec"},o="Configure Resource Specification",p={unversionedId:"user-guides/working-with-k8s/resource-spec",id:"user-guides/working-with-k8s/resource-spec",title:"Configure Resource Specification",description:"You can manage container-level resource specification in the AppConfiguration model via the resources field (under the Container schema).",source:"@site/docs/kusion/5-user-guides/2-working-with-k8s/5-resource-spec.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/resource-spec",permalink:"/docs/next/user-guides/working-with-k8s/resource-spec",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/5-user-guides/2-working-with-k8s/5-resource-spec.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:5,frontMatter:{id:"resource-spec"},sidebar:"kusion",previous:{title:"Upgrade Image",permalink:"/docs/next/user-guides/working-with-k8s/image-upgrade"},next:{title:"Set up Operational Rules",permalink:"/docs/next/user-guides/working-with-k8s/set-up-operational-rules"}},s={},l=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],c={toc:l};function u(e){let{components:n,...t}=e;return(0,i.kt)("wrapper",(0,r.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"configure-resource-specification"},"Configure Resource Specification"),(0,i.kt)("p",null,"You can manage container-level resource specification in the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model via the ",(0,i.kt)("inlineCode",{parentName:"p"},"resources")," field (under the ",(0,i.kt)("inlineCode",{parentName:"p"},"Container")," schema)."),(0,i.kt)("p",null,"For the full ",(0,i.kt)("inlineCode",{parentName:"p"},"Container")," schema reference, please see ",(0,i.kt)("a",{parentName:"p",href:"../../reference/modules/developer-schemas/workload/service#schema-container"},"here")," for more details."),(0,i.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,i.kt)("p",null,"Please refer to the ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,i.kt)("p",null,"The example below also requires you to have ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,i.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,i.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,i.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,i.kt)("h2",{id:"example"},"Example"),(0,i.kt)("p",null,"Update the resources value in ",(0,i.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-py"},'import kam.v1.app_configuration as ac\n\nhelloworld: ac.AppConfiguration {\n workload.containers.helloworld: {\n ...\n # before:\n # resources: {\n # "cpu": "500m"\n # "memory": "512M"\n # }\n # after: \n resources: {\n "cpu": "250m"\n "memory": "256Mi"\n }\n ...\n }\n}\n')),(0,i.kt)("p",null,"Everything else in ",(0,i.kt)("inlineCode",{parentName:"p"},"main.k")," stay the same."),(0,i.kt)("h2",{id:"applying"},"Applying"),(0,i.kt)("p",null,"Re-run steps in ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", resource scaling is completed."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private UnChanged\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Update\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS UnChanged v1:Service:simple-service:simple-service-dev-helloworld-private, skip \n SUCCESS Update apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \nUpdate apps/v1:Deployment:simple-service:simple-service-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,i.kt)("h2",{id:"validation"},"Validation"),(0,i.kt)("p",null,"We can verify the application container (in the deployment template) now has the updated resources attributes (cpu:250m, memory:256Mi) as defined in the container configuration:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"kubectl get deployment -n simple-service -o yaml\n...\n template:\n ...\n spec:\n containers:\n - env:\n ...\n image: gcr.io/google-samples/gb-frontend:v5\n ...\n resources:\n limits:\n cpu: 250m\n memory: 256Mi\n...\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/b62a942b.94d65b8e.js b/assets/js/b62a942b.283f5e5c.js similarity index 56% rename from assets/js/b62a942b.94d65b8e.js rename to assets/js/b62a942b.283f5e5c.js index cf60887eb84..ee810b3eb8d 100644 --- a/assets/js/b62a942b.94d65b8e.js +++ b/assets/js/b62a942b.283f5e5c.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1e3],{3905:(e,t,r)=>{r.d(t,{Zo:()=>m,kt:()=>d});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},m=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,m=i(e,["components","mdxType","originalType","parentName"]),u=p(r),d=o,h=u["".concat(l,".").concat(d)]||u[d]||c[d]||a;return r?n.createElement(h,s(s({ref:t},m),{},{components:r})):n.createElement(h,s({ref:t},m))}));function d(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},s="prometheus",i={unversionedId:"reference/modules/developer-schemas/monitoring/prometheus",id:"version-v0.11/reference/modules/developer-schemas/monitoring/prometheus",title:"prometheus",description:"Schema Prometheus",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/monitoring/prometheus.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/monitoring",slug:"/reference/modules/developer-schemas/monitoring/prometheus",permalink:"/docs/reference/modules/developer-schemas/monitoring/prometheus",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/monitoring/prometheus.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"secret",permalink:"/docs/reference/modules/developer-schemas/internal/secret/"},next:{title:"network",permalink:"/docs/reference/modules/developer-schemas/network/"}},l={},p=[{value:"Schema Prometheus",id:"schema-prometheus",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],m={toc:p};function c(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"prometheus"},"prometheus"),(0,o.kt)("h2",{id:"schema-prometheus"},"Schema Prometheus"),(0,o.kt)("p",null,"Prometheus can be used to define monitoring requirements"),(0,o.kt)("h3",{id:"attributes"},"Attributes"),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:null},"name"),(0,o.kt)("th",{parentName:"tr",align:null},"type"),(0,o.kt)("th",{parentName:"tr",align:null},"description"),(0,o.kt)("th",{parentName:"tr",align:null},"default value"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"path")),(0,o.kt)("td",{parentName:"tr",align:null},"str"),(0,o.kt)("td",{parentName:"tr",align:null},"The path to scrape metrics from."),(0,o.kt)("td",{parentName:"tr",align:null},'"/metrics"')),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"port")),(0,o.kt)("td",{parentName:"tr",align:null},"str"),(0,o.kt)("td",{parentName:"tr",align:null},"The port to scrape metrics from. When using Prometheus operator, this needs to be the port NAME. Otherwise, this can be a port name or a number."),(0,o.kt)("td",{parentName:"tr",align:null},"container ports when scraping pod (monitorType is pod) and service port when scraping service (monitorType is service)")))),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-python"},'import monitoring as m\n\n"monitoring": m.Prometheus {\n path: "/metrics"\n port: "web"\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1e3],{3905:(e,t,r)=>{r.d(t,{Zo:()=>m,kt:()=>d});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},m=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,m=i(e,["components","mdxType","originalType","parentName"]),u=p(r),d=o,h=u["".concat(l,".").concat(d)]||u[d]||c[d]||a;return r?n.createElement(h,s(s({ref:t},m),{},{components:r})):n.createElement(h,s({ref:t},m))}));function d(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},s="prometheus",i={unversionedId:"reference/modules/developer-schemas/monitoring/prometheus",id:"version-v0.11/reference/modules/developer-schemas/monitoring/prometheus",title:"prometheus",description:"Schema Prometheus",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/monitoring/prometheus.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/monitoring",slug:"/reference/modules/developer-schemas/monitoring/prometheus",permalink:"/docs/reference/modules/developer-schemas/monitoring/prometheus",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/monitoring/prometheus.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"secret",permalink:"/docs/reference/modules/developer-schemas/internal/secret/"},next:{title:"network",permalink:"/docs/reference/modules/developer-schemas/network/"}},l={},p=[{value:"Schema Prometheus",id:"schema-prometheus",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],m={toc:p};function c(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"prometheus"},"prometheus"),(0,o.kt)("h2",{id:"schema-prometheus"},"Schema Prometheus"),(0,o.kt)("p",null,"Prometheus can be used to define monitoring requirements"),(0,o.kt)("h3",{id:"attributes"},"Attributes"),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:null},"name"),(0,o.kt)("th",{parentName:"tr",align:null},"type"),(0,o.kt)("th",{parentName:"tr",align:null},"description"),(0,o.kt)("th",{parentName:"tr",align:null},"default value"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"path")),(0,o.kt)("td",{parentName:"tr",align:null},"str"),(0,o.kt)("td",{parentName:"tr",align:null},"The path to scrape metrics from."),(0,o.kt)("td",{parentName:"tr",align:null},'"/metrics"')),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"port")),(0,o.kt)("td",{parentName:"tr",align:null},"str"),(0,o.kt)("td",{parentName:"tr",align:null},"The port to scrape metrics from. When using Prometheus operator, this needs to be the port NAME. Otherwise, this can be a port name or a number."),(0,o.kt)("td",{parentName:"tr",align:null},"container ports when scraping pod (monitorType is pod) and service port when scraping service (monitorType is service)")))),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-python"},'import monitoring as m\n\n"monitoring": m.Prometheus {\n path: "/metrics"\n port: "web"\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/b72e870b.b0818aeb.js b/assets/js/b72e870b.f840b411.js similarity index 53% rename from assets/js/b72e870b.b0818aeb.js rename to assets/js/b72e870b.f840b411.js index b8325753fed..c05db55dec3 100644 --- a/assets/js/b72e870b.b0818aeb.js +++ b/assets/js/b72e870b.f840b411.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[799],{3905:(e,n,r)=>{r.d(n,{Zo:()=>l,kt:()=>k});var t=r(67294);function o(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function a(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,t)}return r}function s(e){for(var n=1;n=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=t.createContext({}),p=function(e){var n=t.useContext(c),r=n;return e&&(r="function"==typeof e?e(n):s(s({},n),e)),r},l=function(e){var n=p(e.components);return t.createElement(c.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},d=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=p(r),k=o,f=d["".concat(c,".").concat(k)]||d[k]||u[k]||a;return r?t.createElement(f,s(s({ref:n},l),{},{components:r})):t.createElement(f,s({ref:n},l))}));function k(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=d;var i={};for(var c in n)hasOwnProperty.call(n,c)&&(i[c]=n[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var p=2;p{r.r(n),r.d(n,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var t=r(87462),o=(r(67294),r(3905));const a={},s="kusion workspace show",i={unversionedId:"reference/commands/kusion-workspace-show",id:"reference/commands/kusion-workspace-show",title:"kusion workspace show",description:"Show a workspace configuration",source:"@site/docs/kusion/6-reference/1-commands/kusion-workspace-show.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-show",permalink:"/docs/next/reference/commands/kusion-workspace-show",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-workspace-show.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace list",permalink:"/docs/next/reference/commands/kusion-workspace-list"},next:{title:"kusion workspace switch",permalink:"/docs/next/reference/commands/kusion-workspace-switch"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:n,...r}=e;return(0,o.kt)("wrapper",(0,t.Z)({},l,r,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-show"},"kusion workspace show"),(0,o.kt)("p",null,"Show a workspace configuration"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command gets the current or a specified workspace configuration."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace show\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Show current workspace configuration\n kusion workspace show\n \n # Show a specified workspace configuration\n kusion workspace show dev\n \n # Show a specified workspace in a specified backend\n kusion workspace show prod --backend oss-prod\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string the backend name\n -h, --help help for show\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[799],{3905:(e,n,r)=>{r.d(n,{Zo:()=>l,kt:()=>k});var t=r(67294);function o(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function a(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,t)}return r}function s(e){for(var n=1;n=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=t.createContext({}),p=function(e){var n=t.useContext(c),r=n;return e&&(r="function"==typeof e?e(n):s(s({},n),e)),r},l=function(e){var n=p(e.components);return t.createElement(c.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},d=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=p(r),k=o,f=d["".concat(c,".").concat(k)]||d[k]||u[k]||a;return r?t.createElement(f,s(s({ref:n},l),{},{components:r})):t.createElement(f,s({ref:n},l))}));function k(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=d;var i={};for(var c in n)hasOwnProperty.call(n,c)&&(i[c]=n[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var p=2;p{r.r(n),r.d(n,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var t=r(87462),o=(r(67294),r(3905));const a={},s="kusion workspace show",i={unversionedId:"reference/commands/kusion-workspace-show",id:"reference/commands/kusion-workspace-show",title:"kusion workspace show",description:"Show a workspace configuration",source:"@site/docs/kusion/6-reference/1-commands/kusion-workspace-show.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-show",permalink:"/docs/next/reference/commands/kusion-workspace-show",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-workspace-show.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace list",permalink:"/docs/next/reference/commands/kusion-workspace-list"},next:{title:"kusion workspace switch",permalink:"/docs/next/reference/commands/kusion-workspace-switch"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:n,...r}=e;return(0,o.kt)("wrapper",(0,t.Z)({},l,r,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-show"},"kusion workspace show"),(0,o.kt)("p",null,"Show a workspace configuration"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command gets the current or a specified workspace configuration."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace show\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Show current workspace configuration\n kusion workspace show\n \n # Show a specified workspace configuration\n kusion workspace show dev\n \n # Show a specified workspace in a specified backend\n kusion workspace show prod --backend oss-prod\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string the backend name\n -h, --help help for show\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/b8f8e7bf.4e4dfc0d.js b/assets/js/b8f8e7bf.4e4dfc0d.js new file mode 100644 index 00000000000..33dba8cc83d --- /dev/null +++ b/assets/js/b8f8e7bf.4e4dfc0d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1792],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(n),m=o,k=u["".concat(s,".").concat(m)]||u[m]||c[m]||r;return n?a.createElement(k,i(i({ref:t},d),{},{components:n})):a.createElement(k,i({ref:t},d))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,i=new Array(r);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>c,frontMatter:()=>r,metadata:()=>l,toc:()=>p});var a=n(87462),o=(n(67294),n(3905));const r={id:"deliver-wordpress"},i="Deliver the WordPress Application on Kubernetes",l={unversionedId:"getting-started/deliver-wordpress",id:"version-v0.10/getting-started/deliver-wordpress",title:"Deliver the WordPress Application on Kubernetes",description:"In this tutorial we will walk through how to deploy a WordPress application on Kubernetes with Kusion. The WordPress application will interact with a locally deployed MySQL, which is declared as a database accessory in the config codes and will be automatically created and managed by Kusion.",source:"@site/docs_versioned_docs/version-v0.10/2-getting-started/2-deliver-wordpress.md",sourceDirName:"2-getting-started",slug:"/getting-started/deliver-wordpress",permalink:"/docs/v0.10/getting-started/deliver-wordpress",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/2-getting-started/2-deliver-wordpress.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"deliver-wordpress"},sidebar:"kusion",previous:{title:"Install Kusion",permalink:"/docs/v0.10/getting-started/install-kusion"},next:{title:"Overview",permalink:"/docs/v0.10/concepts/project/overview"}},s={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Init Workspace",id:"init-workspace",level:2},{value:"Init Project",id:"init-project",level:2},{value:"Review Configuration Files",id:"review-configuration-files",level:3},{value:"Application Delivery",id:"application-delivery",level:2},{value:"Delete WordPress Application",id:"delete-wordpress-application",level:2}],d={toc:p};function c(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,a.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"deliver-the-wordpress-application-on-kubernetes"},"Deliver the WordPress Application on Kubernetes"),(0,o.kt)("p",null,"In this tutorial we will walk through how to deploy a WordPress application on Kubernetes with Kusion. The WordPress application will interact with a locally deployed MySQL, which is declared as a database accessory in the config codes and will be automatically created and managed by Kusion. "),(0,o.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,o.kt)("p",null,"Before we start to play with this example, we need to have the Kusion CLI installed and run a Kubernetes cluster. Here are some helpful documentations: "),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Install ",(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/getting-started/install-kusion"},"Kusion")," CLI"),(0,o.kt)("li",{parentName:"ul"},"Install ",(0,o.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/tasks/tools/#kubectl"},"kubectl")," CLI and run a ",(0,o.kt)("a",{parentName:"li",href:"https://kubernetes.io/"},"Kubernetes")," cluster. Some light and convenient options for local deployment include ",(0,o.kt)("a",{parentName:"li",href:"https://docs.k3s.io/quick-start"},"k3s"),", ",(0,o.kt)("a",{parentName:"li",href:"https://k3d.io/v5.4.4/#installation"},"k3d"),", and ",(0,o.kt)("a",{parentName:"li",href:"https://minikube.sigs.k8s.io/docs/tutorials/multi_node/"},"MiniKube"),". ")),(0,o.kt)("h2",{id:"init-workspace"},"Init Workspace"),(0,o.kt)("p",null,"To deploy the WordPress application, we need to first initiate a ",(0,o.kt)("inlineCode",{parentName:"p"},"Workspace")," for the targeted stack (we are using ",(0,o.kt)("inlineCode",{parentName:"p"},"dev")," here). Please copy the following example YAML file to your local ",(0,o.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),". "),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"workspace.yaml")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-yaml"},'# example workspace configs for local mysql database\nruntimes: \n kubernetes: \n kubeConfig: /etc/kubeconfig.yaml # Please replace with your own kubeconfig file path\n\nmodules: \n mysql: \n default: \n suffix: "-mysql" # The suffix of the MySQL database name\n')),(0,o.kt)("p",null,"You can replace the ",(0,o.kt)("inlineCode",{parentName:"p"},"runtimes.kubernetes.kubeConfig")," field with your own kubeconfig file path in ",(0,o.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," and execute the following command line to initiate the workspace configuration for ",(0,o.kt)("inlineCode",{parentName:"p"},"dev")," stack. "),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace create dev -f workspace.yaml\n")),(0,o.kt)("p",null,"You can use the following command lines to list and show the workspace configurations for ",(0,o.kt)("inlineCode",{parentName:"p"},"dev")," stack. "),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace list\n\nkusion workspace show dev\n")),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," is a sample configuration file for workspace management, including ",(0,o.kt)("inlineCode",{parentName:"p"},"Kubernetes")," runtime config and ",(0,o.kt)("inlineCode",{parentName:"p"},"MySQL")," module config. Workspace configurations are usually declared by ",(0,o.kt)("strong",{parentName:"p"},"Platform Engineers")," and will take effect through the corresponding stack. "),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"More details about the configuration of Workspace can be found in ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/design/workspace_management/workspace_management.md"},"Workspace Management"),". ")),(0,o.kt)("h2",{id:"init-project"},"Init Project"),(0,o.kt)("p",null,"We can start by initializing this tutorial project with online templates: "),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"kusion init --online\n")),(0,o.kt)("p",null,"All init templates are listed as follows: "),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"\u279c kusion_playground kusion init --online\n? Please choose a template: wordpress-local-db A sample wordpress project with local database\nThis command will walk you through creating a new kusion project.\n\nEnter a value or leave blank to accept the (default), and press .\nPress ^C at any time to quit.\n\nProject Config:\n? ProjectName: wordpress-local-db\n? AppName: wordpress\nStack Config: dev\n? Image: wordpress:6.3\nCreated project 'wordpress-local-db'\n")),(0,o.kt)("p",null,"Please select ",(0,o.kt)("inlineCode",{parentName:"p"},"wordpress-local-db")," and press ",(0,o.kt)("inlineCode",{parentName:"p"},"Enter"),", after which we will see the hints below and use the default values to configure this project and stack. "),(0,o.kt)("p",null,(0,o.kt)("img",{src:n(63617).Z,width:"2560",height:"1440"})),(0,o.kt)("p",null,"The directory structure looks like the following: "),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"cd wordpress-local-db/dev && tree\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"\u279c kusion_playground cd wordpress-local-db/dev && tree\n.\n\u251c\u2500\u2500 kcl.mod\n\u251c\u2500\u2500 main.k\n\u2514\u2500\u2500 stack.yaml\n\n1 directory, 3 files\n")),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"More details about the directory structure can be found in ",(0,o.kt)("a",{parentName:"p",href:"/docs/v0.10/concepts/project/overview"},"Project")," and ",(0,o.kt)("a",{parentName:"p",href:"/docs/v0.10/concepts/stack/overview"},"Stack"),". ")),(0,o.kt)("h3",{id:"review-configuration-files"},"Review Configuration Files"),(0,o.kt)("p",null,"Now let's have a glance at the configuration file of ",(0,o.kt)("inlineCode",{parentName:"p"},"dev/main.k"),": "),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.network as n\nimport catalog.models.schema.v1.accessories.mysql\n\n# main.k declares customized configurations for dev stack.\nwordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n wordpress: c.Container {\n image: "wordpress:6.3"\n env: {\n "WORDPRESS_DB_HOST": "$(KUSION_DB_HOST_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_NAME": "mysql"\n }\n }\n }\n replicas: 1\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n database: {\n wordpress: mysql.MySQL {\n type: "local"\n version: "8.0"\n }\n }\n}\n')),(0,o.kt)("p",null,"The configuration file ",(0,o.kt)("inlineCode",{parentName:"p"},"main.k"),", usually written by the ",(0,o.kt)("strong",{parentName:"p"},"App Developers"),", declares customized configurations for ",(0,o.kt)("inlineCode",{parentName:"p"},"dev")," stack, which includes an ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," with the name of ",(0,o.kt)("inlineCode",{parentName:"p"},"wordpress"),". And the ",(0,o.kt)("inlineCode",{parentName:"p"},"wordpress")," application includes a workload of type ",(0,o.kt)("inlineCode",{parentName:"p"},"workload.Service"),", which runs on 1 replica and exposes ",(0,o.kt)("inlineCode",{parentName:"p"},"80")," port to be accessed. Besides, it declares a local ",(0,o.kt)("inlineCode",{parentName:"p"},"mysql.MySQL")," as the database accessory with the engine version of ",(0,o.kt)("inlineCode",{parentName:"p"},"8.0")," for the application. The necessary Kubernetes resources for deploying and using the local database will be generated, and users can get the ",(0,o.kt)("inlineCode",{parentName:"p"},"host"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"username")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"paasword")," of the database through the ",(0,o.kt)("a",{parentName:"p",href:"/docs/v0.10/reference/modules/catalog-models/database/mysql#credentials-and-connectivity"},"mysql credentials and connectivity")," of Kusion in application containers. "),(0,o.kt)("p",null,"This model hides the major complexity of Kubernetes resources such as ",(0,o.kt)("inlineCode",{parentName:"p"},"Namespace"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"Deployment")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Service"),", providing the concepts that are application-centric and infrastructure-agnostic. "),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"More details about the Models can be found in ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"Catalog"))),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"The collaboration paradigm between App Developers and Platform Engineers with Kusion can be found in ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/design/collaboration/collaboration_paradigm.md"},"Collaboration Paradigm"))),(0,o.kt)("h2",{id:"application-delivery"},"Application Delivery"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"kusion apply --watch\n")),(0,o.kt)("p",null,"We will deliver the WordPress application in the ",(0,o.kt)("inlineCode",{parentName:"p"},"wordpress-local-db/dev")," folder into the Kubernetes cluster with one command ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion apply --watch"),". "),(0,o.kt)("p",null,(0,o.kt)("img",{src:n(41809).Z,width:"2560",height:"1440"})),(0,o.kt)("p",null,"Check ",(0,o.kt)("inlineCode",{parentName:"p"},"Deployment")," status. "),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"kubectl -n wordpress-local-db get deployment\n")),(0,o.kt)("p",null,"The expected output is shown as follows: "),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"\u279c dev kubectl -n wordpress-local-db get deployment\nNAME READY UP-TO-DATE AVAILABLE AGE\nwordpress-local-db-dev-wordpress 1/1 1 1 2m56s\nwordpress-mysql 1/1 1 1 2m56s\n")),(0,o.kt)("p",null,"In the above two resources, ",(0,o.kt)("inlineCode",{parentName:"p"},"wordpress-local-db-dev-wordpress")," corresponds to the Kubernetes ",(0,o.kt)("inlineCode",{parentName:"p"},"Deployment")," of the WordPress application, while ",(0,o.kt)("inlineCode",{parentName:"p"},"wordpress-mysql")," corresponds to the ",(0,o.kt)("inlineCode",{parentName:"p"},"Deployment")," of the local MySQL database. "),(0,o.kt)("p",null,"Port-forward our WordPress with the ",(0,o.kt)("inlineCode",{parentName:"p"},"Service"),". "),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"kubectl port-forward -n wordpress-local-db service/wordpress-local-db-dev-wordpress-private 12345:80\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"\u279c dev kubectl port-forward -n wordpress-local-db service/wordpress-local-db-dev-wordpress-private 12345:80\nForwarding from 127.0.0.1:12345 -> 80\nForwarding from [::1]:12345 -> 80\n\n")),(0,o.kt)("p",null,"Now we can visit ",(0,o.kt)("a",{parentName:"p",href:"http://localhost:12345"},"http://localhost:12345")," in our browser and enjoy!"),(0,o.kt)("p",null,(0,o.kt)("img",{src:n(85773).Z,width:"1500",height:"803"})),(0,o.kt)("h2",{id:"delete-wordpress-application"},"Delete WordPress Application"),(0,o.kt)("p",null,"We can delete the WordPress application and related database resources using the following command line: "),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"kusion destroy --yes\n")),(0,o.kt)("p",null,(0,o.kt)("img",{src:n(21192).Z,width:"2560",height:"1440"})))}c.isMDXComponent=!0},41809:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/apply-wordpress-local-db-6a391cbf9576c88494710eb17f8c8396.gif"},21192:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/destroy-wordpress-local-db-93038beed84dadd31cbefdbbfb632ee1.gif"},63617:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/init-wordpress-local-db-34d0778e8b48028ad7a1394543a1dfb2.gif"},85773:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/wordpress-site-page-ef650e640399209d1eec5e6dfe88c454.png"}}]); \ No newline at end of file diff --git a/assets/js/b8f8e7bf.dbffdb30.js b/assets/js/b8f8e7bf.dbffdb30.js deleted file mode 100644 index 52e3a857a22..00000000000 --- a/assets/js/b8f8e7bf.dbffdb30.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1792],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(n),m=o,k=u["".concat(s,".").concat(m)]||u[m]||c[m]||r;return n?a.createElement(k,i(i({ref:t},d),{},{components:n})):a.createElement(k,i({ref:t},d))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,i=new Array(r);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>c,frontMatter:()=>r,metadata:()=>l,toc:()=>p});var a=n(87462),o=(n(67294),n(3905));const r={id:"deliver-wordpress"},i="Deliver the WordPress Application on Kubernetes",l={unversionedId:"getting-started/deliver-wordpress",id:"version-v0.10/getting-started/deliver-wordpress",title:"Deliver the WordPress Application on Kubernetes",description:"In this tutorial we will walk through how to deploy a WordPress application on Kubernetes with Kusion. The WordPress application will interact with a locally deployed MySQL, which is declared as a database accessory in the config codes and will be automatically created and managed by Kusion.",source:"@site/docs_versioned_docs/version-v0.10/2-getting-started/2-deliver-wordpress.md",sourceDirName:"2-getting-started",slug:"/getting-started/deliver-wordpress",permalink:"/docs/v0.10/getting-started/deliver-wordpress",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/2-getting-started/2-deliver-wordpress.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"deliver-wordpress"},sidebar:"kusion",previous:{title:"Install Kusion",permalink:"/docs/v0.10/getting-started/install-kusion"},next:{title:"Overview",permalink:"/docs/v0.10/concepts/project/overview"}},s={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Init Workspace",id:"init-workspace",level:2},{value:"Init Project",id:"init-project",level:2},{value:"Review Configuration Files",id:"review-configuration-files",level:3},{value:"Application Delivery",id:"application-delivery",level:2},{value:"Delete WordPress Application",id:"delete-wordpress-application",level:2}],d={toc:p};function c(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,a.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"deliver-the-wordpress-application-on-kubernetes"},"Deliver the WordPress Application on Kubernetes"),(0,o.kt)("p",null,"In this tutorial we will walk through how to deploy a WordPress application on Kubernetes with Kusion. The WordPress application will interact with a locally deployed MySQL, which is declared as a database accessory in the config codes and will be automatically created and managed by Kusion. "),(0,o.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,o.kt)("p",null,"Before we start to play with this example, we need to have the Kusion CLI installed and run a Kubernetes cluster. Here are some helpful documentations: "),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Install ",(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/getting-started/install-kusion"},"Kusion")," CLI"),(0,o.kt)("li",{parentName:"ul"},"Install ",(0,o.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/tasks/tools/#kubectl"},"kubectl")," CLI and run a ",(0,o.kt)("a",{parentName:"li",href:"https://kubernetes.io/"},"Kubernetes")," cluster. Some light and convenient options for local deployment include ",(0,o.kt)("a",{parentName:"li",href:"https://docs.k3s.io/quick-start"},"k3s"),", ",(0,o.kt)("a",{parentName:"li",href:"https://k3d.io/v5.4.4/#installation"},"k3d"),", and ",(0,o.kt)("a",{parentName:"li",href:"https://minikube.sigs.k8s.io/docs/tutorials/multi_node/"},"MiniKube"),". ")),(0,o.kt)("h2",{id:"init-workspace"},"Init Workspace"),(0,o.kt)("p",null,"To deploy the WordPress application, we need to first initiate a ",(0,o.kt)("inlineCode",{parentName:"p"},"Workspace")," for the targeted stack (we are using ",(0,o.kt)("inlineCode",{parentName:"p"},"dev")," here). Please copy the following example YAML file to your local ",(0,o.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),". "),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"workspace.yaml")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-yaml"},'# example workspace configs for local mysql database\nruntimes: \n kubernetes: \n kubeConfig: /etc/kubeconfig.yaml # Please replace with your own kubeconfig file path\n\nmodules: \n mysql: \n default: \n suffix: "-mysql" # The suffix of the MySQL database name\n')),(0,o.kt)("p",null,"You can replace the ",(0,o.kt)("inlineCode",{parentName:"p"},"runtimes.kubernetes.kubeConfig")," field with your own kubeconfig file path in ",(0,o.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," and execute the following command line to initiate the workspace configuration for ",(0,o.kt)("inlineCode",{parentName:"p"},"dev")," stack. "),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace create dev -f workspace.yaml\n")),(0,o.kt)("p",null,"You can use the following command lines to list and show the workspace configurations for ",(0,o.kt)("inlineCode",{parentName:"p"},"dev")," stack. "),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace list\n\nkusion workspace show dev\n")),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," is a sample configuration file for workspace management, including ",(0,o.kt)("inlineCode",{parentName:"p"},"Kubernetes")," runtime config and ",(0,o.kt)("inlineCode",{parentName:"p"},"MySQL")," module config. Workspace configurations are usually declared by ",(0,o.kt)("strong",{parentName:"p"},"Platform Engineers")," and will take effect through the corresponding stack. "),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"More details about the configuration of Workspace can be found in ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/design/workspace_management/workspace_management.md"},"Workspace Management"),". ")),(0,o.kt)("h2",{id:"init-project"},"Init Project"),(0,o.kt)("p",null,"We can start by initializing this tutorial project with online templates: "),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"kusion init --online\n")),(0,o.kt)("p",null,"All init templates are listed as follows: "),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"\u279c kusion_playground kusion init --online\n? Please choose a template: wordpress-local-db A sample wordpress project with local database\nThis command will walk you through creating a new kusion project.\n\nEnter a value or leave blank to accept the (default), and press .\nPress ^C at any time to quit.\n\nProject Config:\n? ProjectName: wordpress-local-db\n? AppName: wordpress\nStack Config: dev\n? Image: wordpress:6.3\nCreated project 'wordpress-local-db'\n")),(0,o.kt)("p",null,"Please select ",(0,o.kt)("inlineCode",{parentName:"p"},"wordpress-local-db")," and press ",(0,o.kt)("inlineCode",{parentName:"p"},"Enter"),", after which we will see the hints below and use the default values to configure this project and stack. "),(0,o.kt)("p",null,(0,o.kt)("img",{src:n(63617).Z,width:"2560",height:"1440"})),(0,o.kt)("p",null,"The directory structure looks like the following: "),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"cd wordpress-local-db/dev && tree\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"\u279c kusion_playground cd wordpress-local-db/dev && tree\n.\n\u251c\u2500\u2500 kcl.mod\n\u251c\u2500\u2500 main.k\n\u2514\u2500\u2500 stack.yaml\n\n1 directory, 3 files\n")),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"More details about the directory structure can be found in ",(0,o.kt)("a",{parentName:"p",href:"/docs/v0.10/concepts/project/overview"},"Project")," and ",(0,o.kt)("a",{parentName:"p",href:"/docs/v0.10/concepts/stack/overview"},"Stack"),". ")),(0,o.kt)("h3",{id:"review-configuration-files"},"Review Configuration Files"),(0,o.kt)("p",null,"Now let's have a glance at the configuration file of ",(0,o.kt)("inlineCode",{parentName:"p"},"dev/main.k"),": "),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.network as n\nimport catalog.models.schema.v1.accessories.mysql\n\n# main.k declares customized configurations for dev stack.\nwordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n wordpress: c.Container {\n image: "wordpress:6.3"\n env: {\n "WORDPRESS_DB_HOST": "$(KUSION_DB_HOST_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_NAME": "mysql"\n }\n }\n }\n replicas: 1\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n database: {\n wordpress: mysql.MySQL {\n type: "local"\n version: "8.0"\n }\n }\n}\n')),(0,o.kt)("p",null,"The configuration file ",(0,o.kt)("inlineCode",{parentName:"p"},"main.k"),", usually written by the ",(0,o.kt)("strong",{parentName:"p"},"App Developers"),", declares customized configurations for ",(0,o.kt)("inlineCode",{parentName:"p"},"dev")," stack, which includes an ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," with the name of ",(0,o.kt)("inlineCode",{parentName:"p"},"wordpress"),". And the ",(0,o.kt)("inlineCode",{parentName:"p"},"wordpress")," application includes a workload of type ",(0,o.kt)("inlineCode",{parentName:"p"},"workload.Service"),", which runs on 1 replica and exposes ",(0,o.kt)("inlineCode",{parentName:"p"},"80")," port to be accessed. Besides, it declares a local ",(0,o.kt)("inlineCode",{parentName:"p"},"mysql.MySQL")," as the database accessory with the engine version of ",(0,o.kt)("inlineCode",{parentName:"p"},"8.0")," for the application. The necessary Kubernetes resources for deploying and using the local database will be generated, and users can get the ",(0,o.kt)("inlineCode",{parentName:"p"},"host"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"username")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"paasword")," of the database through the ",(0,o.kt)("a",{parentName:"p",href:"/docs/v0.10/reference/modules/catalog-models/database/mysql#credentials-and-connectivity"},"mysql credentials and connectivity")," of Kusion in application containers. "),(0,o.kt)("p",null,"This model hides the major complexity of Kubernetes resources such as ",(0,o.kt)("inlineCode",{parentName:"p"},"Namespace"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"Deployment")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Service"),", providing the concepts that are application-centric and infrastructure-agnostic. "),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"More details about the Models can be found in ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"Catalog"))),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"The collaboration paradigm between App Developers and Platform Engineers with Kusion can be found in ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/design/collaboration/collaboration_paradigm.md"},"Collaboration Paradigm"))),(0,o.kt)("h2",{id:"application-delivery"},"Application Delivery"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"kusion apply --watch\n")),(0,o.kt)("p",null,"We will deliver the WordPress application in the ",(0,o.kt)("inlineCode",{parentName:"p"},"wordpress-local-db/dev")," folder into the Kubernetes cluster with one command ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion apply --watch"),". "),(0,o.kt)("p",null,(0,o.kt)("img",{src:n(41809).Z,width:"2560",height:"1440"})),(0,o.kt)("p",null,"Check ",(0,o.kt)("inlineCode",{parentName:"p"},"Deployment")," status. "),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"kubectl -n wordpress-local-db get deployment\n")),(0,o.kt)("p",null,"The expected output is shown as follows: "),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"\u279c dev kubectl -n wordpress-local-db get deployment\nNAME READY UP-TO-DATE AVAILABLE AGE\nwordpress-local-db-dev-wordpress 1/1 1 1 2m56s\nwordpress-mysql 1/1 1 1 2m56s\n")),(0,o.kt)("p",null,"In the above two resources, ",(0,o.kt)("inlineCode",{parentName:"p"},"wordpress-local-db-dev-wordpress")," corresponds to the Kubernetes ",(0,o.kt)("inlineCode",{parentName:"p"},"Deployment")," of the WordPress application, while ",(0,o.kt)("inlineCode",{parentName:"p"},"wordpress-mysql")," corresponds to the ",(0,o.kt)("inlineCode",{parentName:"p"},"Deployment")," of the local MySQL database. "),(0,o.kt)("p",null,"Port-forward our WordPress with the ",(0,o.kt)("inlineCode",{parentName:"p"},"Service"),". "),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"kubectl port-forward -n wordpress-local-db service/wordpress-local-db-dev-wordpress-private 12345:80\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"\u279c dev kubectl port-forward -n wordpress-local-db service/wordpress-local-db-dev-wordpress-private 12345:80\nForwarding from 127.0.0.1:12345 -> 80\nForwarding from [::1]:12345 -> 80\n\n")),(0,o.kt)("p",null,"Now we can visit ",(0,o.kt)("a",{parentName:"p",href:"http://localhost:12345"},"http://localhost:12345")," in our browser and enjoy!"),(0,o.kt)("p",null,(0,o.kt)("img",{src:n(85773).Z,width:"1500",height:"803"})),(0,o.kt)("h2",{id:"delete-wordpress-application"},"Delete WordPress Application"),(0,o.kt)("p",null,"We can delete the WordPress application and related database resources using the following command line: "),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"kusion destroy --yes\n")),(0,o.kt)("p",null,(0,o.kt)("img",{src:n(21192).Z,width:"2560",height:"1440"})))}c.isMDXComponent=!0},41809:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/apply-wordpress-local-db-6a391cbf9576c88494710eb17f8c8396.gif"},21192:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/destroy-wordpress-local-db-93038beed84dadd31cbefdbbfb632ee1.gif"},63617:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/init-wordpress-local-db-34d0778e8b48028ad7a1394543a1dfb2.gif"},85773:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/wordpress-site-page-ef650e640399209d1eec5e6dfe88c454.png"}}]); \ No newline at end of file diff --git a/assets/js/b934881b.8479e883.js b/assets/js/b934881b.8479e883.js deleted file mode 100644 index 5e73cb3b7d9..00000000000 --- a/assets/js/b934881b.8479e883.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4757],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>u});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),d=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=d(e.components);return a.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),m=d(n),u=r,y=m["".concat(s,".").concat(u)]||m[u]||c[u]||l;return n?a.createElement(y,o(o({ref:t},p),{},{components:n})):a.createElement(y,o({ref:t},p))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,o=new Array(l);o[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,o[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>c,frontMatter:()=>l,metadata:()=>i,toc:()=>d});var a=n(87462),r=(n(67294),n(3905));const l={},o="mysql",i={unversionedId:"reference/modules/developer-schemas/database/mysql",id:"reference/modules/developer-schemas/database/mysql",title:"mysql",description:"Schema MySQL",source:"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/database/mysql.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/database",slug:"/reference/modules/developer-schemas/database/mysql",permalink:"/docs/next/reference/modules/developer-schemas/database/mysql",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/1-developer-schemas/database/mysql.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"appconfiguration",permalink:"/docs/next/reference/modules/developer-schemas/app-configuration"},next:{title:"postgres",permalink:"/docs/next/reference/modules/developer-schemas/database/postgres"}},s={},d=[{value:"Schema MySQL",id:"schema-mysql",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Credentials and Connectivity",id:"credentials-and-connectivity",level:3}],p={toc:d};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"mysql"},"mysql"),(0,r.kt)("h2",{id:"schema-mysql"},"Schema MySQL"),(0,r.kt)("p",null,"MySQL describes the attributes to locally deploy or create a cloud provider",(0,r.kt)("br",null),"managed mysql database instance for the workload. "),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},'"local"'),(0,r.kt)("td",{parentName:"tr",align:null},'"cloud"'),(0,r.kt)("td",{parentName:"tr",align:null},"Type defines whether the mysql database is deployed locally or provided by",(0,r.kt)("br",null),"cloud vendor.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"version")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Version defines the mysql version to use."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'# Instantiate a local mysql database with version of 5.7. \n\nimport mysql\n\naccessories: {\n "mysql": mysql.MySQL {\n type: "local"\n version: "8.0"\n }\n}\n')),(0,r.kt)("h3",{id:"credentials-and-connectivity"},"Credentials and Connectivity"),(0,r.kt)("p",null,"For sensitive information such as the ",(0,r.kt)("strong",{parentName:"p"},"host"),", ",(0,r.kt)("strong",{parentName:"p"},"username")," and ",(0,r.kt)("strong",{parentName:"p"},"password")," for the database instance, Kusion will automatically inject them into the application container for users through environment variables. The relevant environment variables are listed in the table below. "),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Explanation"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","HOST","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Host address for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","USERNAME","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Account username for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","PASSWORD","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Account password for accessing the database instance")))),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"databaseName")," can be declared in ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/reference/modules/workspace-configs/database/mysql"},"workspace configs of mysql"),", and Kusion will automatically concatenate the ",(0,r.kt)("inlineCode",{parentName:"p"},""),", ",(0,r.kt)("inlineCode",{parentName:"p"},""),", ",(0,r.kt)("inlineCode",{parentName:"p"},"")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"-")," if not specified. When injecting the credentials into containers' environment variables, Kusion will convert the ",(0,r.kt)("inlineCode",{parentName:"p"},"databaseName")," to uppercase, and replace ",(0,r.kt)("inlineCode",{parentName:"p"},"-")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"_"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/b934881b.a099556d.js b/assets/js/b934881b.a099556d.js new file mode 100644 index 00000000000..fecc6d262bb --- /dev/null +++ b/assets/js/b934881b.a099556d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4757],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>u});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),d=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=d(e.components);return a.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),m=d(n),u=r,y=m["".concat(s,".").concat(u)]||m[u]||c[u]||l;return n?a.createElement(y,o(o({ref:t},p),{},{components:n})):a.createElement(y,o({ref:t},p))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,o=new Array(l);o[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,o[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>c,frontMatter:()=>l,metadata:()=>i,toc:()=>d});var a=n(87462),r=(n(67294),n(3905));const l={},o="mysql",i={unversionedId:"reference/modules/developer-schemas/database/mysql",id:"reference/modules/developer-schemas/database/mysql",title:"mysql",description:"Schema MySQL",source:"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/database/mysql.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/database",slug:"/reference/modules/developer-schemas/database/mysql",permalink:"/docs/next/reference/modules/developer-schemas/database/mysql",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/1-developer-schemas/database/mysql.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"appconfiguration",permalink:"/docs/next/reference/modules/developer-schemas/app-configuration"},next:{title:"postgres",permalink:"/docs/next/reference/modules/developer-schemas/database/postgres"}},s={},d=[{value:"Schema MySQL",id:"schema-mysql",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Credentials and Connectivity",id:"credentials-and-connectivity",level:3}],p={toc:d};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"mysql"},"mysql"),(0,r.kt)("h2",{id:"schema-mysql"},"Schema MySQL"),(0,r.kt)("p",null,"MySQL describes the attributes to locally deploy or create a cloud provider",(0,r.kt)("br",null),"managed mysql database instance for the workload. "),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},'"local"'),(0,r.kt)("td",{parentName:"tr",align:null},'"cloud"'),(0,r.kt)("td",{parentName:"tr",align:null},"Type defines whether the mysql database is deployed locally or provided by",(0,r.kt)("br",null),"cloud vendor.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"version")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Version defines the mysql version to use."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'# Instantiate a local mysql database with version of 5.7. \n\nimport mysql\n\naccessories: {\n "mysql": mysql.MySQL {\n type: "local"\n version: "8.0"\n }\n}\n')),(0,r.kt)("h3",{id:"credentials-and-connectivity"},"Credentials and Connectivity"),(0,r.kt)("p",null,"For sensitive information such as the ",(0,r.kt)("strong",{parentName:"p"},"host"),", ",(0,r.kt)("strong",{parentName:"p"},"username")," and ",(0,r.kt)("strong",{parentName:"p"},"password")," for the database instance, Kusion will automatically inject them into the application container for users through environment variables. The relevant environment variables are listed in the table below. "),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Explanation"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","HOST","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Host address for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","USERNAME","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Account username for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","PASSWORD","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Account password for accessing the database instance")))),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"databaseName")," can be declared in ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/reference/modules/workspace-configs/database/mysql"},"workspace configs of mysql"),", and Kusion will automatically concatenate the ",(0,r.kt)("inlineCode",{parentName:"p"},""),", ",(0,r.kt)("inlineCode",{parentName:"p"},""),", ",(0,r.kt)("inlineCode",{parentName:"p"},"")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"-")," if not specified. When injecting the credentials into containers' environment variables, Kusion will convert the ",(0,r.kt)("inlineCode",{parentName:"p"},"databaseName")," to uppercase, and replace ",(0,r.kt)("inlineCode",{parentName:"p"},"-")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"_"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/b9aad1dc.be1a308a.js b/assets/js/b9aad1dc.2dee3bfb.js similarity index 62% rename from assets/js/b9aad1dc.be1a308a.js rename to assets/js/b9aad1dc.2dee3bfb.js index d66002de625..599768511b9 100644 --- a/assets/js/b9aad1dc.be1a308a.js +++ b/assets/js/b9aad1dc.2dee3bfb.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6039],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),d=p(r),m=a,f=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return r?n.createElement(f,l(l({ref:t},c),{},{components:r})):n.createElement(f,l({ref:t},c))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var n=r(87462),a=(r(67294),r(3905));const o={},l="opsrule",i={unversionedId:"reference/modules/workspace-configs/trait/opsrule",id:"version-v0.10/reference/modules/workspace-configs/trait/opsrule",title:"opsrule",description:"opsrule can be used to define workspace-level operational rule configurations.",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/trait/opsrule.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/trait",slug:"/reference/modules/workspace-configs/trait/opsrule",permalink:"/docs/v0.10/reference/modules/workspace-configs/trait/opsrule",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/trait/opsrule.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"port",permalink:"/docs/v0.10/reference/modules/workspace-configs/networking/port"},next:{title:"job",permalink:"/docs/v0.10/reference/modules/workspace-configs/workload/job"}},s={},p=[{value:"Attributes",id:"attributes",level:2},{value:"Examples",id:"examples",level:3}],c={toc:p};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"opsrule"},"opsrule"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"opsrule")," can be used to define workspace-level operational rule configurations."),(0,a.kt)("h2",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"maxUnavailable"),(0,a.kt)("br",null),"The maximum percentage of the total pod instances in the component that can be",(0,a.kt)("br",null),"simultaneously unhealthy."),(0,a.kt)("td",{parentName:"tr",align:null},"int ","|"," str"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n opsRule:\n default:\n maxUnavailable: "40%"\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6039],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),d=p(r),m=a,f=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return r?n.createElement(f,l(l({ref:t},c),{},{components:r})):n.createElement(f,l({ref:t},c))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var n=r(87462),a=(r(67294),r(3905));const o={},l="opsrule",i={unversionedId:"reference/modules/workspace-configs/trait/opsrule",id:"version-v0.10/reference/modules/workspace-configs/trait/opsrule",title:"opsrule",description:"opsrule can be used to define workspace-level operational rule configurations.",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/trait/opsrule.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/trait",slug:"/reference/modules/workspace-configs/trait/opsrule",permalink:"/docs/v0.10/reference/modules/workspace-configs/trait/opsrule",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/trait/opsrule.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"port",permalink:"/docs/v0.10/reference/modules/workspace-configs/networking/port"},next:{title:"job",permalink:"/docs/v0.10/reference/modules/workspace-configs/workload/job"}},s={},p=[{value:"Attributes",id:"attributes",level:2},{value:"Examples",id:"examples",level:3}],c={toc:p};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"opsrule"},"opsrule"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"opsrule")," can be used to define workspace-level operational rule configurations."),(0,a.kt)("h2",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"maxUnavailable"),(0,a.kt)("br",null),"The maximum percentage of the total pod instances in the component that can be",(0,a.kt)("br",null),"simultaneously unhealthy."),(0,a.kt)("td",{parentName:"tr",align:null},"int ","|"," str"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n opsRule:\n default:\n maxUnavailable: "40%"\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/b9b61d04.8d3b8115.js b/assets/js/b9b61d04.8d3b8115.js new file mode 100644 index 00000000000..fdd99e4f6b9 --- /dev/null +++ b/assets/js/b9b61d04.8d3b8115.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4491],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>f});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),l=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},p=function(e){var n=l(e.components);return r.createElement(c.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},d=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=l(t),f=o,m=d["".concat(c,".").concat(f)]||d[f]||u[f]||i;return t?r.createElement(m,a(a({ref:n},p),{},{components:t})):r.createElement(m,a({ref:n},p))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=d;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var l=2;l{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var r=t(87462),o=(t(67294),t(3905));const i={},a="Kusion Modules",s={unversionedId:"reference/modules/index",id:"reference/modules/index",title:"Kusion Modules",description:"KusionStack presets application configuration models described by KCL, where the model is called Kusion Model. The GitHub repository KusionStack/catalog is used to store these models, which is known as Kusion Model Library.",source:"@site/docs/kusion/6-reference/2-modules/index.md",sourceDirName:"6-reference/2-modules",slug:"/reference/modules/",permalink:"/docs/next/reference/modules/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/index.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace",permalink:"/docs/next/reference/commands/kusion-workspace"},next:{title:"appconfiguration",permalink:"/docs/next/reference/modules/developer-schemas/app-configuration"}},c={},l=[],p={toc:l};function u(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-modules"},"Kusion Modules"),(0,o.kt)("p",null,"KusionStack presets application configuration models described by KCL, where the model is called ",(0,o.kt)("strong",{parentName:"p"},"Kusion Model"),". The GitHub repository ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"KusionStack/catalog")," is used to store these models, which is known as ",(0,o.kt)("strong",{parentName:"p"},"Kusion Model Library"),"."),(0,o.kt)("p",null,"The original intention of designing Kusion Model is to enhance the efficiency and improve the experience of YAML users. Through the unified application model defined by code, abstract and encapsulate complex configuration items, omit repetitive and derivable configurations, and supplement with necessary verification logic. Only the necessary attributes get exposed, users get an out-of-the-box, easy-to-understand configuration interface, which reduces the difficulty and improves the reliability of the configuration work."),(0,o.kt)("p",null,"Kusion Model Library currently provides the Kusion Model ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),". The design of ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," is developer-centric, based on Ant Group's decades of practice in building and managing hyperscale IDP (Internal Developer Platform), and the best practice of community. ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," describes the full lifecycle of an application."),(0,o.kt)("p",null,"A simple example of using ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," to describe an application is as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},'wordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "wordpress": c.Container {\n image: "wordpress:latest"\n env: {\n "WORDPRESS_DB_HOST": "secret://wordpress-db/hostAddress"\n "WORDPRESS_DB_PASSWORD": "secret://wordpress-db/password"\n }\n resources: {\n "cpu": "1"\n "memory": "2Gi"\n }\n }\n }\n replicas: 2\n ports: [\n n.Port {\n port: 80\n public: True\n }\n ]\n }\n \n database: db.Database {\n type: "alicloud"\n engine: "MySQL"\n version: "5.7"\n size: 20\n instanceType: "mysql.n2.serverless.1c"\n category: "serverless_basic"\n }\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/b9b61d04.8db21dcd.js b/assets/js/b9b61d04.8db21dcd.js deleted file mode 100644 index ba0781f0b4a..00000000000 --- a/assets/js/b9b61d04.8db21dcd.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4491],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>f});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),l=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},p=function(e){var n=l(e.components);return r.createElement(c.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},d=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=l(t),f=o,m=d["".concat(c,".").concat(f)]||d[f]||u[f]||i;return t?r.createElement(m,a(a({ref:n},p),{},{components:t})):r.createElement(m,a({ref:n},p))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=d;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var l=2;l{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var r=t(87462),o=(t(67294),t(3905));const i={},a="Kusion Modules",s={unversionedId:"reference/modules/index",id:"reference/modules/index",title:"Kusion Modules",description:"KusionStack presets application configuration models described by KCL, where the model is called Kusion Model. The GitHub repository KusionStack/catalog is used to store these models, which is known as Kusion Model Library.",source:"@site/docs/kusion/6-reference/2-modules/index.md",sourceDirName:"6-reference/2-modules",slug:"/reference/modules/",permalink:"/docs/next/reference/modules/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/index.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace",permalink:"/docs/next/reference/commands/kusion-workspace"},next:{title:"appconfiguration",permalink:"/docs/next/reference/modules/developer-schemas/app-configuration"}},c={},l=[],p={toc:l};function u(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-modules"},"Kusion Modules"),(0,o.kt)("p",null,"KusionStack presets application configuration models described by KCL, where the model is called ",(0,o.kt)("strong",{parentName:"p"},"Kusion Model"),". The GitHub repository ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"KusionStack/catalog")," is used to store these models, which is known as ",(0,o.kt)("strong",{parentName:"p"},"Kusion Model Library"),"."),(0,o.kt)("p",null,"The original intention of designing Kusion Model is to enhance the efficiency and improve the experience of YAML users. Through the unified application model defined by code, abstract and encapsulate complex configuration items, omit repetitive and derivable configurations, and supplement with necessary verification logic. Only the necessary attributes get exposed, users get an out-of-the-box, easy-to-understand configuration interface, which reduces the difficulty and improves the reliability of the configuration work."),(0,o.kt)("p",null,"Kusion Model Library currently provides the Kusion Model ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),". The design of ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," is developer-centric, based on Ant Group's decades of practice in building and managing hyperscale IDP (Internal Developer Platform), and the best practice of community. ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," describes the full lifecycle of an application."),(0,o.kt)("p",null,"A simple example of using ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," to describe an application is as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},'wordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "wordpress": c.Container {\n image: "wordpress:latest"\n env: {\n "WORDPRESS_DB_HOST": "secret://wordpress-db/hostAddress"\n "WORDPRESS_DB_PASSWORD": "secret://wordpress-db/password"\n }\n resources: {\n "cpu": "1"\n "memory": "2Gi"\n }\n }\n }\n replicas: 2\n ports: [\n n.Port {\n port: 80\n public: True\n }\n ]\n }\n \n database: db.Database {\n type: "alicloud"\n engine: "MySQL"\n version: "5.7"\n size: 20\n instanceType: "mysql.n2.serverless.1c"\n category: "serverless_basic"\n }\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/baa12f70.015fb44d.js b/assets/js/baa12f70.015fb44d.js new file mode 100644 index 00000000000..9744ea2db39 --- /dev/null +++ b/assets/js/baa12f70.015fb44d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5641],{3905:(e,r,t)=>{t.d(r,{Zo:()=>p,kt:()=>m});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function s(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var l=n.createContext({}),u=function(e){var r=n.useContext(l),t=r;return e&&(t="function"==typeof e?e(r):s(s({},r),e)),t},p=function(e){var r=u(e.components);return n.createElement(l.Provider,{value:r},e.children)},c={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},d=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=u(t),m=o,f=d["".concat(l,".").concat(m)]||d[m]||c[m]||a;return t?n.createElement(f,s(s({ref:r},p),{},{components:t})):n.createElement(f,s({ref:r},p))}));function m(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=t.length,s=new Array(a);s[0]=d;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var u=2;u{t.r(r),t.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>u});var n=t(87462),o=(t(67294),t(3905));const a={},s="Roadmap",i={unversionedId:"reference/roadmap",id:"reference/roadmap",title:"Roadmap",description:"For a finer-grained view into our roadmap and what is being worked on for a release, please refer to the GitHub Issue Tracker",source:"@site/docs/kusion/6-reference/3-roadmap.md",sourceDirName:"6-reference",slug:"/reference/roadmap",permalink:"/docs/next/reference/roadmap",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/3-roadmap.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{},sidebar:"kusion",previous:{title:"Resource Naming Conventions",permalink:"/docs/next/reference/modules/naming-conventions"},next:{title:"Installation",permalink:"/docs/next/faq/install-error"}},l={},u=[{value:"Resource Ecosystem",id:"resource-ecosystem",level:2},{value:"App Progressive Rollout",id:"app-progressive-rollout",level:2},{value:"Custom Pipelines",id:"custom-pipelines",level:2},{value:"Runtime Plugin",id:"runtime-plugin",level:2}],p={toc:u};function c(e){let{components:r,...t}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"roadmap"},"Roadmap"),(0,o.kt)("p",null,"For a finer-grained view into our roadmap and what is being worked on for a release, please refer to the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/issues"},"GitHub Issue Tracker")),(0,o.kt)("h2",{id:"resource-ecosystem"},"Resource Ecosystem"),(0,o.kt)("p",null,"We plan to expand the range of resource types that our platform can handle. This includes not only traditional cloud IaaS resources, but also popular cloud-native products such as Prometheus, istio and Argo. By supporting a wider variety of resources, we aim to address the heterogeneous needs of modern applications and allow users to harness the full power of the cloud-native technologies."),(0,o.kt)("h2",{id:"app-progressive-rollout"},"App Progressive Rollout"),(0,o.kt)("p",null,"One of the key challenges in delivering applications at scale is to balance the need for speed with the need for reliability. To help our users achieve this balance, we will introduce progressive rollout strategies, such as canary release, rolling release, and percentage release. These techniques enable users to test new features or versions on a small subset of their users or infrastructure before rolling them out to the entire system. By doing so, users can minimize the risk of downtime or errors caused by untested changes."),(0,o.kt)("h2",{id:"custom-pipelines"},"Custom Pipelines"),(0,o.kt)("p",null,"Thie current workflow of KusionStack is ",(0,o.kt)("inlineCode",{parentName:"p"},"write"),",",(0,o.kt)("inlineCode",{parentName:"p"},"preview")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"apply"),", but to handle more complex deployments we need to empower users to customize the deployment pipelines to fit their specific workflows and requirements. This includes the ability to define custom stages, add or remove steps, and integrate with third-party tools. With customizable pipelines, users can streamline their deployment process, automate repetitive tasks, and satisfy their own needs by themselves."),(0,o.kt)("h2",{id:"runtime-plugin"},"Runtime Plugin"),(0,o.kt)("p",null,"We have already supported IaaS cloud resources and Kubernetes resources, but we need a more flexible mechanism to support a broader range of on-premise infrastructure. By supporting a diverse set of infrastructures, we can help users avoid vendor lock-in, optimize their resource usage, and scale their applications across different regions and geographies."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/baa12f70.4258b9b2.js b/assets/js/baa12f70.4258b9b2.js deleted file mode 100644 index 8afe908da06..00000000000 --- a/assets/js/baa12f70.4258b9b2.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5641],{3905:(e,r,t)=>{t.d(r,{Zo:()=>p,kt:()=>m});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function s(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var l=n.createContext({}),u=function(e){var r=n.useContext(l),t=r;return e&&(t="function"==typeof e?e(r):s(s({},r),e)),t},p=function(e){var r=u(e.components);return n.createElement(l.Provider,{value:r},e.children)},c={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},d=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=u(t),m=o,f=d["".concat(l,".").concat(m)]||d[m]||c[m]||a;return t?n.createElement(f,s(s({ref:r},p),{},{components:t})):n.createElement(f,s({ref:r},p))}));function m(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=t.length,s=new Array(a);s[0]=d;var i={};for(var l in r)hasOwnProperty.call(r,l)&&(i[l]=r[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var u=2;u{t.r(r),t.d(r,{assets:()=>l,contentTitle:()=>s,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>u});var n=t(87462),o=(t(67294),t(3905));const a={},s="Roadmap",i={unversionedId:"reference/roadmap",id:"reference/roadmap",title:"Roadmap",description:"For a finer-grained view into our roadmap and what is being worked on for a release, please refer to the GitHub Issue Tracker",source:"@site/docs/kusion/6-reference/3-roadmap.md",sourceDirName:"6-reference",slug:"/reference/roadmap",permalink:"/docs/next/reference/roadmap",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/3-roadmap.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{},sidebar:"kusion",previous:{title:"Resource Naming Conventions",permalink:"/docs/next/reference/modules/naming-conventions"},next:{title:"Installation",permalink:"/docs/next/faq/install-error"}},l={},u=[{value:"Resource Ecosystem",id:"resource-ecosystem",level:2},{value:"App Progressive Rollout",id:"app-progressive-rollout",level:2},{value:"Custom Pipelines",id:"custom-pipelines",level:2},{value:"Runtime Plugin",id:"runtime-plugin",level:2}],p={toc:u};function c(e){let{components:r,...t}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"roadmap"},"Roadmap"),(0,o.kt)("p",null,"For a finer-grained view into our roadmap and what is being worked on for a release, please refer to the ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/issues"},"GitHub Issue Tracker")),(0,o.kt)("h2",{id:"resource-ecosystem"},"Resource Ecosystem"),(0,o.kt)("p",null,"We plan to expand the range of resource types that our platform can handle. This includes not only traditional cloud IaaS resources, but also popular cloud-native products such as Prometheus, istio and Argo. By supporting a wider variety of resources, we aim to address the heterogeneous needs of modern applications and allow users to harness the full power of the cloud-native technologies."),(0,o.kt)("h2",{id:"app-progressive-rollout"},"App Progressive Rollout"),(0,o.kt)("p",null,"One of the key challenges in delivering applications at scale is to balance the need for speed with the need for reliability. To help our users achieve this balance, we will introduce progressive rollout strategies, such as canary release, rolling release, and percentage release. These techniques enable users to test new features or versions on a small subset of their users or infrastructure before rolling them out to the entire system. By doing so, users can minimize the risk of downtime or errors caused by untested changes."),(0,o.kt)("h2",{id:"custom-pipelines"},"Custom Pipelines"),(0,o.kt)("p",null,"Thie current workflow of KusionStack is ",(0,o.kt)("inlineCode",{parentName:"p"},"write"),",",(0,o.kt)("inlineCode",{parentName:"p"},"preview")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"apply"),", but to handle more complex deployments we need to empower users to customize the deployment pipelines to fit their specific workflows and requirements. This includes the ability to define custom stages, add or remove steps, and integrate with third-party tools. With customizable pipelines, users can streamline their deployment process, automate repetitive tasks, and satisfy their own needs by themselves."),(0,o.kt)("h2",{id:"runtime-plugin"},"Runtime Plugin"),(0,o.kt)("p",null,"We have already supported IaaS cloud resources and Kubernetes resources, but we need a more flexible mechanism to support a broader range of on-premise infrastructure. By supporting a diverse set of infrastructures, we can help users avoid vendor lock-in, optimize their resource usage, and scale their applications across different regions and geographies."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/bae34ec2.12294e92.js b/assets/js/bae34ec2.12294e92.js new file mode 100644 index 00000000000..17af8e57df7 --- /dev/null +++ b/assets/js/bae34ec2.12294e92.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3066],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),l=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):c(c({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(n),f=o,m=d["".concat(s,".").concat(f)]||d[f]||u[f]||a;return n?r.createElement(m,c(c({ref:t},p),{},{components:n})):r.createElement(m,c({ref:t},p))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,c=new Array(a);c[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,c[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={sidebar_position:1},c="Architecture",i={unversionedId:"concepts/arch",id:"version-v0.9/concepts/arch",title:"Architecture",description:"KusionStack includes two core components:",source:"@site/docs_versioned_docs/version-v0.9/concepts/arch.md",sourceDirName:"concepts",slug:"/concepts/arch",permalink:"/docs/v0.9/concepts/arch",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/concepts/arch.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"kusion",previous:{title:"Concepts",permalink:"/docs/v0.9/concepts/"},next:{title:"Glossary",permalink:"/docs/v0.9/concepts/glossary"}},s={},l=[],p={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"architecture"},"Architecture"),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://raw.githubusercontent.com/KusionStack/kusion/main/docs/workflow.png",alt:null})),(0,o.kt)("p",null,"KusionStack includes two core components:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://github.com/KusionStack/kusion"},"Kusion"),": The engine to deliver intentions to Kubernetes and Clouds"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://github.com/KusionStack/catalog"},"Catalog"),": Catalog of shared Kusion Models and Generators.")),(0,o.kt)("p",null,"The image above illustrates the workflow of KusionStack and how it works. In the next section, we will describe each of these components in detail."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/bae34ec2.c5b53470.js b/assets/js/bae34ec2.c5b53470.js deleted file mode 100644 index a9dfcba66dd..00000000000 --- a/assets/js/bae34ec2.c5b53470.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3066],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),l=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,c=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(n),f=o,m=d["".concat(s,".").concat(f)]||d[f]||u[f]||c;return n?r.createElement(m,a(a({ref:t},p),{},{components:n})):r.createElement(m,a({ref:t},p))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var c=n.length,a=new Array(c);a[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,a[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>a,default:()=>u,frontMatter:()=>c,metadata:()=>i,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const c={sidebar_position:1},a="Architecture",i={unversionedId:"concepts/arch",id:"version-v0.9/concepts/arch",title:"Architecture",description:"KusionStack includes two core components:",source:"@site/docs_versioned_docs/version-v0.9/concepts/arch.md",sourceDirName:"concepts",slug:"/concepts/arch",permalink:"/docs/v0.9/concepts/arch",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/concepts/arch.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"kusion",previous:{title:"Concepts",permalink:"/docs/v0.9/concepts/"},next:{title:"Glossary",permalink:"/docs/v0.9/concepts/glossary"}},s={},l=[],p={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"architecture"},"Architecture"),(0,o.kt)("p",null,(0,o.kt)("img",{parentName:"p",src:"https://raw.githubusercontent.com/KusionStack/kusion/main/docs/workflow.png",alt:null})),(0,o.kt)("p",null,"KusionStack includes two core components:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://github.com/KusionStack/kusion"},"Kusion"),": The engine to deliver intentions to Kubernetes and Clouds"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"https://github.com/KusionStack/catalog"},"Catalog"),": Catalog of shared Kusion Models and Generators.")),(0,o.kt)("p",null,"The image above illustrates the workflow of KusionStack and how it works. In the next section, we will describe each of these components in detail."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/bbb94644.86d079f1.js b/assets/js/bbb94644.86d079f1.js new file mode 100644 index 00000000000..dec26e3ce6e --- /dev/null +++ b/assets/js/bbb94644.86d079f1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4967],{3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>u});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function o(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var i=n.createContext({}),s=function(e){var t=n.useContext(i),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},d=function(e){var t=s(e.components);return n.createElement(i.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,i=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),m=s(a),u=r,k=m["".concat(i,".").concat(u)]||m[u]||c[u]||l;return a?n.createElement(k,o(o({ref:t},d),{},{components:a})):n.createElement(k,o({ref:t},d))}));function u(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,o=new Array(l);o[0]=m;var p={};for(var i in t)hasOwnProperty.call(t,i)&&(p[i]=t[i]);p.originalType=e,p.mdxType="string"==typeof e?e:r,o[1]=p;for(var s=2;s{a.r(t),a.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>c,frontMatter:()=>l,metadata:()=>p,toc:()=>s});var n=a(87462),r=(a(67294),a(3905));const l={},o="probe",p={unversionedId:"reference/modules/developer-schemas/internal/container/probe/probe",id:"version-v0.11/reference/modules/developer-schemas/internal/container/probe/probe",title:"probe",description:"Schema Probe",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/internal/container/probe/probe.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/internal/container/probe",slug:"/reference/modules/developer-schemas/internal/container/probe/",permalink:"/docs/reference/modules/developer-schemas/internal/container/probe/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/internal/container/probe/probe.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"lifecycle",permalink:"/docs/reference/modules/developer-schemas/internal/container/lifecycle/"},next:{title:"secret",permalink:"/docs/reference/modules/developer-schemas/internal/secret/"}},i={},s=[{value:"Schema Probe",id:"schema-probe",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Schema Exec",id:"schema-exec",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3},{value:"Schema Http",id:"schema-http",level:2},{value:"Attributes",id:"attributes-2",level:3},{value:"Examples",id:"examples-2",level:3},{value:"Schema Tcp",id:"schema-tcp",level:2},{value:"Attributes",id:"attributes-3",level:3},{value:"Examples",id:"examples-3",level:3}],d={toc:s};function c(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"probe"},"probe"),(0,r.kt)("h2",{id:"schema-probe"},"Schema Probe"),(0,r.kt)("p",null,"Probe describes a health check to be performed against a container to determine whether it is",(0,r.kt)("br",null),"alive or ready to receive traffic. There are three probe types: readiness, liveness, and startup."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"failureThreshold")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimum consecutive failures for the probe to be considered failed after having succeeded."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"initialDelaySeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"The number of seconds before health checking is activated.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"periodSeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"How often (in seconds) to perform the probe."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"probeHandler")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#exec"},"Exec")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#http"},"Http")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#tcp"},"Tcp"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"successThreshold")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimum consecutive successes for the probe to be considered successful after having failed."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"terminationGracePeriod")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Duration in seconds before terminate gracefully upon probe failure."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"timeoutSeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"The number of seconds after which the probe times out.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container.probe as p\n\nprobe = p.Probe {\n probeHandler: p.Http {\n path: "/healthz"\n }\n initialDelaySeconds: 10\n}\n')),(0,r.kt)("h2",{id:"schema-exec"},"Schema Exec"),(0,r.kt)("p",null,'Exec describes a "run in container" action.'),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"The command line to execute inside the container."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container.probe as p\n\nexecProbe = p.Exec {\n command: ["probe.sh"]\n}\n')),(0,r.kt)("h2",{id:"schema-http"},"Schema Http"),(0,r.kt)("p",null,"Http describes an action based on HTTP Get requests."),(0,r.kt)("h3",{id:"attributes-2"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"headers")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of custom headers to set in the request"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The full qualified url to send HTTP requests."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples-2"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container.probe as p\n\nhttpProbe = p.Http {\n url: "http://localhost:80"\n headers: {\n "X-HEADER": "VALUE"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-tcp"},"Schema Tcp"),(0,r.kt)("p",null,"Tcp describes an action based on opening a socket."),(0,r.kt)("h3",{id:"attributes-3"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The full qualified url to open a socket."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples-3"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container.probe as p\n\ntcpProbe = p.Tcp {\n url: "tcp://localhost:1234"\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/bbb94644.96817887.js b/assets/js/bbb94644.96817887.js deleted file mode 100644 index f4fe32ffed8..00000000000 --- a/assets/js/bbb94644.96817887.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4967],{3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>u});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function o(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},d=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),m=s(a),u=r,k=m["".concat(p,".").concat(u)]||m[u]||c[u]||l;return a?n.createElement(k,o(o({ref:t},d),{},{components:a})):n.createElement(k,o({ref:t},d))}));function u(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,o=new Array(l);o[0]=m;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:r,o[1]=i;for(var s=2;s{a.r(t),a.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>c,frontMatter:()=>l,metadata:()=>i,toc:()=>s});var n=a(87462),r=(a(67294),a(3905));const l={},o="probe",i={unversionedId:"reference/modules/developer-schemas/internal/container/probe/probe",id:"version-v0.11/reference/modules/developer-schemas/internal/container/probe/probe",title:"probe",description:"Schema Probe",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/internal/container/probe/probe.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/internal/container/probe",slug:"/reference/modules/developer-schemas/internal/container/probe/",permalink:"/docs/reference/modules/developer-schemas/internal/container/probe/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/internal/container/probe/probe.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"lifecycle",permalink:"/docs/reference/modules/developer-schemas/internal/container/lifecycle/"},next:{title:"secret",permalink:"/docs/reference/modules/developer-schemas/internal/secret/"}},p={},s=[{value:"Schema Probe",id:"schema-probe",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Schema Exec",id:"schema-exec",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3},{value:"Schema Http",id:"schema-http",level:2},{value:"Attributes",id:"attributes-2",level:3},{value:"Examples",id:"examples-2",level:3},{value:"Schema Tcp",id:"schema-tcp",level:2},{value:"Attributes",id:"attributes-3",level:3},{value:"Examples",id:"examples-3",level:3}],d={toc:s};function c(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"probe"},"probe"),(0,r.kt)("h2",{id:"schema-probe"},"Schema Probe"),(0,r.kt)("p",null,"Probe describes a health check to be performed against a container to determine whether it is",(0,r.kt)("br",null),"alive or ready to receive traffic. There are three probe types: readiness, liveness, and startup."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"failureThreshold")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimum consecutive failures for the probe to be considered failed after having succeeded."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"initialDelaySeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"The number of seconds before health checking is activated.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"periodSeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"How often (in seconds) to perform the probe."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"probeHandler")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#exec"},"Exec")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#http"},"Http")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#tcp"},"Tcp"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"successThreshold")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimum consecutive successes for the probe to be considered successful after having failed."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"terminationGracePeriod")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Duration in seconds before terminate gracefully upon probe failure."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"timeoutSeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"The number of seconds after which the probe times out.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container.probe as p\n\nprobe = p.Probe {\n probeHandler: p.Http {\n path: "/healthz"\n }\n initialDelaySeconds: 10\n}\n')),(0,r.kt)("h2",{id:"schema-exec"},"Schema Exec"),(0,r.kt)("p",null,'Exec describes a "run in container" action.'),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"The command line to execute inside the container."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container.probe as p\n\nexecProbe = p.Exec {\n command: ["probe.sh"]\n}\n')),(0,r.kt)("h2",{id:"schema-http"},"Schema Http"),(0,r.kt)("p",null,"Http describes an action based on HTTP Get requests."),(0,r.kt)("h3",{id:"attributes-2"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"headers")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of custom headers to set in the request"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The full qualified url to send HTTP requests."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples-2"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container.probe as p\n\nhttpProbe = p.Http {\n url: "http://localhost:80"\n headers: {\n "X-HEADER": "VALUE"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-tcp"},"Schema Tcp"),(0,r.kt)("p",null,"Tcp describes an action based on opening a socket."),(0,r.kt)("h3",{id:"attributes-3"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The full qualified url to open a socket."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples-3"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container.probe as p\n\ntcpProbe = p.Tcp {\n url: "tcp://localhost:1234"\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/bc5f1a80.26e6b53e.js b/assets/js/bc5f1a80.bfe53943.js similarity index 50% rename from assets/js/bc5f1a80.26e6b53e.js rename to assets/js/bc5f1a80.bfe53943.js index 25cb3b034bb..55383772043 100644 --- a/assets/js/bc5f1a80.26e6b53e.js +++ b/assets/js/bc5f1a80.bfe53943.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[835],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>u});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),m=p(r),u=o,b=m["".concat(s,".").concat(u)]||m[u]||d[u]||a;return r?n.createElement(b,l(l({ref:t},c),{},{components:r})):n.createElement(b,l({ref:t},c))}));function u(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,l=new Array(a);l[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,l[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>d,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:1},l="Installation",i={unversionedId:"faq/install-error",id:"faq/install-error",title:"Installation",description:"1. Could not find libintl.dylib",source:"@site/docs/kusion/7-faq/1-install-error.md",sourceDirName:"7-faq",slug:"/faq/install-error",permalink:"/docs/next/faq/install-error",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/7-faq/1-install-error.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"kusion",previous:{title:"Roadmap",permalink:"/docs/next/reference/roadmap"},next:{title:"KCL",permalink:"/docs/next/faq/kcl"}},s={},p=[{value:"1. Could not find libintl.dylib",id:"1-could-not-find-libintldylib",level:2},{value:"2. macOS system SSL related errors",id:"2-macos-system-ssl-related-errors",level:2}],c={toc:p};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"installation"},"Installation"),(0,o.kt)("h2",{id:"1-could-not-find-libintldylib"},"1. Could not find ",(0,o.kt)("inlineCode",{parentName:"h2"},"libintl.dylib")),(0,o.kt)("p",null,"This problem is that some tools depends on the ",(0,o.kt)("inlineCode",{parentName:"p"},"Gettext")," library, but macOS does not have this library by default. You can try to solve it in the following ways:"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"(Skip this step for non-macOS m1) For macOS m1 operating system, make sure you have a homebrew arm64e-version installed in /opt/homebrew, otherwise install the arm version of brew with the following command")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"\n# add to path\nexport PATH=/opt/homebrew/bin:$PATH\n')),(0,o.kt)("ol",{start:2},(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"brew install gettext")),(0,o.kt)("li",{parentName:"ol"},"Make sure ",(0,o.kt)("inlineCode",{parentName:"li"},"libintl.8.dylib")," exists in ",(0,o.kt)("inlineCode",{parentName:"li"},"/usr/local/opt/gettext/lib")," directory"),(0,o.kt)("li",{parentName:"ol"},"If brew is installed in another directory, the library can be created by copying it to the corresponding directory")),(0,o.kt)("h2",{id:"2-macos-system-ssl-related-errors"},"2. macOS system SSL related errors"),(0,o.kt)("p",null,"Openssl dylib library not found or SSL module is not available problem"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"(Skip this step for non-macOS m1) For macOS m1 operating system, make sure you have a homebrew arm64e-version installed in /opt/homebrew, otherwise install the arm version of brew with the following command")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"\n# add to path\nexport PATH=/opt/homebrew/bin:$PATH\n')),(0,o.kt)("ol",{start:2},(0,o.kt)("li",{parentName:"ol"},"Install openssl (version 1.1) via brew")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"brew install openssl@1.1\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[835],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>u});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,c=i(e,["components","mdxType","originalType","parentName"]),m=p(r),u=o,b=m["".concat(s,".").concat(u)]||m[u]||d[u]||a;return r?n.createElement(b,l(l({ref:t},c),{},{components:r})):n.createElement(b,l({ref:t},c))}));function u(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,l=new Array(a);l[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,l[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>d,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:1},l="Installation",i={unversionedId:"faq/install-error",id:"faq/install-error",title:"Installation",description:"1. Could not find libintl.dylib",source:"@site/docs/kusion/7-faq/1-install-error.md",sourceDirName:"7-faq",slug:"/faq/install-error",permalink:"/docs/next/faq/install-error",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/7-faq/1-install-error.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"kusion",previous:{title:"Roadmap",permalink:"/docs/next/reference/roadmap"},next:{title:"KCL",permalink:"/docs/next/faq/kcl"}},s={},p=[{value:"1. Could not find libintl.dylib",id:"1-could-not-find-libintldylib",level:2},{value:"2. macOS system SSL related errors",id:"2-macos-system-ssl-related-errors",level:2}],c={toc:p};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"installation"},"Installation"),(0,o.kt)("h2",{id:"1-could-not-find-libintldylib"},"1. Could not find ",(0,o.kt)("inlineCode",{parentName:"h2"},"libintl.dylib")),(0,o.kt)("p",null,"This problem is that some tools depends on the ",(0,o.kt)("inlineCode",{parentName:"p"},"Gettext")," library, but macOS does not have this library by default. You can try to solve it in the following ways:"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"(Skip this step for non-macOS m1) For macOS m1 operating system, make sure you have a homebrew arm64e-version installed in /opt/homebrew, otherwise install the arm version of brew with the following command")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"\n# add to path\nexport PATH=/opt/homebrew/bin:$PATH\n')),(0,o.kt)("ol",{start:2},(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"brew install gettext")),(0,o.kt)("li",{parentName:"ol"},"Make sure ",(0,o.kt)("inlineCode",{parentName:"li"},"libintl.8.dylib")," exists in ",(0,o.kt)("inlineCode",{parentName:"li"},"/usr/local/opt/gettext/lib")," directory"),(0,o.kt)("li",{parentName:"ol"},"If brew is installed in another directory, the library can be created by copying it to the corresponding directory")),(0,o.kt)("h2",{id:"2-macos-system-ssl-related-errors"},"2. macOS system SSL related errors"),(0,o.kt)("p",null,"Openssl dylib library not found or SSL module is not available problem"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"(Skip this step for non-macOS m1) For macOS m1 operating system, make sure you have a homebrew arm64e-version installed in /opt/homebrew, otherwise install the arm version of brew with the following command")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"\n# add to path\nexport PATH=/opt/homebrew/bin:$PATH\n')),(0,o.kt)("ol",{start:2},(0,o.kt)("li",{parentName:"ol"},"Install openssl (version 1.1) via brew")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"brew install openssl@1.1\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/bcb97d3a.6c1fa7b3.js b/assets/js/bcb97d3a.1a45de23.js similarity index 52% rename from assets/js/bcb97d3a.6c1fa7b3.js rename to assets/js/bcb97d3a.1a45de23.js index 1b55d3137f5..866c13f1f15 100644 --- a/assets/js/bcb97d3a.6c1fa7b3.js +++ b/assets/js/bcb97d3a.1a45de23.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[702],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},l=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=s(r),m=o,f=d["".concat(p,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(f,c(c({ref:t},l),{},{components:r})):n.createElement(f,c({ref:t},l))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,c=new Array(a);c[0]=d;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:o,c[1]=i;for(var s=2;s{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>c,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>s});var n=r(87462),o=(r(67294),r(3905));const a={},c="kusion project create",i={unversionedId:"reference/commands/kusion-project-create",id:"reference/commands/kusion-project-create",title:"kusion project create",description:"Create a new project",source:"@site/docs/kusion/6-reference/1-commands/kusion-project-create.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-project-create",permalink:"/docs/next/reference/commands/kusion-project-create",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-project-create.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion preview",permalink:"/docs/next/reference/commands/kusion-preview"},next:{title:"kusion project",permalink:"/docs/next/reference/commands/kusion-project"}},p={},s=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:s};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-project-create"},"kusion project create"),(0,o.kt)("p",null,"Create a new project"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command creates a new project.yaml file under the target directory which by default is the current working directory."),(0,o.kt)("p",null," Note that the target directory needs to be an empty directory."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion project create\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Create a new project with the name of the current working directory\n mkdir my-project && cd my-project\n kusion project create\n \n # Create a new project in a specified target directory\n kusion project create --target /dir/to/projects/my-project\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for create\n -t, --target string specify the target directory\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-project"},"kusion project"),"\t - Project is a folder that contains a project.yaml file and is linked to a Git repository")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[702],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},l=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=s(r),m=o,f=d["".concat(p,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(f,c(c({ref:t},l),{},{components:r})):n.createElement(f,c({ref:t},l))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,c=new Array(a);c[0]=d;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:o,c[1]=i;for(var s=2;s{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>c,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>s});var n=r(87462),o=(r(67294),r(3905));const a={},c="kusion project create",i={unversionedId:"reference/commands/kusion-project-create",id:"reference/commands/kusion-project-create",title:"kusion project create",description:"Create a new project",source:"@site/docs/kusion/6-reference/1-commands/kusion-project-create.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-project-create",permalink:"/docs/next/reference/commands/kusion-project-create",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-project-create.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion preview",permalink:"/docs/next/reference/commands/kusion-preview"},next:{title:"kusion project",permalink:"/docs/next/reference/commands/kusion-project"}},p={},s=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:s};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-project-create"},"kusion project create"),(0,o.kt)("p",null,"Create a new project"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command creates a new project.yaml file under the target directory which by default is the current working directory."),(0,o.kt)("p",null," Note that the target directory needs to be an empty directory."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion project create\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Create a new project with the name of the current working directory\n mkdir my-project && cd my-project\n kusion project create\n \n # Create a new project in a specified target directory\n kusion project create --target /dir/to/projects/my-project\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for create\n -t, --target string specify the target directory\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-project"},"kusion project"),"\t - Project is a folder that contains a project.yaml file and is linked to a Git repository")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/bcd317c5.26419d17.js b/assets/js/bcd317c5.26419d17.js deleted file mode 100644 index 4721b5a60c5..00000000000 --- a/assets/js/bcd317c5.26419d17.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5969],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=o.createContext({}),l=function(e){var t=o.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},p=function(e){var t=l(e.components);return o.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=l(n),f=r,h=d["".concat(c,".").concat(f)]||d[f]||u[f]||i;return n?o.createElement(h,a(a({ref:t},p),{},{components:n})):o.createElement(h,a({ref:t},p))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,a=new Array(i);a[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,a[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var o=n(87462),r=(n(67294),n(3905));const i={id:"spec",sidebar_label:"Spec"},a="Spec",s={unversionedId:"concepts/spec",id:"version-v0.11/concepts/spec",title:"Spec",description:"The Spec represents the operational intentions that you aim to deliver using Kusion. These intentions are expected to contain all components throughout the DevOps lifecycle, including resources (workload, database, load balancer, etc.), dependencies, and policies. The Kusion module generators are responsible for converting all AppConfigurations and environment configurations into the Spec. Once the Spec is generated, the Kusion Engine takes charge of updating the actual infrastructures to match the Spec.",source:"@site/docs_versioned_docs/version-v0.11/3-concepts/6-spec.md",sourceDirName:"3-concepts",slug:"/concepts/spec",permalink:"/docs/concepts/spec",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/3-concepts/6-spec.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:6,frontMatter:{id:"spec",sidebar_label:"Spec"},sidebar:"kusion",previous:{title:"AppConfiguration",permalink:"/docs/concepts/app-configuration"},next:{title:"Backend",permalink:"/docs/concepts/backend"}},c={},l=[{value:"Purpose",id:"purpose",level:2},{value:"Single Source of Truth",id:"single-source-of-truth",level:3},{value:"Consistency",id:"consistency",level:3},{value:"Rollback and Disaster Recovery",id:"rollback-and-disaster-recovery",level:3}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,o.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"spec"},"Spec"),(0,r.kt)("p",null,"The Spec represents the operational intentions that you aim to deliver using Kusion. These intentions are expected to contain all components throughout the DevOps lifecycle, including resources (workload, database, load balancer, etc.), dependencies, and policies. The Kusion module generators are responsible for converting all AppConfigurations and environment configurations into the Spec. Once the Spec is generated, the Kusion Engine takes charge of updating the actual infrastructures to match the Spec."),(0,r.kt)("h2",{id:"purpose"},"Purpose"),(0,r.kt)("h3",{id:"single-source-of-truth"},"Single Source of Truth"),(0,r.kt)("p",null,"In Kusion's workflow, the platform engineer builds Kusion modules and provides environment configurations, application developers choose Kusion modules they need and deploy operational intentions to an environment with related environment configurations. They can also input dynamic parameters like the container image when executing the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion generate")," command. So the final operational intentions include configurations written by application developers, environment configurations and dynamic inputs. Due to this reason, we introduce ",(0,r.kt)("strong",{parentName:"p"},"Spec")," to represent the SSoT(Single Source of Truth) of Kusion. It is the result of ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion generate")," which contains all operational intentions from different sources."),(0,r.kt)("h3",{id:"consistency"},"Consistency"),(0,r.kt)("p",null,"Delivering an application to different environments with identical configurations is a common practice, especially for applications that require scalable distribution. In such cases, an immutable configuration package is helpful. By utilizing the Spec, all configurations and changes are stored in a single file. As the Spec is the input of Kusion, it ensures consistency across different environments whenever you execute Kusion with the same Spec file."),(0,r.kt)("h3",{id:"rollback-and-disaster-recovery"},"Rollback and Disaster Recovery"),(0,r.kt)("p",null,"The ability to roll back is crucial in reducing incident duration. Rolling back the system to a previously validated version is much faster compared to attempting to fix it during an outage. We regard a validated Spec as a snapshot of the system and recommend storing the Spec in a version control system like Git. This enables better change management practices and makes it simpler to roll back to previous versions if needed. In case of a failure or outage, having a validated Spec simplifies the rollback process, ensuring that the system can be quickly recovered."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/bcd317c5.d2f0c1b7.js b/assets/js/bcd317c5.d2f0c1b7.js new file mode 100644 index 00000000000..28011bd28e3 --- /dev/null +++ b/assets/js/bcd317c5.d2f0c1b7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5969],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=o.createContext({}),l=function(e){var t=o.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},p=function(e){var t=l(e.components);return o.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=l(n),f=r,h=d["".concat(c,".").concat(f)]||d[f]||u[f]||i;return n?o.createElement(h,a(a({ref:t},p),{},{components:n})):o.createElement(h,a({ref:t},p))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,a=new Array(i);a[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,a[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var o=n(87462),r=(n(67294),n(3905));const i={id:"spec",sidebar_label:"Spec"},a="Spec",s={unversionedId:"concepts/spec",id:"version-v0.11/concepts/spec",title:"Spec",description:"The Spec represents the operational intentions that you aim to deliver using Kusion. These intentions are expected to contain all components throughout the DevOps lifecycle, including resources (workload, database, load balancer, etc.), dependencies, and policies. The Kusion module generators are responsible for converting all AppConfigurations and environment configurations into the Spec. Once the Spec is generated, the Kusion Engine takes charge of updating the actual infrastructures to match the Spec.",source:"@site/docs_versioned_docs/version-v0.11/3-concepts/6-spec.md",sourceDirName:"3-concepts",slug:"/concepts/spec",permalink:"/docs/concepts/spec",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/3-concepts/6-spec.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:6,frontMatter:{id:"spec",sidebar_label:"Spec"},sidebar:"kusion",previous:{title:"AppConfiguration",permalink:"/docs/concepts/app-configuration"},next:{title:"Backend",permalink:"/docs/concepts/backend"}},c={},l=[{value:"Purpose",id:"purpose",level:2},{value:"Single Source of Truth",id:"single-source-of-truth",level:3},{value:"Consistency",id:"consistency",level:3},{value:"Rollback and Disaster Recovery",id:"rollback-and-disaster-recovery",level:3}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,o.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"spec"},"Spec"),(0,r.kt)("p",null,"The Spec represents the operational intentions that you aim to deliver using Kusion. These intentions are expected to contain all components throughout the DevOps lifecycle, including resources (workload, database, load balancer, etc.), dependencies, and policies. The Kusion module generators are responsible for converting all AppConfigurations and environment configurations into the Spec. Once the Spec is generated, the Kusion Engine takes charge of updating the actual infrastructures to match the Spec."),(0,r.kt)("h2",{id:"purpose"},"Purpose"),(0,r.kt)("h3",{id:"single-source-of-truth"},"Single Source of Truth"),(0,r.kt)("p",null,"In Kusion's workflow, the platform engineer builds Kusion modules and provides environment configurations, application developers choose Kusion modules they need and deploy operational intentions to an environment with related environment configurations. They can also input dynamic parameters like the container image when executing the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion generate")," command. So the final operational intentions include configurations written by application developers, environment configurations and dynamic inputs. Due to this reason, we introduce ",(0,r.kt)("strong",{parentName:"p"},"Spec")," to represent the SSoT(Single Source of Truth) of Kusion. It is the result of ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion generate")," which contains all operational intentions from different sources."),(0,r.kt)("h3",{id:"consistency"},"Consistency"),(0,r.kt)("p",null,"Delivering an application to different environments with identical configurations is a common practice, especially for applications that require scalable distribution. In such cases, an immutable configuration package is helpful. By utilizing the Spec, all configurations and changes are stored in a single file. As the Spec is the input of Kusion, it ensures consistency across different environments whenever you execute Kusion with the same Spec file."),(0,r.kt)("h3",{id:"rollback-and-disaster-recovery"},"Rollback and Disaster Recovery"),(0,r.kt)("p",null,"The ability to roll back is crucial in reducing incident duration. Rolling back the system to a previously validated version is much faster compared to attempting to fix it during an outage. We regard a validated Spec as a snapshot of the system and recommend storing the Spec in a version control system like Git. This enables better change management practices and makes it simpler to roll back to previous versions if needed. In case of a failure or outage, having a validated Spec simplifies the rollback process, ensuring that the system can be quickly recovered."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/bd8a8750.ef84805c.js b/assets/js/bd8a8750.e897ea28.js similarity index 79% rename from assets/js/bd8a8750.ef84805c.js rename to assets/js/bd8a8750.e897ea28.js index 3a0545d8fbf..f230087e94b 100644 --- a/assets/js/bd8a8750.ef84805c.js +++ b/assets/js/bd8a8750.e897ea28.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5633],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var u=r.createContext({}),i=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=i(e.components);return r.createElement(u.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,u=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=i(n),m=a,f=d["".concat(u,".").concat(m)]||d[m]||p[m]||l;return n?r.createElement(f,o(o({ref:t},c),{},{components:n})):r.createElement(f,o({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,o=new Array(l);o[0]=d;var s={};for(var u in t)hasOwnProperty.call(t,u)&&(s[u]=t[u]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var i=2;i{n.d(t,{Z:()=>o});var r=n(67294),a=n(86010);const l="tabItem_Ymn6";function o(e){let{children:t,hidden:n,className:o}=e;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(l,o),hidden:n},t)}},74866:(e,t,n)=>{n.d(t,{Z:()=>O});var r=n(87462),a=n(67294),l=n(86010),o=n(12466),s=n(76775),u=n(91980),i=n(67392),c=n(50012);function p(e){return function(e){var t;return(null==(t=a.Children.map(e,(e=>{if(!e||(0,a.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})))?void 0:t.filter(Boolean))??[]}(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:a}}=e;return{value:t,label:n,attributes:r,default:a}}))}function d(e){const{values:t,children:n}=e;return(0,a.useMemo)((()=>{const e=t??p(n);return function(e){const t=(0,i.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const r=(0,s.k6)(),l=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,u._X)(l),(0,a.useCallback)((e=>{if(!l)return;const t=new URLSearchParams(r.location.search);t.set(l,e),r.replace({...r.location,search:t.toString()})}),[l,r])]}function b(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,l=d(e),[o,s]=(0,a.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:l}))),[u,i]=f({queryString:n,groupId:r}),[p,b]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,l]=(0,c.Nk)(n);return[r,(0,a.useCallback)((e=>{n&&l.set(e)}),[n,l])]}({groupId:r}),g=(()=>{const e=u??p;return m({value:e,tabValues:l})?e:null})();(0,a.useLayoutEffect)((()=>{g&&s(g)}),[g]);return{selectedValue:o,selectValue:(0,a.useCallback)((e=>{if(!m({value:e,tabValues:l}))throw new Error(`Can't select invalid tab value=${e}`);s(e),i(e),b(e)}),[i,b,l]),tabValues:l}}var g=n(72389);const h="tabList__CuJ",v="tabItem_LNqP";function k(e){let{className:t,block:n,selectedValue:s,selectValue:u,tabValues:i}=e;const c=[],{blockElementScrollPositionUntilNextRender:p}=(0,o.o5)(),d=e=>{const t=e.currentTarget,n=c.indexOf(t),r=i[n].value;r!==s&&(p(t),u(r))},m=e=>{var t;let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=c.indexOf(e.currentTarget)+1;n=c[t]??c[0];break}case"ArrowLeft":{const t=c.indexOf(e.currentTarget)-1;n=c[t]??c[c.length-1];break}}null==(t=n)||t.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":n},t)},i.map((e=>{let{value:t,label:n,attributes:o}=e;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,key:t,ref:e=>c.push(e),onKeyDown:m,onClick:d},o,{className:(0,l.Z)("tabs__item",v,null==o?void 0:o.className,{"tabs__item--active":s===t})}),n??t)})))}function y(e){let{lazy:t,children:n,selectedValue:r}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===r));return e?(0,a.cloneElement)(e,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},l.map(((e,t)=>(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==r}))))}function w(e){const t=b(e);return a.createElement("div",{className:(0,l.Z)("tabs-container",h)},a.createElement(k,(0,r.Z)({},e,t)),a.createElement(y,(0,r.Z)({},e,t)))}function O(e){const t=(0,g.Z)();return a.createElement(w,(0,r.Z)({key:String(t)},e))}},50904:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>s,metadata:()=>i,toc:()=>p});var r=n(87462),a=(n(67294),n(3905)),l=n(74866),o=n(85162);const s={sidebar_position:1,sidebar_label:"Install Kusion",id:"install-kusion"},u="Install Kusion",i={unversionedId:"getting-started/install-kusion",id:"version-v0.9/getting-started/install-kusion",title:"Install Kusion",description:"You can install the latest Kusion CLI on MacOS and Linux. Choose the one you prefer from the methods below.",source:"@site/docs_versioned_docs/version-v0.9/getting-started/install-kusion.md",sourceDirName:"getting-started",slug:"/getting-started/install-kusion",permalink:"/docs/v0.9/getting-started/install-kusion",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/getting-started/install-kusion.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1,sidebar_label:"Install Kusion",id:"install-kusion"},sidebar:"kusion",previous:{title:"Get Started",permalink:"/docs/v0.9/getting-started/"},next:{title:"Deliver the WordPress Application on Kubernetes",permalink:"/docs/v0.9/getting-started/deliver-wordpress"}},c={},p=[],d={toc:p};function m(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"install-kusion"},"Install Kusion"),(0,a.kt)("p",null,"You can install the latest Kusion CLI on MacOS and Linux. Choose the one you prefer from the methods below."),(0,a.kt)(l.Z,{mdxType:"Tabs"},(0,a.kt)(o.Z,{value:"Homebrew",mdxType:"TabItem"},(0,a.kt)("p",null,"The recommended method for installing on MacOS and Linux is to use the brew package manager."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Install Kusion")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"brew install KusionStack/tap/kusion\n")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Update Kusion")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"brew upgrade KusionStack/tap/kusion\n")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Uninstall Kusion")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"brew uninstall KusionStack/tap/kusion\n"))),(0,a.kt)(o.Z,{value:"curl | sh",mdxType:"TabItem"},(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Install Kusion")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"curl https://www.kusionstack.io/scripts/install.sh | sh\n")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Uninstall Kusion")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"curl https://www.kusionstack.io/scripts/uninstall.sh | sh\n")))))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5633],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var u=r.createContext({}),i=function(e){var t=r.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=i(e.components);return r.createElement(u.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,u=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=i(n),m=a,f=d["".concat(u,".").concat(m)]||d[m]||p[m]||l;return n?r.createElement(f,o(o({ref:t},c),{},{components:n})):r.createElement(f,o({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,o=new Array(l);o[0]=d;var s={};for(var u in t)hasOwnProperty.call(t,u)&&(s[u]=t[u]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var i=2;i{n.d(t,{Z:()=>o});var r=n(67294),a=n(86010);const l="tabItem_Ymn6";function o(e){let{children:t,hidden:n,className:o}=e;return r.createElement("div",{role:"tabpanel",className:(0,a.Z)(l,o),hidden:n},t)}},74866:(e,t,n)=>{n.d(t,{Z:()=>O});var r=n(87462),a=n(67294),l=n(86010),o=n(12466),s=n(76775),u=n(91980),i=n(67392),c=n(50012);function p(e){return function(e){var t;return(null==(t=a.Children.map(e,(e=>{if(!e||(0,a.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})))?void 0:t.filter(Boolean))??[]}(e).map((e=>{let{props:{value:t,label:n,attributes:r,default:a}}=e;return{value:t,label:n,attributes:r,default:a}}))}function d(e){const{values:t,children:n}=e;return(0,a.useMemo)((()=>{const e=t??p(n);return function(e){const t=(0,i.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function f(e){let{queryString:t=!1,groupId:n}=e;const r=(0,s.k6)(),l=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,u._X)(l),(0,a.useCallback)((e=>{if(!l)return;const t=new URLSearchParams(r.location.search);t.set(l,e),r.replace({...r.location,search:t.toString()})}),[l,r])]}function b(e){const{defaultValue:t,queryString:n=!1,groupId:r}=e,l=d(e),[o,s]=(0,a.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const r=n.find((e=>e.default))??n[0];if(!r)throw new Error("Unexpected error: 0 tabValues");return r.value}({defaultValue:t,tabValues:l}))),[u,i]=f({queryString:n,groupId:r}),[p,b]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[r,l]=(0,c.Nk)(n);return[r,(0,a.useCallback)((e=>{n&&l.set(e)}),[n,l])]}({groupId:r}),g=(()=>{const e=u??p;return m({value:e,tabValues:l})?e:null})();(0,a.useLayoutEffect)((()=>{g&&s(g)}),[g]);return{selectedValue:o,selectValue:(0,a.useCallback)((e=>{if(!m({value:e,tabValues:l}))throw new Error(`Can't select invalid tab value=${e}`);s(e),i(e),b(e)}),[i,b,l]),tabValues:l}}var g=n(72389);const h="tabList__CuJ",v="tabItem_LNqP";function k(e){let{className:t,block:n,selectedValue:s,selectValue:u,tabValues:i}=e;const c=[],{blockElementScrollPositionUntilNextRender:p}=(0,o.o5)(),d=e=>{const t=e.currentTarget,n=c.indexOf(t),r=i[n].value;r!==s&&(p(t),u(r))},m=e=>{var t;let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=c.indexOf(e.currentTarget)+1;n=c[t]??c[0];break}case"ArrowLeft":{const t=c.indexOf(e.currentTarget)-1;n=c[t]??c[c.length-1];break}}null==(t=n)||t.focus()};return a.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,l.Z)("tabs",{"tabs--block":n},t)},i.map((e=>{let{value:t,label:n,attributes:o}=e;return a.createElement("li",(0,r.Z)({role:"tab",tabIndex:s===t?0:-1,"aria-selected":s===t,key:t,ref:e=>c.push(e),onKeyDown:m,onClick:d},o,{className:(0,l.Z)("tabs__item",v,null==o?void 0:o.className,{"tabs__item--active":s===t})}),n??t)})))}function y(e){let{lazy:t,children:n,selectedValue:r}=e;const l=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=l.find((e=>e.props.value===r));return e?(0,a.cloneElement)(e,{className:"margin-top--md"}):null}return a.createElement("div",{className:"margin-top--md"},l.map(((e,t)=>(0,a.cloneElement)(e,{key:t,hidden:e.props.value!==r}))))}function w(e){const t=b(e);return a.createElement("div",{className:(0,l.Z)("tabs-container",h)},a.createElement(k,(0,r.Z)({},e,t)),a.createElement(y,(0,r.Z)({},e,t)))}function O(e){const t=(0,g.Z)();return a.createElement(w,(0,r.Z)({key:String(t)},e))}},50904:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>u,default:()=>m,frontMatter:()=>s,metadata:()=>i,toc:()=>p});var r=n(87462),a=(n(67294),n(3905)),l=n(74866),o=n(85162);const s={sidebar_position:1,sidebar_label:"Install Kusion",id:"install-kusion"},u="Install Kusion",i={unversionedId:"getting-started/install-kusion",id:"version-v0.9/getting-started/install-kusion",title:"Install Kusion",description:"You can install the latest Kusion CLI on MacOS and Linux. Choose the one you prefer from the methods below.",source:"@site/docs_versioned_docs/version-v0.9/getting-started/install-kusion.md",sourceDirName:"getting-started",slug:"/getting-started/install-kusion",permalink:"/docs/v0.9/getting-started/install-kusion",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/getting-started/install-kusion.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1,sidebar_label:"Install Kusion",id:"install-kusion"},sidebar:"kusion",previous:{title:"Get Started",permalink:"/docs/v0.9/getting-started/"},next:{title:"Deliver the WordPress Application on Kubernetes",permalink:"/docs/v0.9/getting-started/deliver-wordpress"}},c={},p=[],d={toc:p};function m(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"install-kusion"},"Install Kusion"),(0,a.kt)("p",null,"You can install the latest Kusion CLI on MacOS and Linux. Choose the one you prefer from the methods below."),(0,a.kt)(l.Z,{mdxType:"Tabs"},(0,a.kt)(o.Z,{value:"Homebrew",mdxType:"TabItem"},(0,a.kt)("p",null,"The recommended method for installing on MacOS and Linux is to use the brew package manager."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Install Kusion")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"brew install KusionStack/tap/kusion\n")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Update Kusion")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"brew upgrade KusionStack/tap/kusion\n")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Uninstall Kusion")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"brew uninstall KusionStack/tap/kusion\n"))),(0,a.kt)(o.Z,{value:"curl | sh",mdxType:"TabItem"},(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Install Kusion")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"curl https://www.kusionstack.io/scripts/install.sh | sh\n")),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},"Uninstall Kusion")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"curl https://www.kusionstack.io/scripts/uninstall.sh | sh\n")))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/befc1215.8ccc048a.js b/assets/js/befc1215.8ccc048a.js deleted file mode 100644 index 8da48eca2b9..00000000000 --- a/assets/js/befc1215.8ccc048a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7334],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),c=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=c(n),m=r,h=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return n?a.createElement(h,i(i({ref:t},p),{},{components:n})):a.createElement(h,i({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var c=2;c{n.d(t,{Z:()=>i});var a=n(67294),r=n(86010);const o="tabItem_Ymn6";function i(e){let{children:t,hidden:n,className:i}=e;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(o,i),hidden:n},t)}},74866:(e,t,n)=>{n.d(t,{Z:()=>N});var a=n(87462),r=n(67294),o=n(86010),i=n(12466),l=n(76775),s=n(91980),c=n(67392),p=n(50012);function u(e){return function(e){var t;return(null==(t=r.Children.map(e,(e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})))?void 0:t.filter(Boolean))??[]}(e).map((e=>{let{props:{value:t,label:n,attributes:a,default:r}}=e;return{value:t,label:n,attributes:a,default:r}}))}function d(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??u(n);return function(e){const t=(0,c.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const a=(0,l.k6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,s._X)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(a.location.search);t.set(o,e),a.replace({...a.location,search:t.toString()})}),[o,a])]}function k(e){const{defaultValue:t,queryString:n=!1,groupId:a}=e,o=d(e),[i,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const a=n.find((e=>e.default))??n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:t,tabValues:o}))),[s,c]=h({queryString:n,groupId:a}),[u,k]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[a,o]=(0,p.Nk)(n);return[a,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:a}),f=(()=>{const e=s??u;return m({value:e,tabValues:o})?e:null})();(0,r.useLayoutEffect)((()=>{f&&l(f)}),[f]);return{selectedValue:i,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),c(e),k(e)}),[c,k,o]),tabValues:o}}var f=n(72389);const v="tabList__CuJ",b="tabItem_LNqP";function g(e){let{className:t,block:n,selectedValue:l,selectValue:s,tabValues:c}=e;const p=[],{blockElementScrollPositionUntilNextRender:u}=(0,i.o5)(),d=e=>{const t=e.currentTarget,n=p.indexOf(t),a=c[n].value;a!==l&&(u(t),s(a))},m=e=>{var t;let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=p.indexOf(e.currentTarget)+1;n=p[t]??p[0];break}case"ArrowLeft":{const t=p.indexOf(e.currentTarget)-1;n=p[t]??p[p.length-1];break}}null==(t=n)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":n},t)},c.map((e=>{let{value:t,label:n,attributes:i}=e;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:l===t?0:-1,"aria-selected":l===t,key:t,ref:e=>p.push(e),onKeyDown:m,onClick:d},i,{className:(0,o.Z)("tabs__item",b,null==i?void 0:i.className,{"tabs__item--active":l===t})}),n??t)})))}function w(e){let{lazy:t,children:n,selectedValue:a}=e;const o=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a}))))}function y(e){const t=k(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",v)},r.createElement(g,(0,a.Z)({},e,t)),r.createElement(w,(0,a.Z)({},e,t)))}function N(e){const t=(0,f.Z)();return r.createElement(y,(0,a.Z)({key:String(t)},e))}},18135:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>m,frontMatter:()=>l,metadata:()=>c,toc:()=>u});var a=n(87462),r=(n(67294),n(3905)),o=n(74866),i=n(85162);const l={id:"expose-service"},s="Expose Application Service Deployed on CSP Kubernetes",c={unversionedId:"user-guides/cloud-resources/expose-service",id:"version-v0.11/user-guides/cloud-resources/expose-service",title:"Expose Application Service Deployed on CSP Kubernetes",description:"Deploying applications on the Kubernetes provided by CSP (Cloud Service Provider) is convenient and reliable, which is adopted by many enterprises. Kusion has a good integration with CSP Kubernetes service. You can deploy your application to the Kubernetes cluster, and expose the service in a quite easy way.",source:"@site/docs_versioned_docs/version-v0.11/5-user-guides/1-cloud-resources/2-expose-service.md",sourceDirName:"5-user-guides/1-cloud-resources",slug:"/user-guides/cloud-resources/expose-service",permalink:"/docs/user-guides/cloud-resources/expose-service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/5-user-guides/1-cloud-resources/2-expose-service.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"expose-service"},sidebar:"kusion",previous:{title:"Deliver the WordPress Application with Cloud RDS",permalink:"/docs/user-guides/cloud-resources/database"},next:{title:"Deploy Application",permalink:"/docs/user-guides/working-with-k8s/deploy-application"}},p={},u=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Expose Service Publicly",id:"expose-service-publicly",level:2},{value:"Set up Workspace",id:"set-up-workspace",level:3},{value:"Init Project",id:"init-project",level:3},{value:"Update And Review Configuration Codes",id:"update-and-review-configuration-codes",level:3},{value:"Preview and Apply",id:"preview-and-apply",level:3},{value:"Verify Accessibility",id:"verify-accessibility",level:3},{value:"Expose Service Inside Cluster",id:"expose-service-inside-cluster",level:2},{value:"Summary",id:"summary",level:2}],d={toc:u};function m(e){let{components:t,...l}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,l,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"expose-application-service-deployed-on-csp-kubernetes"},"Expose Application Service Deployed on CSP Kubernetes"),(0,r.kt)("p",null,"Deploying applications on the Kubernetes provided by CSP (Cloud Service Provider) is convenient and reliable, which is adopted by many enterprises. Kusion has a good integration with CSP Kubernetes service. You can deploy your application to the Kubernetes cluster, and expose the service in a quite easy way. "),(0,r.kt)("p",null,"This tutorial demonstrates how to expose service of the application deployed on CSP Kubernetes. And the responsibilities of platform engineers and application developers are also clearly defined. "),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("p",null,"Create a Kubernetes cluster provided by CSP, and complete the corresponding configurations for ",(0,r.kt)("inlineCode",{parentName:"p"},"KUBECONFIG"),". The following CSP Kubernetes services are supported: "),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://aws.amazon.com/eks"},"Amazon Elastic Kubernetes Service (EKS)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/product/kubernetes"},"Alibaba Cloud Container Service for Kubernetes (ACK)"))),(0,r.kt)("h2",{id:"expose-service-publicly"},"Expose Service Publicly"),(0,r.kt)("p",null,"If you want the application to be accessed from outside the cluster, you should expose the service publicly. Follow the steps below, you will simply hit the goal."),(0,r.kt)("h3",{id:"set-up-workspace"},"Set up Workspace"),(0,r.kt)("p",null,"Create the workspace as the target where the application will be deployed to. The workspace is usually set up by ",(0,r.kt)("strong",{parentName:"p"},"Platform Engineers"),", which contains platform-standard and application-agnostic configurations. The workspace configurations are organized through a YAML file."),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n kusionstack/network@0.1.0: \n default: \n port: \n type: aws\n"))),(0,r.kt)(i.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n kusionstack/network@0.1.0: \n default: \n port: \n type: alicloud\n annotations:\n service.beta.kubernetes.io/alibaba-cloud-loadbalancer-spec: slb.s1.small\n")))),(0,r.kt)("p",null,"The YAML shown above gives an example of the workspace configuration to expose service on ",(0,r.kt)("strong",{parentName:"p"},"EKS")," and ",(0,r.kt)("strong",{parentName:"p"},"ACK"),". The block ",(0,r.kt)("inlineCode",{parentName:"p"},"port")," contains the workspace configuration of Kusion module ",(0,r.kt)("inlineCode",{parentName:"p"},"network"),", which has the following fields:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"type: the CSP providing Kubernetes service, support ",(0,r.kt)("inlineCode",{parentName:"li"},"alicloud")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"aws")),(0,r.kt)("li",{parentName:"ul"},"annotations: annotations attached to the service, should be a map"),(0,r.kt)("li",{parentName:"ul"},"labels: labels attached to the service, should be a map")),(0,r.kt)("p",null,"Then, create the workspace with the configuration file. The following command creates a workspace named ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," with configuration file ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace create dev -f workspace.yaml\n")),(0,r.kt)("p",null,"After that, we can switch to the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace with the following cmd: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace switch dev\n")),(0,r.kt)("p",null,"If you already create and use the configuration of ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace, you can append the MySQL module configs to your workspace YAML file and use the following command line to update the workspace configuration. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace update dev -f workspace.yaml\n")),(0,r.kt)("p",null,"We can use the following command lines to show the current workspace configurations for ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace show\n")),(0,r.kt)("h3",{id:"init-project"},"Init Project"),(0,r.kt)("p",null,"After creating workspace, you should write application configuration code, which only contains simple and application-centric configurations. This step is usually accomplished by application developers."),(0,r.kt)("p",null,"We can start by initializing this tutorial project with ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion init")," cmd: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"# Create a new directory and navigate into it. \nmkdir nginx && cd nginx\n\n# Initialize the demo project with the name of the current directory. \nkusion init\n")),(0,r.kt)("p",null,"The created project structure looks like below: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"tree\n.\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n\n2 directories, 4 files\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about the directory structure can be found in ",(0,r.kt)("a",{parentName:"p",href:"/docs/concepts/project/overview"},"Project")," and ",(0,r.kt)("a",{parentName:"p",href:"/docs/concepts/stack/overview"},"Stack"),". ")),(0,r.kt)("h3",{id:"update-and-review-configuration-codes"},"Update And Review Configuration Codes"),(0,r.kt)("p",null,"The initiated configuration codes are for the demo quickstart application, we should replace the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/kcl.mod")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/main.k")," with the below codes: "),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"dev/kcl.mod")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},'[package]\nname = "nginx"\nversion = "0.1.0"\n\n[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\n\n[profile]\nentries = ["main.k"]\n')),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"dev/main.k")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\n\n# main.k declares customized configurations for dev stacks.\nnginx: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n nginx: c.Container {\n image: "nginx:1.25.2"\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n protocol: "TCP"\n public: True\n }\n ]\n }\n }\n}\n')),(0,r.kt)("p",null,"The code shown above describes how to expose service publicly. Kusion use schema ",(0,r.kt)("inlineCode",{parentName:"p"},"Port")," to describe the network configuration, the primary fields of Port are as follows:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"port: port number to expose service"),(0,r.kt)("li",{parentName:"ul"},"protocol: protocol to expose service, support ",(0,r.kt)("inlineCode",{parentName:"li"},"TCP")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"UDP")),(0,r.kt)("li",{parentName:"ul"},"public: whether to public the service")),(0,r.kt)("p",null,"To public the service, you should set ",(0,r.kt)("inlineCode",{parentName:"p"},"public")," as True. Besides, schema ",(0,r.kt)("inlineCode",{parentName:"p"},"Service")," should be used to describe the workload configuration."),(0,r.kt)("p",null,"That's all what an application developer needs to configure! Next, preview and apply the configuration, the application will get deployed and exposed publicly."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"Kusion uses Load Balancer (LB) provided by the CSP to expose service publicly. For more detailed network configuration, please refer to ",(0,r.kt)("a",{parentName:"p",href:"https://www.kusionstack.io/docs/kusion/configuration-walkthrough/networking"},"Application Networking"))),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"During the first preview and apply, the models and modules as well as the Terraform CLI (if not exists) that the application depends on will be downloaded, so it may take some time (usually within two minutes). You can take a break and have a cup of coffee. ")),(0,r.kt)("h3",{id:"preview-and-apply"},"Preview and Apply"),(0,r.kt)("p",null,"Execute ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion preview")," under the stack path, you will get what will be created in the real infrastructure. The picture below gives the preview result of the example. A Namespace, Service and Deployment will be created, which meets the expectation. The service name has a suffix ",(0,r.kt)("inlineCode",{parentName:"p"},"public"),", which shows it can be accessed publicly."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"preview-public",src:n(85091).Z,width:"1540",height:"262"})),(0,r.kt)("p",null,"Then, execute ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion apply --yes")," to do the real deploying job. Just a command and a few minutes, you have accomplished deploying application and expose it publicly."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply-public",src:n(97932).Z,width:"1558",height:"480"})),(0,r.kt)("h3",{id:"verify-accessibility"},"Verify Accessibility"),(0,r.kt)("p",null,"In the example above, the kubernetes Namespace whose name is nginx, and a ",(0,r.kt)("inlineCode",{parentName:"p"},"Service")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployment")," under the Namespace should be created. Use ",(0,r.kt)("inlineCode",{parentName:"p"},"kubectl get")," to check, the Service whose type is ",(0,r.kt)("inlineCode",{parentName:"p"},"LoadBalancer")," and Deployment are created indeed. And the Service has ",(0,r.kt)("inlineCode",{parentName:"p"},"EXTERNAL-IP")," 106.5.190.109, which means it can be accessed from outside the cluster."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"k8s-resource-public",src:n(68162).Z,width:"1662",height:"216"})),(0,r.kt)("p",null,"Visit the ",(0,r.kt)("inlineCode",{parentName:"p"},"EXTERNAL-IP")," via browser, the correct result is returned, which illustrates the servie getting publicly exposed successfully."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"result-public",src:n(65377).Z,width:"1494",height:"682"})),(0,r.kt)("h2",{id:"expose-service-inside-cluster"},"Expose Service Inside Cluster"),(0,r.kt)("p",null,"If you only need the application to be accessed inside the cluster, just configure ",(0,r.kt)("inlineCode",{parentName:"p"},"Public")," as ",(0,r.kt)("inlineCode",{parentName:"p"},"False")," in schema ",(0,r.kt)("inlineCode",{parentName:"p"},"Port"),". There is no need to change the workspace, which means an application developer can easily change a service exposure range, without the involvement of platform engineers."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\n\n# main.k declares customized configurations for dev stacks.\nnginx: ac.AppConfiguration {\n workload: wl.Service {\n ...\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n protocol: "TCP"\n public: False\n }\n ]\n }\n }\n}\n')),(0,r.kt)("p",null,"Execute ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion apply --yes"),", the generated Service has suffix ",(0,r.kt)("inlineCode",{parentName:"p"},"private"),"."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply-private",src:n(96057).Z,width:"1612",height:"494"})),(0,r.kt)("p",null,"And the Service type is ",(0,r.kt)("inlineCode",{parentName:"p"},"ClusterIP"),", only has ",(0,r.kt)("inlineCode",{parentName:"p"},"CLUSTER_IP")," and no ",(0,r.kt)("inlineCode",{parentName:"p"},"EXTERNAL_IP"),", which means it cannot get accessed from outside the cluster. "),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"k8s-resource-private",src:n(64600).Z,width:"1542",height:"210"})),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"This tutorial demonstrates how to expose service of the application deployed on the CSP Kubernetes. By platform engineers' setup of workspace, and application developers' configuration of schema ",(0,r.kt)("inlineCode",{parentName:"p"},"Port")," of Kusion module ",(0,r.kt)("inlineCode",{parentName:"p"},"network"),", Kusion enables you expose service simply and efficiently."))}m.isMDXComponent=!0},96057:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/apply-private-a1d1f3a1b5afac81cea19f189d08222d.png"},97932:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/apply-public-d89cdb3ba9d96904e1820bfbcf4671d8.png"},64600:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/k8s-resource-private-62ab14b1de35205866b64a0d63180450.png"},68162:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/k8s-resource-public-66ffcb206b33c5fc6f1a779bc10b3e93.png"},85091:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/preview-public-eea90eec123cd2fc13536be2b645e900.png"},65377:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/result-public-4bf3f757b0a43c78464ec9bcd75a4b2f.png"}}]); \ No newline at end of file diff --git a/assets/js/befc1215.8e7340ee.js b/assets/js/befc1215.8e7340ee.js new file mode 100644 index 00000000000..e766e629777 --- /dev/null +++ b/assets/js/befc1215.8e7340ee.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7334],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),c=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=c(n),m=r,h=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return n?a.createElement(h,i(i({ref:t},p),{},{components:n})):a.createElement(h,i({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var c=2;c{n.d(t,{Z:()=>i});var a=n(67294),r=n(86010);const o="tabItem_Ymn6";function i(e){let{children:t,hidden:n,className:i}=e;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(o,i),hidden:n},t)}},74866:(e,t,n)=>{n.d(t,{Z:()=>N});var a=n(87462),r=n(67294),o=n(86010),i=n(12466),l=n(76775),s=n(91980),c=n(67392),p=n(50012);function u(e){return function(e){var t;return(null==(t=r.Children.map(e,(e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})))?void 0:t.filter(Boolean))??[]}(e).map((e=>{let{props:{value:t,label:n,attributes:a,default:r}}=e;return{value:t,label:n,attributes:a,default:r}}))}function d(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??u(n);return function(e){const t=(0,c.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const a=(0,l.k6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,s._X)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(a.location.search);t.set(o,e),a.replace({...a.location,search:t.toString()})}),[o,a])]}function k(e){const{defaultValue:t,queryString:n=!1,groupId:a}=e,o=d(e),[i,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const a=n.find((e=>e.default))??n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:t,tabValues:o}))),[s,c]=h({queryString:n,groupId:a}),[u,k]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[a,o]=(0,p.Nk)(n);return[a,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:a}),f=(()=>{const e=s??u;return m({value:e,tabValues:o})?e:null})();(0,r.useLayoutEffect)((()=>{f&&l(f)}),[f]);return{selectedValue:i,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),c(e),k(e)}),[c,k,o]),tabValues:o}}var f=n(72389);const v="tabList__CuJ",b="tabItem_LNqP";function g(e){let{className:t,block:n,selectedValue:l,selectValue:s,tabValues:c}=e;const p=[],{blockElementScrollPositionUntilNextRender:u}=(0,i.o5)(),d=e=>{const t=e.currentTarget,n=p.indexOf(t),a=c[n].value;a!==l&&(u(t),s(a))},m=e=>{var t;let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=p.indexOf(e.currentTarget)+1;n=p[t]??p[0];break}case"ArrowLeft":{const t=p.indexOf(e.currentTarget)-1;n=p[t]??p[p.length-1];break}}null==(t=n)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":n},t)},c.map((e=>{let{value:t,label:n,attributes:i}=e;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:l===t?0:-1,"aria-selected":l===t,key:t,ref:e=>p.push(e),onKeyDown:m,onClick:d},i,{className:(0,o.Z)("tabs__item",b,null==i?void 0:i.className,{"tabs__item--active":l===t})}),n??t)})))}function w(e){let{lazy:t,children:n,selectedValue:a}=e;const o=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a}))))}function y(e){const t=k(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",v)},r.createElement(g,(0,a.Z)({},e,t)),r.createElement(w,(0,a.Z)({},e,t)))}function N(e){const t=(0,f.Z)();return r.createElement(y,(0,a.Z)({key:String(t)},e))}},18135:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>m,frontMatter:()=>l,metadata:()=>c,toc:()=>u});var a=n(87462),r=(n(67294),n(3905)),o=n(74866),i=n(85162);const l={id:"expose-service"},s="Expose Application Service Deployed on CSP Kubernetes",c={unversionedId:"user-guides/cloud-resources/expose-service",id:"version-v0.11/user-guides/cloud-resources/expose-service",title:"Expose Application Service Deployed on CSP Kubernetes",description:"Deploying applications on the Kubernetes provided by CSP (Cloud Service Provider) is convenient and reliable, which is adopted by many enterprises. Kusion has a good integration with CSP Kubernetes service. You can deploy your application to the Kubernetes cluster, and expose the service in a quite easy way.",source:"@site/docs_versioned_docs/version-v0.11/5-user-guides/1-cloud-resources/2-expose-service.md",sourceDirName:"5-user-guides/1-cloud-resources",slug:"/user-guides/cloud-resources/expose-service",permalink:"/docs/user-guides/cloud-resources/expose-service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/5-user-guides/1-cloud-resources/2-expose-service.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"expose-service"},sidebar:"kusion",previous:{title:"Deliver the WordPress Application with Cloud RDS",permalink:"/docs/user-guides/cloud-resources/database"},next:{title:"Deploy Application",permalink:"/docs/user-guides/working-with-k8s/deploy-application"}},p={},u=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Expose Service Publicly",id:"expose-service-publicly",level:2},{value:"Set up Workspace",id:"set-up-workspace",level:3},{value:"Init Project",id:"init-project",level:3},{value:"Update And Review Configuration Codes",id:"update-and-review-configuration-codes",level:3},{value:"Preview and Apply",id:"preview-and-apply",level:3},{value:"Verify Accessibility",id:"verify-accessibility",level:3},{value:"Expose Service Inside Cluster",id:"expose-service-inside-cluster",level:2},{value:"Summary",id:"summary",level:2}],d={toc:u};function m(e){let{components:t,...l}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,l,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"expose-application-service-deployed-on-csp-kubernetes"},"Expose Application Service Deployed on CSP Kubernetes"),(0,r.kt)("p",null,"Deploying applications on the Kubernetes provided by CSP (Cloud Service Provider) is convenient and reliable, which is adopted by many enterprises. Kusion has a good integration with CSP Kubernetes service. You can deploy your application to the Kubernetes cluster, and expose the service in a quite easy way. "),(0,r.kt)("p",null,"This tutorial demonstrates how to expose service of the application deployed on CSP Kubernetes. And the responsibilities of platform engineers and application developers are also clearly defined. "),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("p",null,"Create a Kubernetes cluster provided by CSP, and complete the corresponding configurations for ",(0,r.kt)("inlineCode",{parentName:"p"},"KUBECONFIG"),". The following CSP Kubernetes services are supported: "),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://aws.amazon.com/eks"},"Amazon Elastic Kubernetes Service (EKS)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/product/kubernetes"},"Alibaba Cloud Container Service for Kubernetes (ACK)"))),(0,r.kt)("h2",{id:"expose-service-publicly"},"Expose Service Publicly"),(0,r.kt)("p",null,"If you want the application to be accessed from outside the cluster, you should expose the service publicly. Follow the steps below, you will simply hit the goal."),(0,r.kt)("h3",{id:"set-up-workspace"},"Set up Workspace"),(0,r.kt)("p",null,"Create the workspace as the target where the application will be deployed to. The workspace is usually set up by ",(0,r.kt)("strong",{parentName:"p"},"Platform Engineers"),", which contains platform-standard and application-agnostic configurations. The workspace configurations are organized through a YAML file."),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n kusionstack/network@0.1.0: \n default: \n port: \n type: aws\n"))),(0,r.kt)(i.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n kusionstack/network@0.1.0: \n default: \n port: \n type: alicloud\n annotations:\n service.beta.kubernetes.io/alibaba-cloud-loadbalancer-spec: slb.s1.small\n")))),(0,r.kt)("p",null,"The YAML shown above gives an example of the workspace configuration to expose service on ",(0,r.kt)("strong",{parentName:"p"},"EKS")," and ",(0,r.kt)("strong",{parentName:"p"},"ACK"),". The block ",(0,r.kt)("inlineCode",{parentName:"p"},"port")," contains the workspace configuration of Kusion module ",(0,r.kt)("inlineCode",{parentName:"p"},"network"),", which has the following fields:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"type: the CSP providing Kubernetes service, support ",(0,r.kt)("inlineCode",{parentName:"li"},"alicloud")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"aws")),(0,r.kt)("li",{parentName:"ul"},"annotations: annotations attached to the service, should be a map"),(0,r.kt)("li",{parentName:"ul"},"labels: labels attached to the service, should be a map")),(0,r.kt)("p",null,"Then, create the workspace with the configuration file. The following command creates a workspace named ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," with configuration file ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace create dev -f workspace.yaml\n")),(0,r.kt)("p",null,"After that, we can switch to the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace with the following cmd: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace switch dev\n")),(0,r.kt)("p",null,"If you already create and use the configuration of ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace, you can append the MySQL module configs to your workspace YAML file and use the following command line to update the workspace configuration. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace update dev -f workspace.yaml\n")),(0,r.kt)("p",null,"We can use the following command lines to show the current workspace configurations for ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace show\n")),(0,r.kt)("h3",{id:"init-project"},"Init Project"),(0,r.kt)("p",null,"After creating workspace, you should write application configuration code, which only contains simple and application-centric configurations. This step is usually accomplished by application developers."),(0,r.kt)("p",null,"We can start by initializing this tutorial project with ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion init")," cmd: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"# Create a new directory and navigate into it. \nmkdir nginx && cd nginx\n\n# Initialize the demo project with the name of the current directory. \nkusion init\n")),(0,r.kt)("p",null,"The created project structure looks like below: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"tree\n.\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n\n2 directories, 4 files\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about the directory structure can be found in ",(0,r.kt)("a",{parentName:"p",href:"/docs/concepts/project/overview"},"Project")," and ",(0,r.kt)("a",{parentName:"p",href:"/docs/concepts/stack/overview"},"Stack"),". ")),(0,r.kt)("h3",{id:"update-and-review-configuration-codes"},"Update And Review Configuration Codes"),(0,r.kt)("p",null,"The initiated configuration codes are for the demo quickstart application, we should replace the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/kcl.mod")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/main.k")," with the below codes: "),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"dev/kcl.mod")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},'[package]\nname = "nginx"\nversion = "0.1.0"\n\n[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\n\n[profile]\nentries = ["main.k"]\n')),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"dev/main.k")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\n\n# main.k declares customized configurations for dev stacks.\nnginx: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n nginx: c.Container {\n image: "nginx:1.25.2"\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n protocol: "TCP"\n public: True\n }\n ]\n }\n }\n}\n')),(0,r.kt)("p",null,"The code shown above describes how to expose service publicly. Kusion use schema ",(0,r.kt)("inlineCode",{parentName:"p"},"Port")," to describe the network configuration, the primary fields of Port are as follows:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"port: port number to expose service"),(0,r.kt)("li",{parentName:"ul"},"protocol: protocol to expose service, support ",(0,r.kt)("inlineCode",{parentName:"li"},"TCP")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"UDP")),(0,r.kt)("li",{parentName:"ul"},"public: whether to public the service")),(0,r.kt)("p",null,"To public the service, you should set ",(0,r.kt)("inlineCode",{parentName:"p"},"public")," as True. Besides, schema ",(0,r.kt)("inlineCode",{parentName:"p"},"Service")," should be used to describe the workload configuration."),(0,r.kt)("p",null,"That's all what an application developer needs to configure! Next, preview and apply the configuration, the application will get deployed and exposed publicly."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"Kusion uses Load Balancer (LB) provided by the CSP to expose service publicly. For more detailed network configuration, please refer to ",(0,r.kt)("a",{parentName:"p",href:"https://www.kusionstack.io/docs/kusion/configuration-walkthrough/networking"},"Application Networking"))),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"During the first preview and apply, the models and modules as well as the Terraform CLI (if not exists) that the application depends on will be downloaded, so it may take some time (usually within two minutes). You can take a break and have a cup of coffee. ")),(0,r.kt)("h3",{id:"preview-and-apply"},"Preview and Apply"),(0,r.kt)("p",null,"Execute ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion preview")," under the stack path, you will get what will be created in the real infrastructure. The picture below gives the preview result of the example. A Namespace, Service and Deployment will be created, which meets the expectation. The service name has a suffix ",(0,r.kt)("inlineCode",{parentName:"p"},"public"),", which shows it can be accessed publicly."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"preview-public",src:n(85091).Z,width:"1540",height:"262"})),(0,r.kt)("p",null,"Then, execute ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion apply --yes")," to do the real deploying job. Just a command and a few minutes, you have accomplished deploying application and expose it publicly."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply-public",src:n(97932).Z,width:"1558",height:"480"})),(0,r.kt)("h3",{id:"verify-accessibility"},"Verify Accessibility"),(0,r.kt)("p",null,"In the example above, the kubernetes Namespace whose name is nginx, and a ",(0,r.kt)("inlineCode",{parentName:"p"},"Service")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployment")," under the Namespace should be created. Use ",(0,r.kt)("inlineCode",{parentName:"p"},"kubectl get")," to check, the Service whose type is ",(0,r.kt)("inlineCode",{parentName:"p"},"LoadBalancer")," and Deployment are created indeed. And the Service has ",(0,r.kt)("inlineCode",{parentName:"p"},"EXTERNAL-IP")," 106.5.190.109, which means it can be accessed from outside the cluster."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"k8s-resource-public",src:n(68162).Z,width:"1662",height:"216"})),(0,r.kt)("p",null,"Visit the ",(0,r.kt)("inlineCode",{parentName:"p"},"EXTERNAL-IP")," via browser, the correct result is returned, which illustrates the servie getting publicly exposed successfully."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"result-public",src:n(65377).Z,width:"1494",height:"682"})),(0,r.kt)("h2",{id:"expose-service-inside-cluster"},"Expose Service Inside Cluster"),(0,r.kt)("p",null,"If you only need the application to be accessed inside the cluster, just configure ",(0,r.kt)("inlineCode",{parentName:"p"},"Public")," as ",(0,r.kt)("inlineCode",{parentName:"p"},"False")," in schema ",(0,r.kt)("inlineCode",{parentName:"p"},"Port"),". There is no need to change the workspace, which means an application developer can easily change a service exposure range, without the involvement of platform engineers."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\n\n# main.k declares customized configurations for dev stacks.\nnginx: ac.AppConfiguration {\n workload: wl.Service {\n ...\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n protocol: "TCP"\n public: False\n }\n ]\n }\n }\n}\n')),(0,r.kt)("p",null,"Execute ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion apply --yes"),", the generated Service has suffix ",(0,r.kt)("inlineCode",{parentName:"p"},"private"),"."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply-private",src:n(96057).Z,width:"1612",height:"494"})),(0,r.kt)("p",null,"And the Service type is ",(0,r.kt)("inlineCode",{parentName:"p"},"ClusterIP"),", only has ",(0,r.kt)("inlineCode",{parentName:"p"},"CLUSTER_IP")," and no ",(0,r.kt)("inlineCode",{parentName:"p"},"EXTERNAL_IP"),", which means it cannot get accessed from outside the cluster. "),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"k8s-resource-private",src:n(64600).Z,width:"1542",height:"210"})),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"This tutorial demonstrates how to expose service of the application deployed on the CSP Kubernetes. By platform engineers' setup of workspace, and application developers' configuration of schema ",(0,r.kt)("inlineCode",{parentName:"p"},"Port")," of Kusion module ",(0,r.kt)("inlineCode",{parentName:"p"},"network"),", Kusion enables you expose service simply and efficiently."))}m.isMDXComponent=!0},96057:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/apply-private-a1d1f3a1b5afac81cea19f189d08222d.png"},97932:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/apply-public-d89cdb3ba9d96904e1820bfbcf4671d8.png"},64600:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/k8s-resource-private-62ab14b1de35205866b64a0d63180450.png"},68162:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/k8s-resource-public-66ffcb206b33c5fc6f1a779bc10b3e93.png"},85091:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/preview-public-eea90eec123cd2fc13536be2b645e900.png"},65377:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/result-public-4bf3f757b0a43c78464ec9bcd75a4b2f.png"}}]); \ No newline at end of file diff --git a/assets/js/bffab106.0b259a05.js b/assets/js/bffab106.0b259a05.js deleted file mode 100644 index 66ce8703b43..00000000000 --- a/assets/js/bffab106.0b259a05.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2777],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(n),f=i,y=d["".concat(l,".").concat(f)]||d[f]||u[f]||o;return n?r.createElement(y,a(a({ref:t},c),{},{components:n})):r.createElement(y,a({ref:t},c))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,a=new Array(o);a[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,a[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var r=n(87462),i=(n(67294),n(3905));const o={},a="kusion apply",s={unversionedId:"reference/cli/kusion/kusion_apply",id:"version-v0.9/reference/cli/kusion/kusion_apply",title:"kusion apply",description:"Apply the operation intents of various resources to multiple runtimes",source:"@site/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_apply.md",sourceDirName:"reference/cli/kusion",slug:"/reference/cli/kusion/kusion_apply",permalink:"/docs/v0.9/reference/cli/kusion/kusion_apply",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_apply.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Kusion Commands",permalink:"/docs/v0.9/reference/cli/kusion/"},next:{title:"kusion build",permalink:"/docs/v0.9/reference/cli/kusion/kusion_build"}},l={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 28-Sep-2023",id:"auto-generated-by-spf13cobra-on-28-sep-2023",level:6}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"kusion-apply"},"kusion apply"),(0,i.kt)("p",null,"Apply the operation intents of various resources to multiple runtimes"),(0,i.kt)("h3",{id:"synopsis"},"Synopsis"),(0,i.kt)("p",null,"Apply a series of resource changes within the stack."),(0,i.kt)("p",null," Create or update or delete resources according to the KCL files within a stack. By default, Kusion will generate an execution plan and present it for your approval before taking any action."),(0,i.kt)("p",null," You can check the plan details and then decide if the actions should be taken or aborted."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"kusion apply [flags]\n")),(0,i.kt)("h3",{id:"examples"},"Examples"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"}," # Apply with specifying work directory\n kusion apply -w /path/to/workdir\n \n # Apply with specifying arguments\n kusion apply -D name=test -D age=18\n \n # Apply with specifying setting file\n kusion apply -Y settings.yaml\n \n # Apply with specifying spec file\n kusion apply --spec-file spec.yaml\n \n # Skip interactive approval of plan details before applying\n kusion apply --yes\n \n # Apply without output style and color\n kusion apply --no-style=true\n")),(0,i.kt)("h3",{id:"options"},"Options"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"}," -a, --all --detail Automatically show all plan details, combined use with flag --detail\n -D, --argument stringToString Specify the top-level argument (default [])\n -C, --backend-config strings backend-config config state storage backend\n --backend-type string backend-type specify state storage backend\n -d, --detail Automatically show plan details with interactive options\n --dry-run Preview the execution effect (always successful) without actually applying the changes\n -h, --help help for apply\n --ignore-fields strings Ignore differences of target fields\n --no-style no-style sets to RawOutput mode and disables all of styling\n --operator string Specify the operator\n -o, --output string Specify the output format\n -O, --overrides strings Specify the configuration override path and value\n -Y, --setting strings Specify the command line setting files\n --spec-file string Specify the spec file path as input, and the spec file must be located in the working directory or its subdirectories\n --watch After creating/updating/deleting the requested object, watch for changes\n -w, --workdir string Specify the work directory\n -y, --yes Automatically approve and perform the update after previewing it\n")),(0,i.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/docs/v0.9/reference/cli/kusion/"},"kusion"),"\t - Kusion is the platform engineering engine of KusionStack")),(0,i.kt)("h6",{id:"auto-generated-by-spf13cobra-on-28-sep-2023"},"Auto generated by spf13/cobra on 28-Sep-2023"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/bffab106.a3eadc7f.js b/assets/js/bffab106.a3eadc7f.js new file mode 100644 index 00000000000..0f80e30c7cb --- /dev/null +++ b/assets/js/bffab106.a3eadc7f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2777],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(n),f=i,y=d["".concat(l,".").concat(f)]||d[f]||u[f]||o;return n?r.createElement(y,a(a({ref:t},c),{},{components:n})):r.createElement(y,a({ref:t},c))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,a=new Array(o);a[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,a[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var r=n(87462),i=(n(67294),n(3905));const o={},a="kusion apply",s={unversionedId:"reference/cli/kusion/kusion_apply",id:"version-v0.9/reference/cli/kusion/kusion_apply",title:"kusion apply",description:"Apply the operation intents of various resources to multiple runtimes",source:"@site/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_apply.md",sourceDirName:"reference/cli/kusion",slug:"/reference/cli/kusion/kusion_apply",permalink:"/docs/v0.9/reference/cli/kusion/kusion_apply",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_apply.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Kusion Commands",permalink:"/docs/v0.9/reference/cli/kusion/"},next:{title:"kusion build",permalink:"/docs/v0.9/reference/cli/kusion/kusion_build"}},l={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 28-Sep-2023",id:"auto-generated-by-spf13cobra-on-28-sep-2023",level:6}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"kusion-apply"},"kusion apply"),(0,i.kt)("p",null,"Apply the operation intents of various resources to multiple runtimes"),(0,i.kt)("h3",{id:"synopsis"},"Synopsis"),(0,i.kt)("p",null,"Apply a series of resource changes within the stack."),(0,i.kt)("p",null," Create or update or delete resources according to the KCL files within a stack. By default, Kusion will generate an execution plan and present it for your approval before taking any action."),(0,i.kt)("p",null," You can check the plan details and then decide if the actions should be taken or aborted."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"kusion apply [flags]\n")),(0,i.kt)("h3",{id:"examples"},"Examples"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"}," # Apply with specifying work directory\n kusion apply -w /path/to/workdir\n \n # Apply with specifying arguments\n kusion apply -D name=test -D age=18\n \n # Apply with specifying setting file\n kusion apply -Y settings.yaml\n \n # Apply with specifying spec file\n kusion apply --spec-file spec.yaml\n \n # Skip interactive approval of plan details before applying\n kusion apply --yes\n \n # Apply without output style and color\n kusion apply --no-style=true\n")),(0,i.kt)("h3",{id:"options"},"Options"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"}," -a, --all --detail Automatically show all plan details, combined use with flag --detail\n -D, --argument stringToString Specify the top-level argument (default [])\n -C, --backend-config strings backend-config config state storage backend\n --backend-type string backend-type specify state storage backend\n -d, --detail Automatically show plan details with interactive options\n --dry-run Preview the execution effect (always successful) without actually applying the changes\n -h, --help help for apply\n --ignore-fields strings Ignore differences of target fields\n --no-style no-style sets to RawOutput mode and disables all of styling\n --operator string Specify the operator\n -o, --output string Specify the output format\n -O, --overrides strings Specify the configuration override path and value\n -Y, --setting strings Specify the command line setting files\n --spec-file string Specify the spec file path as input, and the spec file must be located in the working directory or its subdirectories\n --watch After creating/updating/deleting the requested object, watch for changes\n -w, --workdir string Specify the work directory\n -y, --yes Automatically approve and perform the update after previewing it\n")),(0,i.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/docs/v0.9/reference/cli/kusion/"},"kusion"),"\t - Kusion is the platform engineering engine of KusionStack")),(0,i.kt)("h6",{id:"auto-generated-by-spf13cobra-on-28-sep-2023"},"Auto generated by spf13/cobra on 28-Sep-2023"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c02a675f.48b63c0a.js b/assets/js/c02a675f.48b63c0a.js new file mode 100644 index 00000000000..ecdc5a05e91 --- /dev/null +++ b/assets/js/c02a675f.48b63c0a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[800],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},d=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),c=p(r),m=a,g=c["".concat(i,".").concat(m)]||c[m]||u[m]||l;return r?n.createElement(g,o(o({ref:t},d),{},{components:r})):n.createElement(g,o({ref:t},d))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=c;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var p=2;p{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>u,frontMatter:()=>l,metadata:()=>s,toc:()=>p});var n=r(87462),a=(r(67294),r(3905));const l={},o="postgres",s={unversionedId:"reference/modules/workspace-configs/database/postgres",id:"reference/modules/workspace-configs/database/postgres",title:"postgres",description:"Module PostgreSQL",source:"@site/docs/kusion/6-reference/2-modules/2-workspace-configs/database/postgres.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/database",slug:"/reference/modules/workspace-configs/database/postgres",permalink:"/docs/next/reference/modules/workspace-configs/database/postgres",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/2-workspace-configs/database/postgres.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"mysql",permalink:"/docs/next/reference/modules/workspace-configs/database/mysql"},next:{title:"monitoring",permalink:"/docs/next/reference/modules/workspace-configs/monitoring/prometheus"}},i={},p=[{value:"Module PostgreSQL",id:"module-postgresql",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],d={toc:p};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"postgres"},"postgres"),(0,a.kt)("h2",{id:"module-postgresql"},"Module PostgreSQL"),(0,a.kt)("p",null,"PostgreSQL describes the attributes to locally deploy or create a cloud provider managed postgres database instance for the workload. "),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"cloud"),(0,a.kt)("br",null),"Cloud specifies the type of the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},'"aws" ',"|",' "alicloud"'),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"username"),(0,a.kt)("br",null),"Username specifies the operation account for the postgres database."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},'"root"'),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"category"),(0,a.kt)("br",null),"Category specifies the edition of the postgres instance provided by the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},'"Basic"'),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"securityIPs"),(0,a.kt)("br",null),"SecurityIPs specifies the list of IP addresses allowed to access the postgres instance provided by the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},"[str]"),(0,a.kt)("td",{parentName:"tr",align:null},'["0.0.0.0/0"]'),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"privateRouting"),(0,a.kt)("br",null),"PrivateRouting specifies whether the host address of the cloud postgres instance for the workload to connect with is via public network or private network of the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},"bool"),(0,a.kt)("td",{parentName:"tr",align:null},"true"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"size"),(0,a.kt)("br",null),"Size specifies the allocated storage size of the postgres instance."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"10"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"subnetID"),(0,a.kt)("br",null),"SubnetID specifies the virtual subnet ID associated with the VPC that the cloud postgres instance will be created in."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"databaseName"),(0,a.kt)("br",null),"databaseName specifies the database name."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'# PostgreSQL workspace configs for AWS RDS\nmodules: \n kusionstack@postgres@0.1.0: \n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n securityIPs: \n - 0.0.0.0/0\n databaseName: "my-postgres"\n')),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'# PostgreSQL workspace configs for Alicloud RDS\nmodules: \n kusionstack@postgres@0.1.0:\n default:\n cloud: alicloud\n size: 20\n instanceType: pg.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n securityIPs: \n - 0.0.0.0/0\n databaseName: "my-postgres"\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c02a675f.e722c66a.js b/assets/js/c02a675f.e722c66a.js deleted file mode 100644 index 1d9a7bde476..00000000000 --- a/assets/js/c02a675f.e722c66a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[800],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},d=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),c=p(r),m=a,g=c["".concat(i,".").concat(m)]||c[m]||u[m]||l;return r?n.createElement(g,o(o({ref:t},d),{},{components:r})):n.createElement(g,o({ref:t},d))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=c;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var p=2;p{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>u,frontMatter:()=>l,metadata:()=>s,toc:()=>p});var n=r(87462),a=(r(67294),r(3905));const l={},o="postgres",s={unversionedId:"reference/modules/workspace-configs/database/postgres",id:"reference/modules/workspace-configs/database/postgres",title:"postgres",description:"Module PostgreSQL",source:"@site/docs/kusion/6-reference/2-modules/2-workspace-configs/database/postgres.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/database",slug:"/reference/modules/workspace-configs/database/postgres",permalink:"/docs/next/reference/modules/workspace-configs/database/postgres",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/2-workspace-configs/database/postgres.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"mysql",permalink:"/docs/next/reference/modules/workspace-configs/database/mysql"},next:{title:"monitoring",permalink:"/docs/next/reference/modules/workspace-configs/monitoring/prometheus"}},i={},p=[{value:"Module PostgreSQL",id:"module-postgresql",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],d={toc:p};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"postgres"},"postgres"),(0,a.kt)("h2",{id:"module-postgresql"},"Module PostgreSQL"),(0,a.kt)("p",null,"PostgreSQL describes the attributes to locally deploy or create a cloud provider managed postgres database instance for the workload. "),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"cloud"),(0,a.kt)("br",null),"Cloud specifies the type of the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},'"aws" ',"|",' "alicloud"'),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"username"),(0,a.kt)("br",null),"Username specifies the operation account for the postgres database."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},'"root"'),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"category"),(0,a.kt)("br",null),"Category specifies the edition of the postgres instance provided by the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},'"Basic"'),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"securityIPs"),(0,a.kt)("br",null),"SecurityIPs specifies the list of IP addresses allowed to access the postgres instance provided by the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},"[str]"),(0,a.kt)("td",{parentName:"tr",align:null},'["0.0.0.0/0"]'),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"privateRouting"),(0,a.kt)("br",null),"PrivateRouting specifies whether the host address of the cloud postgres instance for the workload to connect with is via public network or private network of the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},"bool"),(0,a.kt)("td",{parentName:"tr",align:null},"true"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"size"),(0,a.kt)("br",null),"Size specifies the allocated storage size of the postgres instance."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"10"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"subnetID"),(0,a.kt)("br",null),"SubnetID specifies the virtual subnet ID associated with the VPC that the cloud postgres instance will be created in."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"databaseName"),(0,a.kt)("br",null),"databaseName specifies the database name."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'# PostgreSQL workspace configs for AWS RDS\nmodules: \n kusionstack@postgres@0.1.0: \n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n securityIPs: \n - 0.0.0.0/0\n databaseName: "my-postgres"\n')),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'# PostgreSQL workspace configs for Alicloud RDS\nmodules: \n kusionstack@postgres@0.1.0:\n default:\n cloud: alicloud\n size: 20\n instanceType: pg.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n securityIPs: \n - 0.0.0.0/0\n databaseName: "my-postgres"\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c09b0fe7.5e5f6711.js b/assets/js/c09b0fe7.5e5f6711.js new file mode 100644 index 00000000000..e11b5001650 --- /dev/null +++ b/assets/js/c09b0fe7.5e5f6711.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1813],{3905:(e,r,t)=>{t.d(r,{Zo:()=>l,kt:()=>f});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function c(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var i=n.createContext({}),p=function(e){var r=n.useContext(i),t=r;return e&&(t="function"==typeof e?e(r):c(c({},r),e)),t},l=function(e){var r=p(e.components);return n.createElement(i.Provider,{value:r},e.children)},u={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},d=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),d=p(t),f=o,m=d["".concat(i,".").concat(f)]||d[f]||u[f]||a;return t?n.createElement(m,c(c({ref:r},l),{},{components:t})):n.createElement(m,c({ref:r},l))}));function f(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=t.length,c=new Array(a);c[0]=d;var s={};for(var i in r)hasOwnProperty.call(r,i)&&(s[i]=r[i]);s.originalType=e,s.mdxType="string"==typeof e?e:o,c[1]=s;for(var p=2;p{t.r(r),t.d(r,{assets:()=>i,contentTitle:()=>c,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=t(87462),o=(t(67294),t(3905));const a={},c="kusion workspace create",s={unversionedId:"reference/commands/kusion-workspace-create",id:"reference/commands/kusion-workspace-create",title:"kusion workspace create",description:"Create a new workspace",source:"@site/docs/kusion/6-reference/1-commands/kusion-workspace-create.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-create",permalink:"/docs/next/reference/commands/kusion-workspace-create",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-workspace-create.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion version",permalink:"/docs/next/reference/commands/kusion-version"},next:{title:"kusion workspace delete",permalink:"/docs/next/reference/commands/kusion-workspace-delete"}},i={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:r,...t}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-create"},"kusion workspace create"),(0,o.kt)("p",null,"Create a new workspace"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command creates a workspace with specified name and configuration file, where the file must be in the YAML format."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace create\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Create a workspace\n kusion workspace create dev -f dev.yaml\n \n # Create a workspace and set as current\n kusion workspace create dev -f dev.yaml --current\n \n # Create a workspace in a specified backend\n kusion workspace create prod -f prod.yaml --backend oss-prod\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string the backend name\n --current set the creating workspace as current\n -f, --file string the path of workspace configuration file\n -h, --help help for create\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c09b0fe7.b7002711.js b/assets/js/c09b0fe7.b7002711.js deleted file mode 100644 index eb24e616b73..00000000000 --- a/assets/js/c09b0fe7.b7002711.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1813],{3905:(e,r,t)=>{t.d(r,{Zo:()=>l,kt:()=>m});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function c(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var i=n.createContext({}),p=function(e){var r=n.useContext(i),t=r;return e&&(t="function"==typeof e?e(r):c(c({},r),e)),t},l=function(e){var r=p(e.components);return n.createElement(i.Provider,{value:r},e.children)},u={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},d=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),d=p(t),m=o,f=d["".concat(i,".").concat(m)]||d[m]||u[m]||a;return t?n.createElement(f,c(c({ref:r},l),{},{components:t})):n.createElement(f,c({ref:r},l))}));function m(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=t.length,c=new Array(a);c[0]=d;var s={};for(var i in r)hasOwnProperty.call(r,i)&&(s[i]=r[i]);s.originalType=e,s.mdxType="string"==typeof e?e:o,c[1]=s;for(var p=2;p{t.r(r),t.d(r,{assets:()=>i,contentTitle:()=>c,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=t(87462),o=(t(67294),t(3905));const a={},c="kusion workspace create",s={unversionedId:"reference/commands/kusion-workspace-create",id:"reference/commands/kusion-workspace-create",title:"kusion workspace create",description:"Create a new workspace",source:"@site/docs/kusion/6-reference/1-commands/kusion-workspace-create.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-create",permalink:"/docs/next/reference/commands/kusion-workspace-create",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-workspace-create.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion version",permalink:"/docs/next/reference/commands/kusion-version"},next:{title:"kusion workspace delete",permalink:"/docs/next/reference/commands/kusion-workspace-delete"}},i={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:r,...t}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-create"},"kusion workspace create"),(0,o.kt)("p",null,"Create a new workspace"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command creates a workspace with specified name and configuration file, where the file must be in the YAML format."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace create\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Create a workspace\n kusion workspace create dev -f dev.yaml\n \n # Create a workspace and set as current\n kusion workspace create dev -f dev.yaml --current\n \n # Create a workspace in a specified backend\n kusion workspace create prod -f prod.yaml --backend oss-prod\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string the backend name\n --current set the creating workspace as current\n -f, --file string the path of workspace configuration file\n -h, --help help for create\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c1bf8f22.9f9467fb.js b/assets/js/c1bf8f22.9f9467fb.js deleted file mode 100644 index 1607052c699..00000000000 --- a/assets/js/c1bf8f22.9f9467fb.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2347],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),c=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=c(n),m=r,h=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return n?a.createElement(h,i(i({ref:t},p),{},{components:n})):a.createElement(h,i({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var c=2;c{n.d(t,{Z:()=>i});var a=n(67294),r=n(86010);const o="tabItem_Ymn6";function i(e){let{children:t,hidden:n,className:i}=e;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(o,i),hidden:n},t)}},74866:(e,t,n)=>{n.d(t,{Z:()=>N});var a=n(87462),r=n(67294),o=n(86010),i=n(12466),l=n(76775),s=n(91980),c=n(67392),p=n(50012);function u(e){return function(e){var t;return(null==(t=r.Children.map(e,(e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})))?void 0:t.filter(Boolean))??[]}(e).map((e=>{let{props:{value:t,label:n,attributes:a,default:r}}=e;return{value:t,label:n,attributes:a,default:r}}))}function d(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??u(n);return function(e){const t=(0,c.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const a=(0,l.k6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,s._X)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(a.location.search);t.set(o,e),a.replace({...a.location,search:t.toString()})}),[o,a])]}function k(e){const{defaultValue:t,queryString:n=!1,groupId:a}=e,o=d(e),[i,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const a=n.find((e=>e.default))??n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:t,tabValues:o}))),[s,c]=h({queryString:n,groupId:a}),[u,k]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[a,o]=(0,p.Nk)(n);return[a,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:a}),f=(()=>{const e=s??u;return m({value:e,tabValues:o})?e:null})();(0,r.useLayoutEffect)((()=>{f&&l(f)}),[f]);return{selectedValue:i,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),c(e),k(e)}),[c,k,o]),tabValues:o}}var f=n(72389);const b="tabList__CuJ",v="tabItem_LNqP";function g(e){let{className:t,block:n,selectedValue:l,selectValue:s,tabValues:c}=e;const p=[],{blockElementScrollPositionUntilNextRender:u}=(0,i.o5)(),d=e=>{const t=e.currentTarget,n=p.indexOf(t),a=c[n].value;a!==l&&(u(t),s(a))},m=e=>{var t;let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=p.indexOf(e.currentTarget)+1;n=p[t]??p[0];break}case"ArrowLeft":{const t=p.indexOf(e.currentTarget)-1;n=p[t]??p[p.length-1];break}}null==(t=n)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":n},t)},c.map((e=>{let{value:t,label:n,attributes:i}=e;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:l===t?0:-1,"aria-selected":l===t,key:t,ref:e=>p.push(e),onKeyDown:m,onClick:d},i,{className:(0,o.Z)("tabs__item",v,null==i?void 0:i.className,{"tabs__item--active":l===t})}),n??t)})))}function w(e){let{lazy:t,children:n,selectedValue:a}=e;const o=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a}))))}function y(e){const t=k(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",b)},r.createElement(g,(0,a.Z)({},e,t)),r.createElement(w,(0,a.Z)({},e,t)))}function N(e){const t=(0,f.Z)();return r.createElement(y,(0,a.Z)({key:String(t)},e))}},90200:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>m,frontMatter:()=>l,metadata:()=>c,toc:()=>u});var a=n(87462),r=(n(67294),n(3905)),o=n(74866),i=n(85162);const l={id:"expose-service"},s="Expose Application Service Deployed on CSP Kubernetes",c={unversionedId:"user-guides/cloud-resources/expose-service",id:"user-guides/cloud-resources/expose-service",title:"Expose Application Service Deployed on CSP Kubernetes",description:"Deploying applications on the Kubernetes provided by CSP (Cloud Service Provider) is convenient and reliable, which is adopted by many enterprises. Kusion has a good integration with CSP Kubernetes service. You can deploy your application to the Kubernetes cluster, and expose the service in a quite easy way.",source:"@site/docs/kusion/5-user-guides/1-cloud-resources/2-expose-service.md",sourceDirName:"5-user-guides/1-cloud-resources",slug:"/user-guides/cloud-resources/expose-service",permalink:"/docs/next/user-guides/cloud-resources/expose-service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/5-user-guides/1-cloud-resources/2-expose-service.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"expose-service"},sidebar:"kusion",previous:{title:"Deliver the WordPress Application with Cloud RDS",permalink:"/docs/next/user-guides/cloud-resources/database"},next:{title:"Deploy Application",permalink:"/docs/next/user-guides/working-with-k8s/deploy-application"}},p={},u=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Expose Service Publicly",id:"expose-service-publicly",level:2},{value:"Set up Workspace",id:"set-up-workspace",level:3},{value:"Init Project",id:"init-project",level:3},{value:"Update And Review Configuration Codes",id:"update-and-review-configuration-codes",level:3},{value:"Preview and Apply",id:"preview-and-apply",level:3},{value:"Verify Accessibility",id:"verify-accessibility",level:3},{value:"Expose Service Inside Cluster",id:"expose-service-inside-cluster",level:2},{value:"Summary",id:"summary",level:2}],d={toc:u};function m(e){let{components:t,...l}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,l,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"expose-application-service-deployed-on-csp-kubernetes"},"Expose Application Service Deployed on CSP Kubernetes"),(0,r.kt)("p",null,"Deploying applications on the Kubernetes provided by CSP (Cloud Service Provider) is convenient and reliable, which is adopted by many enterprises. Kusion has a good integration with CSP Kubernetes service. You can deploy your application to the Kubernetes cluster, and expose the service in a quite easy way. "),(0,r.kt)("p",null,"This tutorial demonstrates how to expose service of the application deployed on CSP Kubernetes. And the responsibilities of platform engineers and application developers are also clearly defined. "),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("p",null,"Create a Kubernetes cluster provided by CSP, and complete the corresponding configurations for ",(0,r.kt)("inlineCode",{parentName:"p"},"KUBECONFIG"),". The following CSP Kubernetes services are supported: "),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://aws.amazon.com/eks"},"Amazon Elastic Kubernetes Service (EKS)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/product/kubernetes"},"Alibaba Cloud Container Service for Kubernetes (ACK)"))),(0,r.kt)("h2",{id:"expose-service-publicly"},"Expose Service Publicly"),(0,r.kt)("p",null,"If you want the application to be accessed from outside the cluster, you should expose the service publicly. Follow the steps below, you will simply hit the goal."),(0,r.kt)("h3",{id:"set-up-workspace"},"Set up Workspace"),(0,r.kt)("p",null,"Create the workspace as the target where the application will be deployed to. The workspace is usually set up by ",(0,r.kt)("strong",{parentName:"p"},"Platform Engineers"),", which contains platform-standard and application-agnostic configurations. The workspace configurations are organized through a YAML file."),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n kusionstack/network@0.1.0: \n default: \n port: \n type: aws\n"))),(0,r.kt)(i.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n kusionstack/network@0.1.0: \n default: \n port: \n type: alicloud\n annotations:\n service.beta.kubernetes.io/alibaba-cloud-loadbalancer-spec: slb.s1.small\n")))),(0,r.kt)("p",null,"The YAML shown above gives an example of the workspace configuration to expose service on ",(0,r.kt)("strong",{parentName:"p"},"EKS")," and ",(0,r.kt)("strong",{parentName:"p"},"ACK"),". The block ",(0,r.kt)("inlineCode",{parentName:"p"},"port")," contains the workspace configuration of Kusion module ",(0,r.kt)("inlineCode",{parentName:"p"},"network"),", which has the following fields:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"type: the CSP providing Kubernetes service, support ",(0,r.kt)("inlineCode",{parentName:"li"},"alicloud")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"aws")),(0,r.kt)("li",{parentName:"ul"},"annotations: annotations attached to the service, should be a map"),(0,r.kt)("li",{parentName:"ul"},"labels: labels attached to the service, should be a map")),(0,r.kt)("p",null,"Then, create the workspace with the configuration file. The following command creates a workspace named ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," with configuration file ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace create dev -f workspace.yaml\n")),(0,r.kt)("p",null,"After that, we can switch to the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace with the following cmd: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace switch dev\n")),(0,r.kt)("p",null,"If you already create and use the configuration of ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace, you can append the MySQL module configs to your workspace YAML file and use the following command line to update the workspace configuration. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace update dev -f workspace.yaml\n")),(0,r.kt)("p",null,"We can use the following command lines to show the current workspace configurations for ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace show\n")),(0,r.kt)("h3",{id:"init-project"},"Init Project"),(0,r.kt)("p",null,"After creating workspace, you should write application configuration code, which only contains simple and application-centric configurations. This step is usually accomplished by application developers."),(0,r.kt)("p",null,"We can start by initializing this tutorial project with ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion init")," cmd: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"# Create a new directory and navigate into it. \nmkdir nginx && cd nginx\n\n# Initialize the demo project with the name of the current directory. \nkusion init\n")),(0,r.kt)("p",null,"The created project structure looks like below: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"tree\n.\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n\n2 directories, 4 files\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about the directory structure can be found in ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/concepts/project/overview"},"Project")," and ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/concepts/stack/overview"},"Stack"),". ")),(0,r.kt)("h3",{id:"update-and-review-configuration-codes"},"Update And Review Configuration Codes"),(0,r.kt)("p",null,"The initiated configuration codes are for the demo quickstart application, we should replace the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/kcl.mod")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/main.k")," with the below codes: "),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"dev/kcl.mod")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},'[package]\nname = "nginx"\nversion = "0.1.0"\n\n[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\n\n[profile]\nentries = ["main.k"]\n')),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"dev/main.k")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\n\n# main.k declares customized configurations for dev stacks.\nnginx: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n nginx: c.Container {\n image: "nginx:1.25.2"\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n protocol: "TCP"\n public: True\n }\n ]\n }\n }\n}\n')),(0,r.kt)("p",null,"The code shown above describes how to expose service publicly. Kusion use schema ",(0,r.kt)("inlineCode",{parentName:"p"},"Port")," to describe the network configuration, the primary fields of Port are as follows:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"port: port number to expose service"),(0,r.kt)("li",{parentName:"ul"},"protocol: protocol to expose service, support ",(0,r.kt)("inlineCode",{parentName:"li"},"TCP")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"UDP")),(0,r.kt)("li",{parentName:"ul"},"public: whether to public the service")),(0,r.kt)("p",null,"To public the service, you should set ",(0,r.kt)("inlineCode",{parentName:"p"},"public")," as True. Besides, schema ",(0,r.kt)("inlineCode",{parentName:"p"},"Service")," should be used to describe the workload configuration."),(0,r.kt)("p",null,"That's all what an application developer needs to configure! Next, preview and apply the configuration, the application will get deployed and exposed publicly."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"Kusion uses Load Balancer (LB) provided by the CSP to expose service publicly. For more detailed network configuration, please refer to ",(0,r.kt)("a",{parentName:"p",href:"https://www.kusionstack.io/docs/kusion/configuration-walkthrough/networking"},"Application Networking"))),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"During the first preview and apply, the models and modules as well as the Terraform CLI (if not exists) that the application depends on will be downloaded, so it may take some time (usually within two minutes). You can take a break and have a cup of coffee. ")),(0,r.kt)("h3",{id:"preview-and-apply"},"Preview and Apply"),(0,r.kt)("p",null,"Execute ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion preview")," under the stack path, you will get what will be created in the real infrastructure. The picture below gives the preview result of the example. A Namespace, Service and Deployment will be created, which meets the expectation. The service name has a suffix ",(0,r.kt)("inlineCode",{parentName:"p"},"public"),", which shows it can be accessed publicly."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"preview-public",src:n(85091).Z,width:"1540",height:"262"})),(0,r.kt)("p",null,"Then, execute ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion apply --yes")," to do the real deploying job. Just a command and a few minutes, you have accomplished deploying application and expose it publicly."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply-public",src:n(97932).Z,width:"1558",height:"480"})),(0,r.kt)("h3",{id:"verify-accessibility"},"Verify Accessibility"),(0,r.kt)("p",null,"In the example above, the kubernetes Namespace whose name is nginx, and a ",(0,r.kt)("inlineCode",{parentName:"p"},"Service")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployment")," under the Namespace should be created. Use ",(0,r.kt)("inlineCode",{parentName:"p"},"kubectl get")," to check, the Service whose type is ",(0,r.kt)("inlineCode",{parentName:"p"},"LoadBalancer")," and Deployment are created indeed. And the Service has ",(0,r.kt)("inlineCode",{parentName:"p"},"EXTERNAL-IP")," 106.5.190.109, which means it can be accessed from outside the cluster."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"k8s-resource-public",src:n(68162).Z,width:"1662",height:"216"})),(0,r.kt)("p",null,"Visit the ",(0,r.kt)("inlineCode",{parentName:"p"},"EXTERNAL-IP")," via browser, the correct result is returned, which illustrates the servie getting publicly exposed successfully."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"result-public",src:n(65377).Z,width:"1494",height:"682"})),(0,r.kt)("h2",{id:"expose-service-inside-cluster"},"Expose Service Inside Cluster"),(0,r.kt)("p",null,"If you only need the application to be accessed inside the cluster, just configure ",(0,r.kt)("inlineCode",{parentName:"p"},"Public")," as ",(0,r.kt)("inlineCode",{parentName:"p"},"False")," in schema ",(0,r.kt)("inlineCode",{parentName:"p"},"Port"),". There is no need to change the workspace, which means an application developer can easily change a service exposure range, without the involvement of platform engineers."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\n\n# main.k declares customized configurations for dev stacks.\nnginx: ac.AppConfiguration {\n workload: wl.Service {\n ...\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n protocol: "TCP"\n public: False\n }\n ]\n }\n }\n}\n')),(0,r.kt)("p",null,"Execute ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion apply --yes"),", the generated Service has suffix ",(0,r.kt)("inlineCode",{parentName:"p"},"private"),"."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply-private",src:n(96057).Z,width:"1612",height:"494"})),(0,r.kt)("p",null,"And the Service type is ",(0,r.kt)("inlineCode",{parentName:"p"},"ClusterIP"),", only has ",(0,r.kt)("inlineCode",{parentName:"p"},"CLUSTER_IP")," and no ",(0,r.kt)("inlineCode",{parentName:"p"},"EXTERNAL_IP"),", which means it cannot get accessed from outside the cluster. "),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"k8s-resource-private",src:n(64600).Z,width:"1542",height:"210"})),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"This tutorial demonstrates how to expose service of the application deployed on the CSP Kubernetes. By platform engineers' setup of workspace, and application developers' configuration of schema ",(0,r.kt)("inlineCode",{parentName:"p"},"Port")," of Kusion module ",(0,r.kt)("inlineCode",{parentName:"p"},"network"),", Kusion enables you expose service simply and efficiently."))}m.isMDXComponent=!0},96057:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/apply-private-a1d1f3a1b5afac81cea19f189d08222d.png"},97932:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/apply-public-d89cdb3ba9d96904e1820bfbcf4671d8.png"},64600:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/k8s-resource-private-62ab14b1de35205866b64a0d63180450.png"},68162:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/k8s-resource-public-66ffcb206b33c5fc6f1a779bc10b3e93.png"},85091:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/preview-public-eea90eec123cd2fc13536be2b645e900.png"},65377:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/result-public-4bf3f757b0a43c78464ec9bcd75a4b2f.png"}}]); \ No newline at end of file diff --git a/assets/js/c1bf8f22.b1c3cbce.js b/assets/js/c1bf8f22.b1c3cbce.js new file mode 100644 index 00000000000..fc1afcbd386 --- /dev/null +++ b/assets/js/c1bf8f22.b1c3cbce.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2347],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),c=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=c(n),m=r,h=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return n?a.createElement(h,i(i({ref:t},p),{},{components:n})):a.createElement(h,i({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var c=2;c{n.d(t,{Z:()=>i});var a=n(67294),r=n(86010);const o="tabItem_Ymn6";function i(e){let{children:t,hidden:n,className:i}=e;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(o,i),hidden:n},t)}},74866:(e,t,n)=>{n.d(t,{Z:()=>N});var a=n(87462),r=n(67294),o=n(86010),i=n(12466),l=n(76775),s=n(91980),c=n(67392),p=n(50012);function u(e){return function(e){var t;return(null==(t=r.Children.map(e,(e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})))?void 0:t.filter(Boolean))??[]}(e).map((e=>{let{props:{value:t,label:n,attributes:a,default:r}}=e;return{value:t,label:n,attributes:a,default:r}}))}function d(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??u(n);return function(e){const t=(0,c.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function h(e){let{queryString:t=!1,groupId:n}=e;const a=(0,l.k6)(),o=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,s._X)(o),(0,r.useCallback)((e=>{if(!o)return;const t=new URLSearchParams(a.location.search);t.set(o,e),a.replace({...a.location,search:t.toString()})}),[o,a])]}function k(e){const{defaultValue:t,queryString:n=!1,groupId:a}=e,o=d(e),[i,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const a=n.find((e=>e.default))??n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:t,tabValues:o}))),[s,c]=h({queryString:n,groupId:a}),[u,k]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[a,o]=(0,p.Nk)(n);return[a,(0,r.useCallback)((e=>{n&&o.set(e)}),[n,o])]}({groupId:a}),f=(()=>{const e=s??u;return m({value:e,tabValues:o})?e:null})();(0,r.useLayoutEffect)((()=>{f&&l(f)}),[f]);return{selectedValue:i,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:o}))throw new Error(`Can't select invalid tab value=${e}`);l(e),c(e),k(e)}),[c,k,o]),tabValues:o}}var f=n(72389);const b="tabList__CuJ",v="tabItem_LNqP";function g(e){let{className:t,block:n,selectedValue:l,selectValue:s,tabValues:c}=e;const p=[],{blockElementScrollPositionUntilNextRender:u}=(0,i.o5)(),d=e=>{const t=e.currentTarget,n=p.indexOf(t),a=c[n].value;a!==l&&(u(t),s(a))},m=e=>{var t;let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=p.indexOf(e.currentTarget)+1;n=p[t]??p[0];break}case"ArrowLeft":{const t=p.indexOf(e.currentTarget)-1;n=p[t]??p[p.length-1];break}}null==(t=n)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,o.Z)("tabs",{"tabs--block":n},t)},c.map((e=>{let{value:t,label:n,attributes:i}=e;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:l===t?0:-1,"aria-selected":l===t,key:t,ref:e=>p.push(e),onKeyDown:m,onClick:d},i,{className:(0,o.Z)("tabs__item",v,null==i?void 0:i.className,{"tabs__item--active":l===t})}),n??t)})))}function w(e){let{lazy:t,children:n,selectedValue:a}=e;const o=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=o.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},o.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a}))))}function y(e){const t=k(e);return r.createElement("div",{className:(0,o.Z)("tabs-container",b)},r.createElement(g,(0,a.Z)({},e,t)),r.createElement(w,(0,a.Z)({},e,t)))}function N(e){const t=(0,f.Z)();return r.createElement(y,(0,a.Z)({key:String(t)},e))}},90200:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>m,frontMatter:()=>l,metadata:()=>c,toc:()=>u});var a=n(87462),r=(n(67294),n(3905)),o=n(74866),i=n(85162);const l={id:"expose-service"},s="Expose Application Service Deployed on CSP Kubernetes",c={unversionedId:"user-guides/cloud-resources/expose-service",id:"user-guides/cloud-resources/expose-service",title:"Expose Application Service Deployed on CSP Kubernetes",description:"Deploying applications on the Kubernetes provided by CSP (Cloud Service Provider) is convenient and reliable, which is adopted by many enterprises. Kusion has a good integration with CSP Kubernetes service. You can deploy your application to the Kubernetes cluster, and expose the service in a quite easy way.",source:"@site/docs/kusion/5-user-guides/1-cloud-resources/2-expose-service.md",sourceDirName:"5-user-guides/1-cloud-resources",slug:"/user-guides/cloud-resources/expose-service",permalink:"/docs/next/user-guides/cloud-resources/expose-service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/5-user-guides/1-cloud-resources/2-expose-service.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"expose-service"},sidebar:"kusion",previous:{title:"Deliver the WordPress Application with Cloud RDS",permalink:"/docs/next/user-guides/cloud-resources/database"},next:{title:"Deploy Application",permalink:"/docs/next/user-guides/working-with-k8s/deploy-application"}},p={},u=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Expose Service Publicly",id:"expose-service-publicly",level:2},{value:"Set up Workspace",id:"set-up-workspace",level:3},{value:"Init Project",id:"init-project",level:3},{value:"Update And Review Configuration Codes",id:"update-and-review-configuration-codes",level:3},{value:"Preview and Apply",id:"preview-and-apply",level:3},{value:"Verify Accessibility",id:"verify-accessibility",level:3},{value:"Expose Service Inside Cluster",id:"expose-service-inside-cluster",level:2},{value:"Summary",id:"summary",level:2}],d={toc:u};function m(e){let{components:t,...l}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,l,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"expose-application-service-deployed-on-csp-kubernetes"},"Expose Application Service Deployed on CSP Kubernetes"),(0,r.kt)("p",null,"Deploying applications on the Kubernetes provided by CSP (Cloud Service Provider) is convenient and reliable, which is adopted by many enterprises. Kusion has a good integration with CSP Kubernetes service. You can deploy your application to the Kubernetes cluster, and expose the service in a quite easy way. "),(0,r.kt)("p",null,"This tutorial demonstrates how to expose service of the application deployed on CSP Kubernetes. And the responsibilities of platform engineers and application developers are also clearly defined. "),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("p",null,"Create a Kubernetes cluster provided by CSP, and complete the corresponding configurations for ",(0,r.kt)("inlineCode",{parentName:"p"},"KUBECONFIG"),". The following CSP Kubernetes services are supported: "),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://aws.amazon.com/eks"},"Amazon Elastic Kubernetes Service (EKS)")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://www.alibabacloud.com/product/kubernetes"},"Alibaba Cloud Container Service for Kubernetes (ACK)"))),(0,r.kt)("h2",{id:"expose-service-publicly"},"Expose Service Publicly"),(0,r.kt)("p",null,"If you want the application to be accessed from outside the cluster, you should expose the service publicly. Follow the steps below, you will simply hit the goal."),(0,r.kt)("h3",{id:"set-up-workspace"},"Set up Workspace"),(0,r.kt)("p",null,"Create the workspace as the target where the application will be deployed to. The workspace is usually set up by ",(0,r.kt)("strong",{parentName:"p"},"Platform Engineers"),", which contains platform-standard and application-agnostic configurations. The workspace configurations are organized through a YAML file."),(0,r.kt)(o.Z,{mdxType:"Tabs"},(0,r.kt)(i.Z,{value:"AWS",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n kusionstack/network@0.1.0: \n default: \n port: \n type: aws\n"))),(0,r.kt)(i.Z,{value:"Alicloud",mdxType:"TabItem"},(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n kusionstack/network@0.1.0: \n default: \n port: \n type: alicloud\n annotations:\n service.beta.kubernetes.io/alibaba-cloud-loadbalancer-spec: slb.s1.small\n")))),(0,r.kt)("p",null,"The YAML shown above gives an example of the workspace configuration to expose service on ",(0,r.kt)("strong",{parentName:"p"},"EKS")," and ",(0,r.kt)("strong",{parentName:"p"},"ACK"),". The block ",(0,r.kt)("inlineCode",{parentName:"p"},"port")," contains the workspace configuration of Kusion module ",(0,r.kt)("inlineCode",{parentName:"p"},"network"),", which has the following fields:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"type: the CSP providing Kubernetes service, support ",(0,r.kt)("inlineCode",{parentName:"li"},"alicloud")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"aws")),(0,r.kt)("li",{parentName:"ul"},"annotations: annotations attached to the service, should be a map"),(0,r.kt)("li",{parentName:"ul"},"labels: labels attached to the service, should be a map")),(0,r.kt)("p",null,"Then, create the workspace with the configuration file. The following command creates a workspace named ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," with configuration file ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace create dev -f workspace.yaml\n")),(0,r.kt)("p",null,"After that, we can switch to the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace with the following cmd: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace switch dev\n")),(0,r.kt)("p",null,"If you already create and use the configuration of ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace, you can append the MySQL module configs to your workspace YAML file and use the following command line to update the workspace configuration. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace update dev -f workspace.yaml\n")),(0,r.kt)("p",null,"We can use the following command lines to show the current workspace configurations for ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion workspace show\n")),(0,r.kt)("h3",{id:"init-project"},"Init Project"),(0,r.kt)("p",null,"After creating workspace, you should write application configuration code, which only contains simple and application-centric configurations. This step is usually accomplished by application developers."),(0,r.kt)("p",null,"We can start by initializing this tutorial project with ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion init")," cmd: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"# Create a new directory and navigate into it. \nmkdir nginx && cd nginx\n\n# Initialize the demo project with the name of the current directory. \nkusion init\n")),(0,r.kt)("p",null,"The created project structure looks like below: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"tree\n.\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n\n2 directories, 4 files\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about the directory structure can be found in ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/concepts/project/overview"},"Project")," and ",(0,r.kt)("a",{parentName:"p",href:"/docs/next/concepts/stack/overview"},"Stack"),". ")),(0,r.kt)("h3",{id:"update-and-review-configuration-codes"},"Update And Review Configuration Codes"),(0,r.kt)("p",null,"The initiated configuration codes are for the demo quickstart application, we should replace the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/kcl.mod")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/main.k")," with the below codes: "),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"dev/kcl.mod")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},'[package]\nname = "nginx"\nversion = "0.1.0"\n\n[dependencies]\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\nnetwork = { oci = "oci://ghcr.io/kusionstack/network", tag = "0.1.0" }\n\n[profile]\nentries = ["main.k"]\n')),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"dev/main.k")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\n\n# main.k declares customized configurations for dev stacks.\nnginx: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n nginx: c.Container {\n image: "nginx:1.25.2"\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n protocol: "TCP"\n public: True\n }\n ]\n }\n }\n}\n')),(0,r.kt)("p",null,"The code shown above describes how to expose service publicly. Kusion use schema ",(0,r.kt)("inlineCode",{parentName:"p"},"Port")," to describe the network configuration, the primary fields of Port are as follows:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"port: port number to expose service"),(0,r.kt)("li",{parentName:"ul"},"protocol: protocol to expose service, support ",(0,r.kt)("inlineCode",{parentName:"li"},"TCP")," and ",(0,r.kt)("inlineCode",{parentName:"li"},"UDP")),(0,r.kt)("li",{parentName:"ul"},"public: whether to public the service")),(0,r.kt)("p",null,"To public the service, you should set ",(0,r.kt)("inlineCode",{parentName:"p"},"public")," as True. Besides, schema ",(0,r.kt)("inlineCode",{parentName:"p"},"Service")," should be used to describe the workload configuration."),(0,r.kt)("p",null,"That's all what an application developer needs to configure! Next, preview and apply the configuration, the application will get deployed and exposed publicly."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"Kusion uses Load Balancer (LB) provided by the CSP to expose service publicly. For more detailed network configuration, please refer to ",(0,r.kt)("a",{parentName:"p",href:"https://www.kusionstack.io/docs/kusion/configuration-walkthrough/networking"},"Application Networking"))),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"During the first preview and apply, the models and modules as well as the Terraform CLI (if not exists) that the application depends on will be downloaded, so it may take some time (usually within two minutes). You can take a break and have a cup of coffee. ")),(0,r.kt)("h3",{id:"preview-and-apply"},"Preview and Apply"),(0,r.kt)("p",null,"Execute ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion preview")," under the stack path, you will get what will be created in the real infrastructure. The picture below gives the preview result of the example. A Namespace, Service and Deployment will be created, which meets the expectation. The service name has a suffix ",(0,r.kt)("inlineCode",{parentName:"p"},"public"),", which shows it can be accessed publicly."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"preview-public",src:n(85091).Z,width:"1540",height:"262"})),(0,r.kt)("p",null,"Then, execute ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion apply --yes")," to do the real deploying job. Just a command and a few minutes, you have accomplished deploying application and expose it publicly."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply-public",src:n(97932).Z,width:"1558",height:"480"})),(0,r.kt)("h3",{id:"verify-accessibility"},"Verify Accessibility"),(0,r.kt)("p",null,"In the example above, the kubernetes Namespace whose name is nginx, and a ",(0,r.kt)("inlineCode",{parentName:"p"},"Service")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployment")," under the Namespace should be created. Use ",(0,r.kt)("inlineCode",{parentName:"p"},"kubectl get")," to check, the Service whose type is ",(0,r.kt)("inlineCode",{parentName:"p"},"LoadBalancer")," and Deployment are created indeed. And the Service has ",(0,r.kt)("inlineCode",{parentName:"p"},"EXTERNAL-IP")," 106.5.190.109, which means it can be accessed from outside the cluster."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"k8s-resource-public",src:n(68162).Z,width:"1662",height:"216"})),(0,r.kt)("p",null,"Visit the ",(0,r.kt)("inlineCode",{parentName:"p"},"EXTERNAL-IP")," via browser, the correct result is returned, which illustrates the servie getting publicly exposed successfully."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"result-public",src:n(65377).Z,width:"1494",height:"682"})),(0,r.kt)("h2",{id:"expose-service-inside-cluster"},"Expose Service Inside Cluster"),(0,r.kt)("p",null,"If you only need the application to be accessed inside the cluster, just configure ",(0,r.kt)("inlineCode",{parentName:"p"},"Public")," as ",(0,r.kt)("inlineCode",{parentName:"p"},"False")," in schema ",(0,r.kt)("inlineCode",{parentName:"p"},"Port"),". There is no need to change the workspace, which means an application developer can easily change a service exposure range, without the involvement of platform engineers."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\n\n# main.k declares customized configurations for dev stacks.\nnginx: ac.AppConfiguration {\n workload: wl.Service {\n ...\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n protocol: "TCP"\n public: False\n }\n ]\n }\n }\n}\n')),(0,r.kt)("p",null,"Execute ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion apply --yes"),", the generated Service has suffix ",(0,r.kt)("inlineCode",{parentName:"p"},"private"),"."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"apply-private",src:n(96057).Z,width:"1612",height:"494"})),(0,r.kt)("p",null,"And the Service type is ",(0,r.kt)("inlineCode",{parentName:"p"},"ClusterIP"),", only has ",(0,r.kt)("inlineCode",{parentName:"p"},"CLUSTER_IP")," and no ",(0,r.kt)("inlineCode",{parentName:"p"},"EXTERNAL_IP"),", which means it cannot get accessed from outside the cluster. "),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"k8s-resource-private",src:n(64600).Z,width:"1542",height:"210"})),(0,r.kt)("h2",{id:"summary"},"Summary"),(0,r.kt)("p",null,"This tutorial demonstrates how to expose service of the application deployed on the CSP Kubernetes. By platform engineers' setup of workspace, and application developers' configuration of schema ",(0,r.kt)("inlineCode",{parentName:"p"},"Port")," of Kusion module ",(0,r.kt)("inlineCode",{parentName:"p"},"network"),", Kusion enables you expose service simply and efficiently."))}m.isMDXComponent=!0},96057:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/apply-private-a1d1f3a1b5afac81cea19f189d08222d.png"},97932:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/apply-public-d89cdb3ba9d96904e1820bfbcf4671d8.png"},64600:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/k8s-resource-private-62ab14b1de35205866b64a0d63180450.png"},68162:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/k8s-resource-public-66ffcb206b33c5fc6f1a779bc10b3e93.png"},85091:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/preview-public-eea90eec123cd2fc13536be2b645e900.png"},65377:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/result-public-4bf3f757b0a43c78464ec9bcd75a4b2f.png"}}]); \ No newline at end of file diff --git a/assets/js/c1ddaab4.0c684afa.js b/assets/js/c1ddaab4.0c684afa.js deleted file mode 100644 index b3f0b314aef..00000000000 --- a/assets/js/c1ddaab4.0c684afa.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[722],{3905:(t,e,a)=>{a.d(e,{Zo:()=>s,kt:()=>u});var n=a(67294);function r(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function l(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function i(t){for(var e=1;e=0||(r[a]=t[a]);return r}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}var p=n.createContext({}),d=function(t){var e=n.useContext(p),a=e;return t&&(a="function"==typeof t?t(e):i(i({},e),t)),a},s=function(t){var e=d(t.components);return n.createElement(p.Provider,{value:e},t.children)},m={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},c=n.forwardRef((function(t,e){var a=t.components,r=t.mdxType,l=t.originalType,p=t.parentName,s=o(t,["components","mdxType","originalType","parentName"]),c=d(a),u=r,k=c["".concat(p,".").concat(u)]||c[u]||m[u]||l;return a?n.createElement(k,i(i({ref:e},s),{},{components:a})):n.createElement(k,i({ref:e},s))}));function u(t,e){var a=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var l=a.length,i=new Array(l);i[0]=c;var o={};for(var p in e)hasOwnProperty.call(e,p)&&(o[p]=e[p]);o.originalType=t,o.mdxType="string"==typeof t?t:r,i[1]=o;for(var d=2;d{a.r(e),a.d(e,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>o,toc:()=>d});var n=a(87462),r=(a(67294),a(3905));const l={},i="Job",o={unversionedId:"reference/model/catalog_models/workload/doc_job",id:"version-v0.9/reference/model/catalog_models/workload/doc_job",title:"Job",description:"Schemas",source:"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/workload/doc_job.md",sourceDirName:"reference/model/catalog_models/workload",slug:"/reference/model/catalog_models/workload/doc_job",permalink:"/docs/v0.9/reference/model/catalog_models/workload/doc_job",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/catalog_models/workload/doc_job.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"App Configuration",permalink:"/docs/v0.9/reference/model/catalog_models/doc_app_configuration"},next:{title:"Service",permalink:"/docs/v0.9/reference/model/catalog_models/workload/doc_service"}},p={},d=[{value:"Schemas",id:"schemas",level:2},{value:"Schema Job",id:"schema-job",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Base Schema",id:"base-schema",level:3},{value:"Schema Container",id:"schema-container",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3},{value:"Schema FileSpec",id:"schema-filespec",level:2},{value:"Attributes",id:"attributes-2",level:3},{value:"Examples",id:"examples-2",level:3},{value:"Schema Probe",id:"schema-probe",level:2},{value:"Attributes",id:"attributes-3",level:3},{value:"Examples",id:"examples-3",level:3},{value:"Schema Exec",id:"schema-exec",level:2},{value:"Attributes",id:"attributes-4",level:3},{value:"Examples",id:"examples-4",level:3},{value:"Schema Http",id:"schema-http",level:2},{value:"Attributes",id:"attributes-5",level:3},{value:"Examples",id:"examples-5",level:3},{value:"Schema Tcp",id:"schema-tcp",level:2},{value:"Attributes",id:"attributes-6",level:3},{value:"Examples",id:"examples-6",level:3},{value:"Schema Lifecycle",id:"schema-lifecycle",level:2},{value:"Attributes",id:"attributes-7",level:3},{value:"Examples",id:"examples-7",level:3},{value:"Schema Secret",id:"schema-secret",level:2},{value:"Attributes",id:"attributes-8",level:3},{value:"Examples",id:"examples-8",level:3}],s={toc:d};function m(t){let{components:e,...a}=t;return(0,r.kt)("wrapper",(0,n.Z)({},s,a,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"job"},"Job"),(0,r.kt)("h2",{id:"schemas"},"Schemas"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-job"},"Job"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-container"},"Container"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-filespec"},"Filespec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-lifecycle"},"LifeCycle")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-probe"},"Probe"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-exec"},"Exec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-http"},"Http")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-tcp"},"Tcp")))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-secret"},"Secret"))))),(0,r.kt)("h2",{id:"schema-job"},"Schema Job"),(0,r.kt)("p",null,"Job is a kind of workload profile that describes how to run your application code. This",(0,r.kt)("br",null),"is typically used for tasks that take from a few seconds to a few days to complete."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"containers"),(0,r.kt)("br",null),"Containers defines the templates of containers to be ran.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers"},"https://kubernetes.io/docs/concepts/containers")),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-container"},"container.Container"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"schedule")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"replicas"),(0,r.kt)("br",null),"Number of container replicas based on this configuration that should be ran."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"2"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"secrets")),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-secret"},"secret.Secret"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"labels"),(0,r.kt)("br",null),"Labels are key/value pairs that are attached to the workload."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"annotations"),(0,r.kt)("br",null),"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'Instantiate a job with busybox image and runs every hour\n\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\n\njob: wl.Job {\n containers: {\n "busybox": c.Container{\n image: "busybox:1.28"\n command: ["/bin/sh", "-c", "echo hello"]\n }\n }\n schedule: "0 * * * *"\n}\n')),(0,r.kt)("h3",{id:"base-schema"},"Base Schema"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/v0.9/reference/model/catalog_models/internal/doc_common#schema-workloadbase"},"WorkloadBase")),(0,r.kt)("h2",{id:"schema-container"},"Schema Container"),(0,r.kt)("p",null,"Container describes how the Application's tasks are expected to be run. Depending on",(0,r.kt)("br",null),"the replicas parameter 1 or more containers can be created from each template."),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"image"),(0,r.kt)("br",null),"Image refers to the Docker image name to run for this container.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/images"},"https://kubernetes.io/docs/concepts/containers/images")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command"),(0,r.kt)("br",null),"Entrypoint array. Not executed within a shell.",(0,r.kt)("br",null),"Command will overwrite the ENTRYPOINT value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's ENTRYPOINT is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"args"),(0,r.kt)("br",null),"Arguments to the entrypoint.",(0,r.kt)("br",null),"Args will overwrite the CMD value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's CMD is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"env"),(0,r.kt)("br",null),"List of environment variables to set in the container.",(0,r.kt)("br",null),"The value of the environment variable may be static text or a value from a secret."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"workingDir"),(0,r.kt)("br",null),"The working directory of the running process defined in entrypoint.",(0,r.kt)("br",null),"Default container runtime will be used if this is not specified."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"resources"),(0,r.kt)("br",null),"Map of resource requirements the container should run with.",(0,r.kt)("br",null),"The resources parameter is a dict with the key being the resource name and the value being",(0,r.kt)("br",null),"the resource value."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"files"),(0,r.kt)("br",null),"List of files to create in the container.",(0,r.kt)("br",null),"The files parameter is a dict with the key being the file name in the container and the value",(0,r.kt)("br",null),"being the target file specification."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-filespec"},"container.FileSpec"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"dirs"),(0,r.kt)("br",null),"Collection of volumes mount into the container's filesystem.",(0,r.kt)("br",null),"The dirs parameter is a dict with the key being the folder name in the container and the value",(0,r.kt)("br",null),"being the referenced volume."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"livenessProbe"),(0,r.kt)("br",null),"LivenessProbe indicates if a running process is healthy.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"readinessProbe"),(0,r.kt)("br",null),"ReadinessProbe indicates whether an application is available to handle requests."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"startupProbe"),(0,r.kt)("br",null),"StartupProbe indicates that the container has started for the first time.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"lifecycle"),(0,r.kt)("br",null),"Lifecycle refers to actions that the management system should take in response to container lifecycle events."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-lifecycle"},"lc.Lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container as c\n\nweb = c.Container {\n image: "nginx:latest"\n command: ["/bin/sh", "-c", "echo hi"]\n env: {\n "name": "value"\n }\n resources: {\n "cpu": "2"\n "memory": "4Gi"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-filespec"},"Schema FileSpec"),(0,r.kt)("p",null,"FileSpec defines the target file in a Container."),(0,r.kt)("h3",{id:"attributes-2"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"content"),(0,r.kt)("br",null),"File content in plain text."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"contentFrom"),(0,r.kt)("br",null),"Source for the file content, reference to a secret of configmap value."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"mode"),(0,r.kt)("br",null),"Mode bits used to set permissions on this file, must be an octal value",(0,r.kt)("br",null),"between 0000 and 0777 or a decimal value between 0 and 511"),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-2"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container as c\n\ntmpFile = c.FileSpec {\n content: "some file contents"\n mode: "0777"\n}\n')),(0,r.kt)("h2",{id:"schema-probe"},"Schema Probe"),(0,r.kt)("p",null,"Probe describes a health check to be performed against a container to determine whether it is",(0,r.kt)("br",null),"alive or ready to receive traffic. There are three probe types: readiness, liveness, and startup."),(0,r.kt)("h3",{id:"attributes-3"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"probeHandler"),(0,r.kt)("br",null),"The action taken to determine the alive or health of a container"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-tcp"},"probe.Tcp")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"initialDelaySeconds"),(0,r.kt)("br",null),"The number of seconds before health checking is activated.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle%5C#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle\\#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"timeoutSeconds"),(0,r.kt)("br",null),"The number of seconds after which the probe times out.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle%5C#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle\\#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"periodSeconds"),(0,r.kt)("br",null),"How often (in seconds) to perform the probe."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"successThreshold"),(0,r.kt)("br",null),"Minimum consecutive successes for the probe to be considered successful after having failed."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"failureThreshold"),(0,r.kt)("br",null),"Minimum consecutive failures for the probe to be considered failed after having succeeded."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"terminationGracePeriod")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-3"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nprobe = p.Probe {\n probeHandler: p.Http {\n path: "/healthz"\n }\n initialDelaySeconds: 10\n}\n')),(0,r.kt)("h2",{id:"schema-exec"},"Schema Exec"),(0,r.kt)("p",null,'Exec describes a "run in container" action.'),(0,r.kt)("h3",{id:"attributes-4"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command"),(0,r.kt)("br",null),"The command line to execute inside the container."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-4"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nexecProbe = p.Exec {\n command: ["probe.sh"]\n}\n')),(0,r.kt)("h2",{id:"schema-http"},"Schema Http"),(0,r.kt)("p",null,"Http describes an action based on HTTP Get requests."),(0,r.kt)("h3",{id:"attributes-5"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url"),(0,r.kt)("br",null),"The full qualified url to send HTTP requests."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"headers"),(0,r.kt)("br",null),"Collection of custom headers to set in the request"),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-5"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nhttpProbe = p.Http {\n url: "http://localhost:80"\n headers: {\n "X-HEADER": "VALUE"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-tcp"},"Schema Tcp"),(0,r.kt)("p",null,"Tcp describes an action based on opening a socket."),(0,r.kt)("h3",{id:"attributes-6"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url"),(0,r.kt)("br",null),"The full qualified url to open a socket."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-6"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\ntcpProbe = p.Tcp {\n url: "tcp://localhost:1234"\n}\n')),(0,r.kt)("h2",{id:"schema-lifecycle"},"Schema Lifecycle"),(0,r.kt)("p",null,"Lifecycle describes actions that the management system should take in response",(0,r.kt)("br",null),"to container lifecycle events."),(0,r.kt)("h3",{id:"attributes-7"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"preStop"),(0,r.kt)("br",null),"The action to be taken before a container is terminated due to an API request or",(0,r.kt)("br",null),"management event such as liveness/startup probe failure, preemption, resource contention, etc.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/%5C#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/\\#container-hooks")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"postStart"),(0,r.kt)("br",null),"The action to be taken after a container is created.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/%5C#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/\\#container-hooks")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-7"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.container.lifecycle as lc\n\nlifecycleHook = lc.Lifecycle {\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n postStart: p.Http {\n url: "http://localhost:80"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-secret"},"Schema Secret"),(0,r.kt)("p",null,"Secret can be used to store sensitive data."),(0,r.kt)("h3",{id:"attributes-8"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type"),(0,r.kt)("br",null),"Type of secret, used to facilitate programmatic handling of secret data.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/configuration/secret/%5C#secret-types"},"https://kubernetes.io/docs/concepts/configuration/secret/\\#secret-types")),(0,r.kt)("td",{parentName:"tr",align:null},'"basic" ',"|",' "opaque"'),(0,r.kt)("td",{parentName:"tr",align:null},"opaque"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"data"),(0,r.kt)("br",null),"Data contains the non-binary secret data in string form."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"immutable"),(0,r.kt)("br",null),"Immutable, if set to true, ensures that data stored in the Secret cannot be updated."),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-8"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.secret as sec\n\nbasicAuth = sec.Secret {\n type: "basic"\n data: {\n "username": ""\n "password": ""\n }\n}\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c1ddaab4.fd25e463.js b/assets/js/c1ddaab4.fd25e463.js new file mode 100644 index 00000000000..ea12c135294 --- /dev/null +++ b/assets/js/c1ddaab4.fd25e463.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[722],{3905:(t,e,a)=>{a.d(e,{Zo:()=>s,kt:()=>u});var n=a(67294);function r(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function l(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function i(t){for(var e=1;e=0||(r[a]=t[a]);return r}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}var p=n.createContext({}),d=function(t){var e=n.useContext(p),a=e;return t&&(a="function"==typeof t?t(e):i(i({},e),t)),a},s=function(t){var e=d(t.components);return n.createElement(p.Provider,{value:e},t.children)},m={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},c=n.forwardRef((function(t,e){var a=t.components,r=t.mdxType,l=t.originalType,p=t.parentName,s=o(t,["components","mdxType","originalType","parentName"]),c=d(a),u=r,k=c["".concat(p,".").concat(u)]||c[u]||m[u]||l;return a?n.createElement(k,i(i({ref:e},s),{},{components:a})):n.createElement(k,i({ref:e},s))}));function u(t,e){var a=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var l=a.length,i=new Array(l);i[0]=c;var o={};for(var p in e)hasOwnProperty.call(e,p)&&(o[p]=e[p]);o.originalType=t,o.mdxType="string"==typeof t?t:r,i[1]=o;for(var d=2;d{a.r(e),a.d(e,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>o,toc:()=>d});var n=a(87462),r=(a(67294),a(3905));const l={},i="Job",o={unversionedId:"reference/model/catalog_models/workload/doc_job",id:"version-v0.9/reference/model/catalog_models/workload/doc_job",title:"Job",description:"Schemas",source:"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/workload/doc_job.md",sourceDirName:"reference/model/catalog_models/workload",slug:"/reference/model/catalog_models/workload/doc_job",permalink:"/docs/v0.9/reference/model/catalog_models/workload/doc_job",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/catalog_models/workload/doc_job.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"App Configuration",permalink:"/docs/v0.9/reference/model/catalog_models/doc_app_configuration"},next:{title:"Service",permalink:"/docs/v0.9/reference/model/catalog_models/workload/doc_service"}},p={},d=[{value:"Schemas",id:"schemas",level:2},{value:"Schema Job",id:"schema-job",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Base Schema",id:"base-schema",level:3},{value:"Schema Container",id:"schema-container",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3},{value:"Schema FileSpec",id:"schema-filespec",level:2},{value:"Attributes",id:"attributes-2",level:3},{value:"Examples",id:"examples-2",level:3},{value:"Schema Probe",id:"schema-probe",level:2},{value:"Attributes",id:"attributes-3",level:3},{value:"Examples",id:"examples-3",level:3},{value:"Schema Exec",id:"schema-exec",level:2},{value:"Attributes",id:"attributes-4",level:3},{value:"Examples",id:"examples-4",level:3},{value:"Schema Http",id:"schema-http",level:2},{value:"Attributes",id:"attributes-5",level:3},{value:"Examples",id:"examples-5",level:3},{value:"Schema Tcp",id:"schema-tcp",level:2},{value:"Attributes",id:"attributes-6",level:3},{value:"Examples",id:"examples-6",level:3},{value:"Schema Lifecycle",id:"schema-lifecycle",level:2},{value:"Attributes",id:"attributes-7",level:3},{value:"Examples",id:"examples-7",level:3},{value:"Schema Secret",id:"schema-secret",level:2},{value:"Attributes",id:"attributes-8",level:3},{value:"Examples",id:"examples-8",level:3}],s={toc:d};function m(t){let{components:e,...a}=t;return(0,r.kt)("wrapper",(0,n.Z)({},s,a,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"job"},"Job"),(0,r.kt)("h2",{id:"schemas"},"Schemas"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-job"},"Job"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-container"},"Container"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-filespec"},"Filespec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-lifecycle"},"LifeCycle")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-probe"},"Probe"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-exec"},"Exec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-http"},"Http")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-tcp"},"Tcp")))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-secret"},"Secret"))))),(0,r.kt)("h2",{id:"schema-job"},"Schema Job"),(0,r.kt)("p",null,"Job is a kind of workload profile that describes how to run your application code. This",(0,r.kt)("br",null),"is typically used for tasks that take from a few seconds to a few days to complete."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"containers"),(0,r.kt)("br",null),"Containers defines the templates of containers to be ran.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers"},"https://kubernetes.io/docs/concepts/containers")),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-container"},"container.Container"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"schedule")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"replicas"),(0,r.kt)("br",null),"Number of container replicas based on this configuration that should be ran."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"2"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"secrets")),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-secret"},"secret.Secret"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"labels"),(0,r.kt)("br",null),"Labels are key/value pairs that are attached to the workload."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"annotations"),(0,r.kt)("br",null),"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'Instantiate a job with busybox image and runs every hour\n\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\n\njob: wl.Job {\n containers: {\n "busybox": c.Container{\n image: "busybox:1.28"\n command: ["/bin/sh", "-c", "echo hello"]\n }\n }\n schedule: "0 * * * *"\n}\n')),(0,r.kt)("h3",{id:"base-schema"},"Base Schema"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/v0.9/reference/model/catalog_models/internal/doc_common#schema-workloadbase"},"WorkloadBase")),(0,r.kt)("h2",{id:"schema-container"},"Schema Container"),(0,r.kt)("p",null,"Container describes how the Application's tasks are expected to be run. Depending on",(0,r.kt)("br",null),"the replicas parameter 1 or more containers can be created from each template."),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"image"),(0,r.kt)("br",null),"Image refers to the Docker image name to run for this container.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/images"},"https://kubernetes.io/docs/concepts/containers/images")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command"),(0,r.kt)("br",null),"Entrypoint array. Not executed within a shell.",(0,r.kt)("br",null),"Command will overwrite the ENTRYPOINT value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's ENTRYPOINT is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"args"),(0,r.kt)("br",null),"Arguments to the entrypoint.",(0,r.kt)("br",null),"Args will overwrite the CMD value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's CMD is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"env"),(0,r.kt)("br",null),"List of environment variables to set in the container.",(0,r.kt)("br",null),"The value of the environment variable may be static text or a value from a secret."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"workingDir"),(0,r.kt)("br",null),"The working directory of the running process defined in entrypoint.",(0,r.kt)("br",null),"Default container runtime will be used if this is not specified."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"resources"),(0,r.kt)("br",null),"Map of resource requirements the container should run with.",(0,r.kt)("br",null),"The resources parameter is a dict with the key being the resource name and the value being",(0,r.kt)("br",null),"the resource value."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"files"),(0,r.kt)("br",null),"List of files to create in the container.",(0,r.kt)("br",null),"The files parameter is a dict with the key being the file name in the container and the value",(0,r.kt)("br",null),"being the target file specification."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-filespec"},"container.FileSpec"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"dirs"),(0,r.kt)("br",null),"Collection of volumes mount into the container's filesystem.",(0,r.kt)("br",null),"The dirs parameter is a dict with the key being the folder name in the container and the value",(0,r.kt)("br",null),"being the referenced volume."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"livenessProbe"),(0,r.kt)("br",null),"LivenessProbe indicates if a running process is healthy.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"readinessProbe"),(0,r.kt)("br",null),"ReadinessProbe indicates whether an application is available to handle requests."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"startupProbe"),(0,r.kt)("br",null),"StartupProbe indicates that the container has started for the first time.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"lifecycle"),(0,r.kt)("br",null),"Lifecycle refers to actions that the management system should take in response to container lifecycle events."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-lifecycle"},"lc.Lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container as c\n\nweb = c.Container {\n image: "nginx:latest"\n command: ["/bin/sh", "-c", "echo hi"]\n env: {\n "name": "value"\n }\n resources: {\n "cpu": "2"\n "memory": "4Gi"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-filespec"},"Schema FileSpec"),(0,r.kt)("p",null,"FileSpec defines the target file in a Container."),(0,r.kt)("h3",{id:"attributes-2"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"content"),(0,r.kt)("br",null),"File content in plain text."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"contentFrom"),(0,r.kt)("br",null),"Source for the file content, reference to a secret of configmap value."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"mode"),(0,r.kt)("br",null),"Mode bits used to set permissions on this file, must be an octal value",(0,r.kt)("br",null),"between 0000 and 0777 or a decimal value between 0 and 511"),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-2"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container as c\n\ntmpFile = c.FileSpec {\n content: "some file contents"\n mode: "0777"\n}\n')),(0,r.kt)("h2",{id:"schema-probe"},"Schema Probe"),(0,r.kt)("p",null,"Probe describes a health check to be performed against a container to determine whether it is",(0,r.kt)("br",null),"alive or ready to receive traffic. There are three probe types: readiness, liveness, and startup."),(0,r.kt)("h3",{id:"attributes-3"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"probeHandler"),(0,r.kt)("br",null),"The action taken to determine the alive or health of a container"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-tcp"},"probe.Tcp")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"initialDelaySeconds"),(0,r.kt)("br",null),"The number of seconds before health checking is activated.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle%5C#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle\\#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"timeoutSeconds"),(0,r.kt)("br",null),"The number of seconds after which the probe times out.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle%5C#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle\\#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"periodSeconds"),(0,r.kt)("br",null),"How often (in seconds) to perform the probe."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"successThreshold"),(0,r.kt)("br",null),"Minimum consecutive successes for the probe to be considered successful after having failed."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"failureThreshold"),(0,r.kt)("br",null),"Minimum consecutive failures for the probe to be considered failed after having succeeded."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"terminationGracePeriod")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-3"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nprobe = p.Probe {\n probeHandler: p.Http {\n path: "/healthz"\n }\n initialDelaySeconds: 10\n}\n')),(0,r.kt)("h2",{id:"schema-exec"},"Schema Exec"),(0,r.kt)("p",null,'Exec describes a "run in container" action.'),(0,r.kt)("h3",{id:"attributes-4"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command"),(0,r.kt)("br",null),"The command line to execute inside the container."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-4"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nexecProbe = p.Exec {\n command: ["probe.sh"]\n}\n')),(0,r.kt)("h2",{id:"schema-http"},"Schema Http"),(0,r.kt)("p",null,"Http describes an action based on HTTP Get requests."),(0,r.kt)("h3",{id:"attributes-5"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url"),(0,r.kt)("br",null),"The full qualified url to send HTTP requests."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"headers"),(0,r.kt)("br",null),"Collection of custom headers to set in the request"),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-5"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nhttpProbe = p.Http {\n url: "http://localhost:80"\n headers: {\n "X-HEADER": "VALUE"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-tcp"},"Schema Tcp"),(0,r.kt)("p",null,"Tcp describes an action based on opening a socket."),(0,r.kt)("h3",{id:"attributes-6"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url"),(0,r.kt)("br",null),"The full qualified url to open a socket."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-6"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\ntcpProbe = p.Tcp {\n url: "tcp://localhost:1234"\n}\n')),(0,r.kt)("h2",{id:"schema-lifecycle"},"Schema Lifecycle"),(0,r.kt)("p",null,"Lifecycle describes actions that the management system should take in response",(0,r.kt)("br",null),"to container lifecycle events."),(0,r.kt)("h3",{id:"attributes-7"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"preStop"),(0,r.kt)("br",null),"The action to be taken before a container is terminated due to an API request or",(0,r.kt)("br",null),"management event such as liveness/startup probe failure, preemption, resource contention, etc.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/%5C#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/\\#container-hooks")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"postStart"),(0,r.kt)("br",null),"The action to be taken after a container is created.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/%5C#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/\\#container-hooks")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-7"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.container.lifecycle as lc\n\nlifecycleHook = lc.Lifecycle {\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n postStart: p.Http {\n url: "http://localhost:80"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-secret"},"Schema Secret"),(0,r.kt)("p",null,"Secret can be used to store sensitive data."),(0,r.kt)("h3",{id:"attributes-8"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type"),(0,r.kt)("br",null),"Type of secret, used to facilitate programmatic handling of secret data.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/configuration/secret/%5C#secret-types"},"https://kubernetes.io/docs/concepts/configuration/secret/\\#secret-types")),(0,r.kt)("td",{parentName:"tr",align:null},'"basic" ',"|",' "opaque"'),(0,r.kt)("td",{parentName:"tr",align:null},"opaque"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"data"),(0,r.kt)("br",null),"Data contains the non-binary secret data in string form."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"immutable"),(0,r.kt)("br",null),"Immutable, if set to true, ensures that data stored in the Secret cannot be updated."),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-8"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.secret as sec\n\nbasicAuth = sec.Secret {\n type: "basic"\n data: {\n "username": ""\n "password": ""\n }\n}\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c3289e2b.1269f85c.js b/assets/js/c3289e2b.1269f85c.js new file mode 100644 index 00000000000..46265e87605 --- /dev/null +++ b/assets/js/c3289e2b.1269f85c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4072],{3905:(e,t,o)=>{o.d(t,{Zo:()=>u,kt:()=>h});var n=o(67294);function r(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function a(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function i(e){for(var t=1;t=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}var p=n.createContext({}),l=function(e){var t=n.useContext(p),o=t;return e&&(o="function"==typeof e?e(t):i(i({},t),e)),o},u=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var o=e.components,r=e.mdxType,a=e.originalType,p=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),c=l(o),h=r,d=c["".concat(p,".").concat(h)]||c[h]||m[h]||a;return o?n.createElement(d,i(i({ref:t},u),{},{components:o})):n.createElement(d,i({ref:t},u))}));function h(e,t){var o=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=o.length,i=new Array(a);i[0]=c;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var l=2;l{o.r(t),o.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var n=o(87462),r=(o(67294),o(3905));const a={id:"prometheus"},i="Configure Monitoring Behavior With Prometheus",s={unversionedId:"user-guides/observability/prometheus",id:"version-v0.11/user-guides/observability/prometheus",title:"Configure Monitoring Behavior With Prometheus",description:"This document provides the step-by-step instruction to set up monitoring for your application.",source:"@site/docs_versioned_docs/version-v0.11/5-user-guides/3-observability/1-prometheus.md",sourceDirName:"5-user-guides/3-observability",slug:"/user-guides/observability/prometheus",permalink:"/docs/user-guides/observability/prometheus",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/5-user-guides/3-observability/1-prometheus.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"prometheus"},sidebar:"kusion",previous:{title:"Schedule a Job",permalink:"/docs/user-guides/working-with-k8s/job"},next:{title:"Using Cloud Secrets Manager",permalink:"/docs/user-guides/secrets-management/using-cloud-secrets"}},p={},l=[{value:"Pre-requisite",id:"pre-requisite",level:2},{value:"Setting up your own Prometheus",id:"setting-up-your-own-prometheus",level:2},{value:"Installing Prometheus operator3.",id:"installing-prometheus-operator3",level:3},{value:"Make sure RBAC is properly set up",id:"make-sure-rbac-is-properly-set-up",level:3},{value:"Configure Prometheus instance via the operator",id:"configure-prometheus-instance-via-the-operator",level:3},{value:"Exposing the Prometheus portal (optional)",id:"exposing-the-prometheus-portal-optional",level:3},{value:"Setting up workspace configs",id:"setting-up-workspace-configs",level:2},{value:"Operator mode",id:"operator-mode",level:3},{value:"Monitor types",id:"monitor-types",level:3},{value:"Overriding with projectSelector",id:"overriding-with-projectselector",level:3},{value:"Updating the workspace config",id:"updating-the-workspace-config",level:2},{value:"Using kusion to deploy your application with monitoring requirements",id:"using-kusion-to-deploy-your-application-with-monitoring-requirements",level:2},{value:"References",id:"references",level:2}],u={toc:l};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"configure-monitoring-behavior-with-prometheus"},"Configure Monitoring Behavior With Prometheus"),(0,r.kt)("p",null,"This document provides the step-by-step instruction to set up monitoring for your application. "),(0,r.kt)("p",null,"As of today, Kusion supports the configuration of Prometheus scraping behaviors for the target application. In the future, we will add more cloud-provider-native solutions, such as AWS CloudWatch, Azure Monitor, etc."),(0,r.kt)("p",null,"The user guide below is composed of the following components:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Namespace"),(0,r.kt)("li",{parentName:"ul"},"Deployment"),(0,r.kt)("li",{parentName:"ul"},"Service"),(0,r.kt)("li",{parentName:"ul"},"ServiceMonitor")),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"This guide requires you to have a basic understanding of Kubernetes and Prometheus.\nIf you are not familiar with the relevant concepts, please refer to the links below:"),(0,r.kt)("ul",{parentName:"admonition"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/tutorials/kubernetes-basics/"},"Learn Kubernetes Basics")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://prometheus.io/docs/introduction/overview/"},"Prometheus Introduction")))),(0,r.kt)("h2",{id:"pre-requisite"},"Pre-requisite"),(0,r.kt)("p",null,"Please refer to the ",(0,r.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,r.kt)("p",null,"The example below also requires you to have ",(0,r.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#initializing"},"initialized the project")," using the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will generate a ",(0,r.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#kclmod"},(0,r.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the project directory."),(0,r.kt)("h2",{id:"setting-up-your-own-prometheus"},"Setting up your own Prometheus"),(0,r.kt)("p",null,"There a quite a few ways to set up Prometheus in your cluster:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Installing a Prometheus operator"),(0,r.kt)("li",{parentName:"ol"},"Installing a standalone Prometheus server"),(0,r.kt)("li",{parentName:"ol"},"Installing a Prometheus agent and connect to a remote Prometheus server")),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator/issues/1547#issuecomment-401092041"},"The advice from the Prometheus team")," is to use the ",(0,r.kt)("inlineCode",{parentName:"p"},"ServiceMonitor")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"PodMonitor")," CRs via the Prometheus operator to manage scrape configs going forward",(0,r.kt)("sup",null,"[2]"),"."),(0,r.kt)("p",null,"In either case, you only have to do this setup once per cluster. This doc will use a minikube cluster and Prometheus operator as an example."),(0,r.kt)("h3",{id:"installing-prometheus-operator3"},"Installing Prometheus operator",(0,r.kt)("sup",null,"[3]"),"."),(0,r.kt)("p",null,"To get the example in this user guide working, all you need is a running Prometheus operator. You can have that installed by running:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"LATEST=$(curl -s https://api.github.com/repos/prometheus-operator/prometheus-operator/releases/latest | jq -cr .tag_name)\ncurl -sL https://github.com/prometheus-operator/prometheus-operator/releases/download/${LATEST}/bundle.yaml | kubectl create -f -\n")),(0,r.kt)("p",null,"This will install all the necessary CRDs and the Prometheus operator itself in the default namespace. Wait a few minutes, you can confirm the operator is up by running: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kubectl wait --for=condition=Ready pods -l app.kubernetes.io/name=prometheus-operator -n default\n")),(0,r.kt)("h3",{id:"make-sure-rbac-is-properly-set-up"},"Make sure RBAC is properly set up"),(0,r.kt)("p",null,"If you have RBAC enabled on the cluster, the following must be created for Prometheus to work properly:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'apiVersion: v1\nkind: ServiceAccount\nmetadata:\n name: prometheus\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n name: prometheus\nrules:\n- apiGroups: [""]\n resources:\n - nodes\n - nodes/metrics\n - services\n - endpoints\n - pods\n verbs: ["get", "list", "watch"]\n- apiGroups: [""]\n resources:\n - configmaps\n verbs: ["get"]\n- apiGroups:\n - networking.k8s.io\n resources:\n - ingresses\n verbs: ["get", "list", "watch"]\n- nonResourceURLs: ["/metrics"]\n verbs: ["get"]\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n name: prometheus\nroleRef:\n apiGroup: rbac.authorization.k8s.io\n kind: ClusterRole\n name: prometheus\nsubjects:\n- kind: ServiceAccount\n name: prometheus\n namespace: default\n')),(0,r.kt)("h3",{id:"configure-prometheus-instance-via-the-operator"},"Configure Prometheus instance via the operator"),(0,r.kt)("p",null,"Once all of the above is set up, you can then configure the Prometheus instance via the operator:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"apiVersion: monitoring.coreos.com/v1\nkind: Prometheus\nmetadata:\n name: prometheus\nspec:\n serviceAccountName: prometheus\n serviceMonitorNamespaceSelector: {}\n serviceMonitorSelector: {}\n podMonitorNamespaceSelector: {}\n podMonitorSelector: {}\n resources:\n requests:\n memory: 400Mi\n")),(0,r.kt)("p",null,"This Prometheus instance above will be cluster-wide, picking up ALL the service monitors and pod monitors across ALL the namespaces.\nYou can adjust the requests and limits accordingly if you have a larger cluster."),(0,r.kt)("h3",{id:"exposing-the-prometheus-portal-optional"},"Exposing the Prometheus portal (optional)"),(0,r.kt)("p",null,"Once you have the managed Prometheus instance created via the Prometheus CR above, you should be able to see a service created called ",(0,r.kt)("inlineCode",{parentName:"p"},"prometheus-operated"),":"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"prometheus-operated",src:o(91512).Z,width:"631",height:"52"})),(0,r.kt)("p",null,"If you are also running on minikube, you can expose it onto your localhost via kubectl:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kubectl port-forward svc/prometheus-operated 9099:9090\n")),(0,r.kt)("p",null,"You should then be able to see the Prometheus portal via ",(0,r.kt)("inlineCode",{parentName:"p"},"localhost:9099")," in your browser:"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"prometheus-portal",src:o(35443).Z,width:"2878",height:"1096"})),(0,r.kt)("p",null,"If you are running a non-local cluster, you can try to expose it via another way, through an ingress controller for example."),(0,r.kt)("h2",{id:"setting-up-workspace-configs"},"Setting up workspace configs"),(0,r.kt)("p",null,"Since v0.10.0, we have introduced the concept of ",(0,r.kt)("a",{parentName:"p",href:"/docs/concepts/workspace"},"workspaces"),", whose configurations represent the part of the application behaviors that platform teams are interested in standardizing, or the ones to eliminate from developer's mind to make their lives easier."),(0,r.kt)("p",null,"In the case of setting up Prometheus, there are a few things to set up on the workspace level:"),(0,r.kt)("h3",{id:"operator-mode"},"Operator mode"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," flag indicates to Kusion whether the Prometheus instance installed in the cluster runs as a Kubernetes operator or not. This determines the different kinds of resources Kusion manages."),(0,r.kt)("p",null,"To see more about different ways to run Prometheus in the Kubernetes cluster, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/prometheus.md#prometheus-installation"},"design documentation"),"."),(0,r.kt)("p",null,"Most cloud vendors provide an out-of-the-box monitoring solutions for workloads running in a managed-Kubernetes cluster (EKS, AKS, etc), such as AWS CloudWatch, Azure Monitor, etc. These solutions mostly involve installing an agent (CloudWatch Agent, OMS Agent, etc) in the cluster and collecting the metrics to a centralized monitoring server. In those cases, you don't need to set ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," to ",(0,r.kt)("inlineCode",{parentName:"p"},"True"),". It only needs to be set to ",(0,r.kt)("inlineCode",{parentName:"p"},"True")," when you have an installation of the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator"},"Prometheus operator")," running inside the Kubernetes cluster."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"For differences between ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator"},"Prometheus operator"),", ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/kube-prometheus"},"kube-prometheus")," and the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack"},"community kube-prometheus-stack helm chart"),", the details are documented ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator#prometheus-operator-vs-kube-prometheus-vs-community-helm-chart"},"here"),".")),(0,r.kt)("h3",{id:"monitor-types"},"Monitor types"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"monitorType")," flag indicates the kind of monitor Kusion will create. It only applies when ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," is set to ",(0,r.kt)("inlineCode",{parentName:"p"},"True"),". As of version 0.10.0, Kusion provides options to scrape metrics from either the application pods or its corresponding Kubernetes services. This determines the different kinds of resources Kusion manages when Prometheus runs as an operator in the target cluster."),(0,r.kt)("p",null,"A sample ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," with Prometheus settings:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n ...\n kusionstack/monitoring@0.1.0:\n default:\n operatorMode: True\n monitorType: Service\n scheme: http\n interval: 30s\n timeout: 15s\n...\n")),(0,r.kt)("p",null,"To instruct Prometheus to scrape from pod targets instead:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n ...\n kusionstack/monitoring@0.1.0:\n default:\n operatorMode: True\n monitorType: Pod\n scheme: http\n interval: 30s\n timeout: 15s\n...\n")),(0,r.kt)("p",null,"If the ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," is omitted from the ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),", Kusion defaults ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," to false."),(0,r.kt)("h3",{id:"overriding-with-projectselector"},"Overriding with projectSelector"),(0,r.kt)("p",null,"Workspace configurations contain a set of default setting group for all projects in the workspace, with means to override them by Projects using a ",(0,r.kt)("inlineCode",{parentName:"p"},"projectSelector")," keyword."),(0,r.kt)("p",null,"Projects with the name matching those in projectSelector will use the values defined in that override group instead of the default. If a key is not present in the override group, the default value will be used."),(0,r.kt)("p",null,"Take a look at the sample ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n ...\n kusionstack/monitoring@0.1.0:\n default:\n operatorMode: True\n monitorType: Pod\n scheme: http\n interval: 30s\n timeout: 15s\n low_frequency:\n operatorMode: False\n interval: 2m\n projectSelector:\n - foobar\n high_frequency:\n monitorType: Service\n projectSelector:\n - helloworld\n...\n")),(0,r.kt)("p",null,"In the example above, a project with the name ",(0,r.kt)("inlineCode",{parentName:"p"},"helloworld")," will have the monitoring settings where ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," is set to ",(0,r.kt)("inlineCode",{parentName:"p"},"False"),", a 2 minute scraping interval, 15 seconds timeout (coming from default) and http scheme (coming from default)."),(0,r.kt)("p",null,"You cannot have the same project appear in two projectSelectors."),(0,r.kt)("p",null,"For a full reference of what can be configured in the workspace level, please see the ",(0,r.kt)("a",{parentName:"p",href:"../../reference/modules/workspace-configs/monitoring/prometheus"},"workspace reference"),"."),(0,r.kt)("h2",{id:"updating-the-workspace-config"},"Updating the workspace config"),(0,r.kt)("p",null,"Assuming you now have a ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," that looks like the following:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n kusionstack/monitoring@0.1.0:\n default:\n operatorMode: True\n monitorType: Service\n scheme: http\n interval: 30s\n timeout: 15s\n...\n")),(0,r.kt)("p",null,"Update the workspace configuration by running the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kusion workspace update dev -f workspace.yaml\n")),(0,r.kt)("p",null,"Verify the workspace config is properly updated by running the command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kusion workspace show dev\n")),(0,r.kt)("h2",{id:"using-kusion-to-deploy-your-application-with-monitoring-requirements"},"Using kusion to deploy your application with monitoring requirements"),(0,r.kt)("p",null,"At this point we are set up for good! Any new applications you deploy via kusion will now automatically have the monitoring-related resources created, should you declare you want it via the ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," field in the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model."),(0,r.kt)("p",null,"The monitoring in an AppConfiguration is declared in the ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," field. See the example below for a full, deployable AppConfiguration."),(0,r.kt)("p",null,"Please note we are using a new image ",(0,r.kt)("inlineCode",{parentName:"p"},"quay.io/brancz/prometheus-example-app")," since the app itself need to expose metrics for Prometheus to scrape:"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"helloworld/dev/kcl.mod"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'[package]\nname = "helloworld"\n\n[dependencies]\nmonitoring = { oci = "oci://ghcr.io/kusionstack/monitoring", tag = "0.1.0" }\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\n\n[profile]\nentries = ["main.k"]\n')),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"helloworld/dev/main.k"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport monitoring as m\nimport network.network as n\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "monitoring-sample-app": c.Container {\n image: "quay.io/brancz/prometheus-example-app:v0.3.0"\n }\n }\n }\n # Add the monitoring configuration backed by Prometheus\n accessories: {\n "monitoring": m.Prometheus {\n path: "/metrics"\n }\n "network": n.Network {\n ports: [\n n.Port {\n port: 8080\n }\n ]\n }\n }\n}\n')),(0,r.kt)("p",null,"The KCL file above represents an application with a service type workload, exposing the port 8080, and would like Prometheus to scrape the ",(0,r.kt)("inlineCode",{parentName:"p"},"/metrics")," endpoint every 2 minutes."),(0,r.kt)("p",null,"Running ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion apply")," would show that kusion will create a ",(0,r.kt)("inlineCode",{parentName:"p"},"Namespace"),", a ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployment"),", a ",(0,r.kt)("inlineCode",{parentName:"p"},"Service")," and a ",(0,r.kt)("inlineCode",{parentName:"p"},"ServiceMonitor"),":\n",(0,r.kt)("img",{alt:"kusion-apply-with-monitor",src:o(448).Z,width:"705",height:"224"})),(0,r.kt)("p",null,"Continue applying all resources:\n",(0,r.kt)("img",{alt:"kusion-apply-success",src:o(56816).Z,width:"1047",height:"564"})),(0,r.kt)("p",null,"If we want to, we can verify the service monitor has been created successfully:\n",(0,r.kt)("img",{alt:"service-monitor",src:o(58232).Z,width:"693",height:"463"})),(0,r.kt)("p",null,"In a few seconds, you should be able to see in the Prometheus portal that the service we just deployed has now been discovered and monitored by Prometheus:\n",(0,r.kt)("img",{alt:"prometheus-targets",src:o(87594).Z,width:"2880",height:"1636"})),(0,r.kt)("p",null,"You can run a few simply queries for the data that Prometheus scraped from your application:\n",(0,r.kt)("img",{alt:"prometheus-simple-query",src:o(87695).Z,width:"2880",height:"1634"})),(0,r.kt)("p",null,"For more info about PromQL, you can find them ",(0,r.kt)("a",{parentName:"p",href:"https://prometheus.io/docs/prometheus/latest/querying/basics/"},"here"),(0,r.kt)("sup",null,"[4]"),"."),(0,r.kt)("h2",{id:"references"},"References"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Prometheus: ",(0,r.kt)("a",{parentName:"li",href:"https://prometheus.io/docs/introduction/overview/"},"https://prometheus.io/docs/introduction/overview/")),(0,r.kt)("li",{parentName:"ol"},"Prometheus team advise: ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/prometheus-operator/prometheus-operator/issues/1547#issuecomment-446691500"},"https://github.com/prometheus-operator/prometheus-operator/issues/1547#issuecomment-446691500")),(0,r.kt)("li",{parentName:"ol"},"Prometheus operator getting started doc: ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md"},"https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md")),(0,r.kt)("li",{parentName:"ol"},"PromQL basics: ",(0,r.kt)("a",{parentName:"li",href:"https://prometheus.io/docs/prometheus/latest/querying/basics/"},"https://prometheus.io/docs/prometheus/latest/querying/basics/"))))}m.isMDXComponent=!0},56816:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/kusion-apply-success-52d04db670fd184959c3ea5c9e54f69d.png"},448:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/kusion-apply-with-monitor-d27cd1443e1a324d514983d52c055b15.png"},91512:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-operated-4cf8308703e4ec9d06a5078bbceb8d5d.png"},35443:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-portal-b60d8654c309e675fc04f1e74c5c127a.png"},87695:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-simple-query-60205589e762105ebc850e70d8ea7b56.png"},87594:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-targets-05964bad58af16f2e02c57cafa8565e7.png"},58232:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/service-monitor-2374625bfd1180a978a2be50ad4648ce.png"}}]); \ No newline at end of file diff --git a/assets/js/c3289e2b.9a6b37cc.js b/assets/js/c3289e2b.9a6b37cc.js deleted file mode 100644 index ab374cfb212..00000000000 --- a/assets/js/c3289e2b.9a6b37cc.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4072],{3905:(e,t,o)=>{o.d(t,{Zo:()=>u,kt:()=>h});var n=o(67294);function r(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function a(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function i(e){for(var t=1;t=0||(r[o]=e[o]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(r[o]=e[o])}return r}var p=n.createContext({}),l=function(e){var t=n.useContext(p),o=t;return e&&(o="function"==typeof e?e(t):i(i({},t),e)),o},u=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var o=e.components,r=e.mdxType,a=e.originalType,p=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),c=l(o),h=r,d=c["".concat(p,".").concat(h)]||c[h]||m[h]||a;return o?n.createElement(d,i(i({ref:t},u),{},{components:o})):n.createElement(d,i({ref:t},u))}));function h(e,t){var o=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=o.length,i=new Array(a);i[0]=c;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var l=2;l{o.r(t),o.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var n=o(87462),r=(o(67294),o(3905));const a={id:"prometheus"},i="Configure Monitoring Behavior With Prometheus",s={unversionedId:"user-guides/observability/prometheus",id:"version-v0.11/user-guides/observability/prometheus",title:"Configure Monitoring Behavior With Prometheus",description:"This document provides the step-by-step instruction to set up monitoring for your application.",source:"@site/docs_versioned_docs/version-v0.11/5-user-guides/3-observability/1-prometheus.md",sourceDirName:"5-user-guides/3-observability",slug:"/user-guides/observability/prometheus",permalink:"/docs/user-guides/observability/prometheus",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/5-user-guides/3-observability/1-prometheus.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"prometheus"},sidebar:"kusion",previous:{title:"Schedule a Job",permalink:"/docs/user-guides/working-with-k8s/job"},next:{title:"Using Cloud Secrets Manager",permalink:"/docs/user-guides/secrets-management/using-cloud-secrets"}},p={},l=[{value:"Pre-requisite",id:"pre-requisite",level:2},{value:"Setting up your own Prometheus",id:"setting-up-your-own-prometheus",level:2},{value:"Installing Prometheus operator3.",id:"installing-prometheus-operator3",level:3},{value:"Make sure RBAC is properly set up",id:"make-sure-rbac-is-properly-set-up",level:3},{value:"Configure Prometheus instance via the operator",id:"configure-prometheus-instance-via-the-operator",level:3},{value:"Exposing the Prometheus portal (optional)",id:"exposing-the-prometheus-portal-optional",level:3},{value:"Setting up workspace configs",id:"setting-up-workspace-configs",level:2},{value:"Operator mode",id:"operator-mode",level:3},{value:"Monitor types",id:"monitor-types",level:3},{value:"Overriding with projectSelector",id:"overriding-with-projectselector",level:3},{value:"Updating the workspace config",id:"updating-the-workspace-config",level:2},{value:"Using kusion to deploy your application with monitoring requirements",id:"using-kusion-to-deploy-your-application-with-monitoring-requirements",level:2},{value:"References",id:"references",level:2}],u={toc:l};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},u,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"configure-monitoring-behavior-with-prometheus"},"Configure Monitoring Behavior With Prometheus"),(0,r.kt)("p",null,"This document provides the step-by-step instruction to set up monitoring for your application. "),(0,r.kt)("p",null,"As of today, Kusion supports the configuration of Prometheus scraping behaviors for the target application. In the future, we will add more cloud-provider-native solutions, such as AWS CloudWatch, Azure Monitor, etc."),(0,r.kt)("p",null,"The user guide below is composed of the following components:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Namespace"),(0,r.kt)("li",{parentName:"ul"},"Deployment"),(0,r.kt)("li",{parentName:"ul"},"Service"),(0,r.kt)("li",{parentName:"ul"},"ServiceMonitor")),(0,r.kt)("admonition",{type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"This guide requires you to have a basic understanding of Kubernetes and Prometheus.\nIf you are not familiar with the relevant concepts, please refer to the links below:"),(0,r.kt)("ul",{parentName:"admonition"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/tutorials/kubernetes-basics/"},"Learn Kubernetes Basics")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"https://prometheus.io/docs/introduction/overview/"},"Prometheus Introduction")))),(0,r.kt)("h2",{id:"pre-requisite"},"Pre-requisite"),(0,r.kt)("p",null,"Please refer to the ",(0,r.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,r.kt)("p",null,"The example below also requires you to have ",(0,r.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#initializing"},"initialized the project")," using the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will generate a ",(0,r.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#kclmod"},(0,r.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the project directory."),(0,r.kt)("h2",{id:"setting-up-your-own-prometheus"},"Setting up your own Prometheus"),(0,r.kt)("p",null,"There a quite a few ways to set up Prometheus in your cluster:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Installing a Prometheus operator"),(0,r.kt)("li",{parentName:"ol"},"Installing a standalone Prometheus server"),(0,r.kt)("li",{parentName:"ol"},"Installing a Prometheus agent and connect to a remote Prometheus server")),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator/issues/1547#issuecomment-401092041"},"The advice from the Prometheus team")," is to use the ",(0,r.kt)("inlineCode",{parentName:"p"},"ServiceMonitor")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"PodMonitor")," CRs via the Prometheus operator to manage scrape configs going forward",(0,r.kt)("sup",null,"[2]"),"."),(0,r.kt)("p",null,"In either case, you only have to do this setup once per cluster. This doc will use a minikube cluster and Prometheus operator as an example."),(0,r.kt)("h3",{id:"installing-prometheus-operator3"},"Installing Prometheus operator",(0,r.kt)("sup",null,"[3]"),"."),(0,r.kt)("p",null,"To get the example in this user guide working, all you need is a running Prometheus operator. You can have that installed by running:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"LATEST=$(curl -s https://api.github.com/repos/prometheus-operator/prometheus-operator/releases/latest | jq -cr .tag_name)\ncurl -sL https://github.com/prometheus-operator/prometheus-operator/releases/download/${LATEST}/bundle.yaml | kubectl create -f -\n")),(0,r.kt)("p",null,"This will install all the necessary CRDs and the Prometheus operator itself in the default namespace. Wait a few minutes, you can confirm the operator is up by running: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kubectl wait --for=condition=Ready pods -l app.kubernetes.io/name=prometheus-operator -n default\n")),(0,r.kt)("h3",{id:"make-sure-rbac-is-properly-set-up"},"Make sure RBAC is properly set up"),(0,r.kt)("p",null,"If you have RBAC enabled on the cluster, the following must be created for Prometheus to work properly:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'apiVersion: v1\nkind: ServiceAccount\nmetadata:\n name: prometheus\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n name: prometheus\nrules:\n- apiGroups: [""]\n resources:\n - nodes\n - nodes/metrics\n - services\n - endpoints\n - pods\n verbs: ["get", "list", "watch"]\n- apiGroups: [""]\n resources:\n - configmaps\n verbs: ["get"]\n- apiGroups:\n - networking.k8s.io\n resources:\n - ingresses\n verbs: ["get", "list", "watch"]\n- nonResourceURLs: ["/metrics"]\n verbs: ["get"]\n---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n name: prometheus\nroleRef:\n apiGroup: rbac.authorization.k8s.io\n kind: ClusterRole\n name: prometheus\nsubjects:\n- kind: ServiceAccount\n name: prometheus\n namespace: default\n')),(0,r.kt)("h3",{id:"configure-prometheus-instance-via-the-operator"},"Configure Prometheus instance via the operator"),(0,r.kt)("p",null,"Once all of the above is set up, you can then configure the Prometheus instance via the operator:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"apiVersion: monitoring.coreos.com/v1\nkind: Prometheus\nmetadata:\n name: prometheus\nspec:\n serviceAccountName: prometheus\n serviceMonitorNamespaceSelector: {}\n serviceMonitorSelector: {}\n podMonitorNamespaceSelector: {}\n podMonitorSelector: {}\n resources:\n requests:\n memory: 400Mi\n")),(0,r.kt)("p",null,"This Prometheus instance above will be cluster-wide, picking up ALL the service monitors and pod monitors across ALL the namespaces.\nYou can adjust the requests and limits accordingly if you have a larger cluster."),(0,r.kt)("h3",{id:"exposing-the-prometheus-portal-optional"},"Exposing the Prometheus portal (optional)"),(0,r.kt)("p",null,"Once you have the managed Prometheus instance created via the Prometheus CR above, you should be able to see a service created called ",(0,r.kt)("inlineCode",{parentName:"p"},"prometheus-operated"),":"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"prometheus-operated",src:o(91512).Z,width:"631",height:"52"})),(0,r.kt)("p",null,"If you are also running on minikube, you can expose it onto your localhost via kubectl:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kubectl port-forward svc/prometheus-operated 9099:9090\n")),(0,r.kt)("p",null,"You should then be able to see the Prometheus portal via ",(0,r.kt)("inlineCode",{parentName:"p"},"localhost:9099")," in your browser:"),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"prometheus-portal",src:o(35443).Z,width:"2878",height:"1096"})),(0,r.kt)("p",null,"If you are running a non-local cluster, you can try to expose it via another way, through an ingress controller for example."),(0,r.kt)("h2",{id:"setting-up-workspace-configs"},"Setting up workspace configs"),(0,r.kt)("p",null,"Since v0.10.0, we have introduced the concept of ",(0,r.kt)("a",{parentName:"p",href:"/docs/concepts/workspace"},"workspaces"),", whose configurations represent the part of the application behaviors that platform teams are interested in standardizing, or the ones to eliminate from developer's mind to make their lives easier."),(0,r.kt)("p",null,"In the case of setting up Prometheus, there are a few things to set up on the workspace level:"),(0,r.kt)("h3",{id:"operator-mode"},"Operator mode"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," flag indicates to Kusion whether the Prometheus instance installed in the cluster runs as a Kubernetes operator or not. This determines the different kinds of resources Kusion manages."),(0,r.kt)("p",null,"To see more about different ways to run Prometheus in the Kubernetes cluster, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/prometheus.md#prometheus-installation"},"design documentation"),"."),(0,r.kt)("p",null,"Most cloud vendors provide an out-of-the-box monitoring solutions for workloads running in a managed-Kubernetes cluster (EKS, AKS, etc), such as AWS CloudWatch, Azure Monitor, etc. These solutions mostly involve installing an agent (CloudWatch Agent, OMS Agent, etc) in the cluster and collecting the metrics to a centralized monitoring server. In those cases, you don't need to set ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," to ",(0,r.kt)("inlineCode",{parentName:"p"},"True"),". It only needs to be set to ",(0,r.kt)("inlineCode",{parentName:"p"},"True")," when you have an installation of the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator"},"Prometheus operator")," running inside the Kubernetes cluster."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"For differences between ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator"},"Prometheus operator"),", ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/kube-prometheus"},"kube-prometheus")," and the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack"},"community kube-prometheus-stack helm chart"),", the details are documented ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/prometheus-operator/prometheus-operator#prometheus-operator-vs-kube-prometheus-vs-community-helm-chart"},"here"),".")),(0,r.kt)("h3",{id:"monitor-types"},"Monitor types"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"monitorType")," flag indicates the kind of monitor Kusion will create. It only applies when ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," is set to ",(0,r.kt)("inlineCode",{parentName:"p"},"True"),". As of version 0.10.0, Kusion provides options to scrape metrics from either the application pods or its corresponding Kubernetes services. This determines the different kinds of resources Kusion manages when Prometheus runs as an operator in the target cluster."),(0,r.kt)("p",null,"A sample ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," with Prometheus settings:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n ...\n kusionstack/monitoring@0.1.0:\n default:\n operatorMode: True\n monitorType: Service\n scheme: http\n interval: 30s\n timeout: 15s\n...\n")),(0,r.kt)("p",null,"To instruct Prometheus to scrape from pod targets instead:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n ...\n kusionstack/monitoring@0.1.0:\n default:\n operatorMode: True\n monitorType: Pod\n scheme: http\n interval: 30s\n timeout: 15s\n...\n")),(0,r.kt)("p",null,"If the ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," is omitted from the ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),", Kusion defaults ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," to false."),(0,r.kt)("h3",{id:"overriding-with-projectselector"},"Overriding with projectSelector"),(0,r.kt)("p",null,"Workspace configurations contain a set of default setting group for all projects in the workspace, with means to override them by Projects using a ",(0,r.kt)("inlineCode",{parentName:"p"},"projectSelector")," keyword."),(0,r.kt)("p",null,"Projects with the name matching those in projectSelector will use the values defined in that override group instead of the default. If a key is not present in the override group, the default value will be used."),(0,r.kt)("p",null,"Take a look at the sample ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n ...\n kusionstack/monitoring@0.1.0:\n default:\n operatorMode: True\n monitorType: Pod\n scheme: http\n interval: 30s\n timeout: 15s\n low_frequency:\n operatorMode: False\n interval: 2m\n projectSelector:\n - foobar\n high_frequency:\n monitorType: Service\n projectSelector:\n - helloworld\n...\n")),(0,r.kt)("p",null,"In the example above, a project with the name ",(0,r.kt)("inlineCode",{parentName:"p"},"helloworld")," will have the monitoring settings where ",(0,r.kt)("inlineCode",{parentName:"p"},"operatorMode")," is set to ",(0,r.kt)("inlineCode",{parentName:"p"},"False"),", a 2 minute scraping interval, 15 seconds timeout (coming from default) and http scheme (coming from default)."),(0,r.kt)("p",null,"You cannot have the same project appear in two projectSelectors."),(0,r.kt)("p",null,"For a full reference of what can be configured in the workspace level, please see the ",(0,r.kt)("a",{parentName:"p",href:"../../reference/modules/workspace-configs/monitoring/prometheus"},"workspace reference"),"."),(0,r.kt)("h2",{id:"updating-the-workspace-config"},"Updating the workspace config"),(0,r.kt)("p",null,"Assuming you now have a ",(0,r.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," that looks like the following:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n kusionstack/monitoring@0.1.0:\n default:\n operatorMode: True\n monitorType: Service\n scheme: http\n interval: 30s\n timeout: 15s\n...\n")),(0,r.kt)("p",null,"Update the workspace configuration by running the following command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kusion workspace update dev -f workspace.yaml\n")),(0,r.kt)("p",null,"Verify the workspace config is properly updated by running the command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kusion workspace show dev\n")),(0,r.kt)("h2",{id:"using-kusion-to-deploy-your-application-with-monitoring-requirements"},"Using kusion to deploy your application with monitoring requirements"),(0,r.kt)("p",null,"At this point we are set up for good! Any new applications you deploy via kusion will now automatically have the monitoring-related resources created, should you declare you want it via the ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," field in the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model."),(0,r.kt)("p",null,"The monitoring in an AppConfiguration is declared in the ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," field. See the example below for a full, deployable AppConfiguration."),(0,r.kt)("p",null,"Please note we are using a new image ",(0,r.kt)("inlineCode",{parentName:"p"},"quay.io/brancz/prometheus-example-app")," since the app itself need to expose metrics for Prometheus to scrape:"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"helloworld/dev/kcl.mod"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'[package]\nname = "helloworld"\n\n[dependencies]\nmonitoring = { oci = "oci://ghcr.io/kusionstack/monitoring", tag = "0.1.0" }\nkam = { git = "https://github.com/KusionStack/kam.git", tag = "0.1.0" }\n\n[profile]\nentries = ["main.k"]\n')),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"helloworld/dev/main.k"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport monitoring as m\nimport network.network as n\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "monitoring-sample-app": c.Container {\n image: "quay.io/brancz/prometheus-example-app:v0.3.0"\n }\n }\n }\n # Add the monitoring configuration backed by Prometheus\n accessories: {\n "monitoring": m.Prometheus {\n path: "/metrics"\n }\n "network": n.Network {\n ports: [\n n.Port {\n port: 8080\n }\n ]\n }\n }\n}\n')),(0,r.kt)("p",null,"The KCL file above represents an application with a service type workload, exposing the port 8080, and would like Prometheus to scrape the ",(0,r.kt)("inlineCode",{parentName:"p"},"/metrics")," endpoint every 2 minutes."),(0,r.kt)("p",null,"Running ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion apply")," would show that kusion will create a ",(0,r.kt)("inlineCode",{parentName:"p"},"Namespace"),", a ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployment"),", a ",(0,r.kt)("inlineCode",{parentName:"p"},"Service")," and a ",(0,r.kt)("inlineCode",{parentName:"p"},"ServiceMonitor"),":\n",(0,r.kt)("img",{alt:"kusion-apply-with-monitor",src:o(448).Z,width:"705",height:"224"})),(0,r.kt)("p",null,"Continue applying all resources:\n",(0,r.kt)("img",{alt:"kusion-apply-success",src:o(56816).Z,width:"1047",height:"564"})),(0,r.kt)("p",null,"If we want to, we can verify the service monitor has been created successfully:\n",(0,r.kt)("img",{alt:"service-monitor",src:o(58232).Z,width:"693",height:"463"})),(0,r.kt)("p",null,"In a few seconds, you should be able to see in the Prometheus portal that the service we just deployed has now been discovered and monitored by Prometheus:\n",(0,r.kt)("img",{alt:"prometheus-targets",src:o(87594).Z,width:"2880",height:"1636"})),(0,r.kt)("p",null,"You can run a few simply queries for the data that Prometheus scraped from your application:\n",(0,r.kt)("img",{alt:"prometheus-simple-query",src:o(87695).Z,width:"2880",height:"1634"})),(0,r.kt)("p",null,"For more info about PromQL, you can find them ",(0,r.kt)("a",{parentName:"p",href:"https://prometheus.io/docs/prometheus/latest/querying/basics/"},"here"),(0,r.kt)("sup",null,"[4]"),"."),(0,r.kt)("h2",{id:"references"},"References"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Prometheus: ",(0,r.kt)("a",{parentName:"li",href:"https://prometheus.io/docs/introduction/overview/"},"https://prometheus.io/docs/introduction/overview/")),(0,r.kt)("li",{parentName:"ol"},"Prometheus team advise: ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/prometheus-operator/prometheus-operator/issues/1547#issuecomment-446691500"},"https://github.com/prometheus-operator/prometheus-operator/issues/1547#issuecomment-446691500")),(0,r.kt)("li",{parentName:"ol"},"Prometheus operator getting started doc: ",(0,r.kt)("a",{parentName:"li",href:"https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md"},"https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/getting-started.md")),(0,r.kt)("li",{parentName:"ol"},"PromQL basics: ",(0,r.kt)("a",{parentName:"li",href:"https://prometheus.io/docs/prometheus/latest/querying/basics/"},"https://prometheus.io/docs/prometheus/latest/querying/basics/"))))}m.isMDXComponent=!0},56816:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/kusion-apply-success-52d04db670fd184959c3ea5c9e54f69d.png"},448:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/kusion-apply-with-monitor-d27cd1443e1a324d514983d52c055b15.png"},91512:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-operated-4cf8308703e4ec9d06a5078bbceb8d5d.png"},35443:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-portal-b60d8654c309e675fc04f1e74c5c127a.png"},87695:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-simple-query-60205589e762105ebc850e70d8ea7b56.png"},87594:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/prometheus-targets-05964bad58af16f2e02c57cafa8565e7.png"},58232:(e,t,o)=>{o.d(t,{Z:()=>n});const n=o.p+"assets/images/service-monitor-2374625bfd1180a978a2be50ad4648ce.png"}}]); \ No newline at end of file diff --git a/assets/js/c3570998.03ff44e5.js b/assets/js/c3570998.03ff44e5.js deleted file mode 100644 index f6fab52fb86..00000000000 --- a/assets/js/c3570998.03ff44e5.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9083],{3905:(t,e,a)=>{a.d(e,{Zo:()=>s,kt:()=>c});var n=a(67294);function r(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function l(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function i(t){for(var e=1;e=0||(r[a]=t[a]);return r}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}var p=n.createContext({}),d=function(t){var e=n.useContext(p),a=e;return t&&(a="function"==typeof t?t(e):i(i({},e),t)),a},s=function(t){var e=d(t.components);return n.createElement(p.Provider,{value:e},t.children)},m={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},u=n.forwardRef((function(t,e){var a=t.components,r=t.mdxType,l=t.originalType,p=t.parentName,s=o(t,["components","mdxType","originalType","parentName"]),u=d(a),c=r,k=u["".concat(p,".").concat(c)]||u[c]||m[c]||l;return a?n.createElement(k,i(i({ref:e},s),{},{components:a})):n.createElement(k,i({ref:e},s))}));function c(t,e){var a=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var l=a.length,i=new Array(l);i[0]=u;var o={};for(var p in e)hasOwnProperty.call(e,p)&&(o[p]=e[p]);o.originalType=t,o.mdxType="string"==typeof t?t:r,i[1]=o;for(var d=2;d{a.r(e),a.d(e,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>o,toc:()=>d});var n=a(87462),r=(a(67294),a(3905));const l={},i="Service",o={unversionedId:"reference/model/catalog_models/workload/doc_service",id:"version-v0.9/reference/model/catalog_models/workload/doc_service",title:"Service",description:"Schemas",source:"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/workload/doc_service.md",sourceDirName:"reference/model/catalog_models/workload",slug:"/reference/model/catalog_models/workload/doc_service",permalink:"/docs/v0.9/reference/model/catalog_models/workload/doc_service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/catalog_models/workload/doc_service.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Job",permalink:"/docs/v0.9/reference/model/catalog_models/workload/doc_job"},next:{title:"database",permalink:"/docs/v0.9/reference/model/catalog_models/database/doc_database"}},p={},d=[{value:"Schemas",id:"schemas",level:2},{value:"Schema Service",id:"schema-service",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Base Schema",id:"base-schema",level:3},{value:"Schema Container",id:"schema-container",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3},{value:"Schema FileSpec",id:"schema-filespec",level:2},{value:"Attributes",id:"attributes-2",level:3},{value:"Examples",id:"examples-2",level:3},{value:"Schema Probe",id:"schema-probe",level:2},{value:"Attributes",id:"attributes-3",level:3},{value:"Examples",id:"examples-3",level:3},{value:"Schema Exec",id:"schema-exec",level:2},{value:"Attributes",id:"attributes-4",level:3},{value:"Examples",id:"examples-4",level:3},{value:"Schema Http",id:"schema-http",level:2},{value:"Attributes",id:"attributes-5",level:3},{value:"Examples",id:"examples-5",level:3},{value:"Schema Tcp",id:"schema-tcp",level:2},{value:"Attributes",id:"attributes-6",level:3},{value:"Examples",id:"examples-6",level:3},{value:"Schema Lifecycle",id:"schema-lifecycle",level:2},{value:"Attributes",id:"attributes-7",level:3},{value:"Examples",id:"examples-7",level:3},{value:"Schema Secret",id:"schema-secret",level:2},{value:"Attributes",id:"attributes-8",level:3},{value:"Examples",id:"examples-8",level:3},{value:"Schema Port",id:"schema-port",level:2},{value:"Attributes",id:"attributes-9",level:3},{value:"Examples",id:"examples-9",level:3}],s={toc:d};function m(t){let{components:e,...a}=t;return(0,r.kt)("wrapper",(0,n.Z)({},s,a,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"service"},"Service"),(0,r.kt)("h2",{id:"schemas"},"Schemas"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-service"},"Service"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-container"},"Container"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-filespec"},"Filespec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-lifecycle"},"LifeCycle")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-probe"},"Probe"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-exec"},"Exec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-http"},"Http")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-tcp"},"Tcp")))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-secret"},"Secret")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-port"},"Port"))))),(0,r.kt)("h2",{id:"schema-service"},"Schema Service"),(0,r.kt)("p",null,"Service is a kind of workload profile that describes how to run your application code. This",(0,r.kt)("br",null),'is typically used for long-running web applications that should "never" go down, and handle',(0,r.kt)("br",null),"short-lived latency-sensitive web requests, or events."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"containers"),(0,r.kt)("br",null),"Containers defines the templates of containers to be ran.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers"},"https://kubernetes.io/docs/concepts/containers")),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-container"},"container.Container"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"replicas"),(0,r.kt)("br",null),"Number of container replicas based on this configuration that should be ran."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"2"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"ports"),(0,r.kt)("br",null),"The list of ports of the Service should get exposed."),(0,r.kt)("td",{parentName:"tr",align:null},"[",(0,r.kt)("a",{parentName:"td",href:"#schema-port"},"network.Port"),"]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"secrets")),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-secret"},"secret.Secret"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"labels"),(0,r.kt)("br",null),"Labels are key/value pairs that are attached to the workload."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"annotations"),(0,r.kt)("br",null),"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type"),(0,r.kt)("br",null),"Type represents the type of workload used by this Service. Currently, it supports several",(0,r.kt)("br",null),"types, including Deployment and CollaSet."),(0,r.kt)("td",{parentName:"tr",align:null},'"Deployment" ',"|",' "CollaSet"'),(0,r.kt)("td",{parentName:"tr",align:null},"Deployment"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'# Instantiate a long-running service and its image is "nginx:v1"\n\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\n\nsvc = wl.Service {\n containers: {\n "nginx": c.Container {\n image: "nginx:v1"\n }\n }\n ports: [\n n.Port {\n port: 80\n public: True\n }\n n.Port {\n port: 9090\n }\n ]\n}\n')),(0,r.kt)("h3",{id:"base-schema"},"Base Schema"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/v0.9/reference/model/catalog_models/internal/doc_common#schema-workloadbase"},"WorkloadBase")),(0,r.kt)("h2",{id:"schema-container"},"Schema Container"),(0,r.kt)("p",null,"Container describes how the Application's tasks are expected to be run. Depending on",(0,r.kt)("br",null),"the replicas parameter 1 or more containers can be created from each template."),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"image"),(0,r.kt)("br",null),"Image refers to the Docker image name to run for this container.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/images"},"https://kubernetes.io/docs/concepts/containers/images")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command"),(0,r.kt)("br",null),"Entrypoint array. Not executed within a shell.",(0,r.kt)("br",null),"Command will overwrite the ENTRYPOINT value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's ENTRYPOINT is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"args"),(0,r.kt)("br",null),"Arguments to the entrypoint.",(0,r.kt)("br",null),"Args will overwrite the CMD value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's CMD is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"env"),(0,r.kt)("br",null),"List of environment variables to set in the container.",(0,r.kt)("br",null),"The value of the environment variable may be static text or a value from a secret."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"workingDir"),(0,r.kt)("br",null),"The working directory of the running process defined in entrypoint.",(0,r.kt)("br",null),"Default container runtime will be used if this is not specified."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"resources"),(0,r.kt)("br",null),"Map of resource requirements the container should run with.",(0,r.kt)("br",null),"The resources parameter is a dict with the key being the resource name and the value being",(0,r.kt)("br",null),"the resource value."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"files"),(0,r.kt)("br",null),"List of files to create in the container.",(0,r.kt)("br",null),"The files parameter is a dict with the key being the file name in the container and the value",(0,r.kt)("br",null),"being the target file specification."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-filespec"},"container.FileSpec"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"dirs"),(0,r.kt)("br",null),"Collection of volumes mount into the container's filesystem.",(0,r.kt)("br",null),"The dirs parameter is a dict with the key being the folder name in the container and the value",(0,r.kt)("br",null),"being the referenced volume."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"livenessProbe"),(0,r.kt)("br",null),"LivenessProbe indicates if a running process is healthy.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"readinessProbe"),(0,r.kt)("br",null),"ReadinessProbe indicates whether an application is available to handle requests."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"startupProbe"),(0,r.kt)("br",null),"StartupProbe indicates that the container has started for the first time.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"lifecycle"),(0,r.kt)("br",null),"Lifecycle refers to actions that the management system should take in response to container lifecycle events."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-lifecycle"},"lc.Lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container as c\n\nweb = c.Container {\n image: "nginx:latest"\n command: ["/bin/sh", "-c", "echo hi"]\n env: {\n "name": "value"\n }\n resources: {\n "cpu": "2"\n "memory": "4Gi"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-filespec"},"Schema FileSpec"),(0,r.kt)("p",null,"FileSpec defines the target file in a Container."),(0,r.kt)("h3",{id:"attributes-2"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"mode"),(0,r.kt)("br",null),"Mode bits used to set permissions on this file, must be an octal value",(0,r.kt)("br",null),"between 0000 and 0777 or a decimal value between 0 and 511"),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"content"),(0,r.kt)("br",null),"File content in plain text."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"contentFrom"),(0,r.kt)("br",null),"Source for the file content, reference to a secret of configmap value."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-2"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container as c\n\ntmpFile = c.FileSpec {\n content: "some file contents"\n mode: "0777"\n}\n')),(0,r.kt)("h2",{id:"schema-probe"},"Schema Probe"),(0,r.kt)("p",null,"Probe describes a health check to be performed against a container to determine whether it is",(0,r.kt)("br",null),"alive or ready to receive traffic. There are three probe types: readiness, liveness, and startup."),(0,r.kt)("h3",{id:"attributes-3"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"probeHandler"),(0,r.kt)("br",null),"The action taken to determine the alive or health of a container"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-tcp"},"probe.Tcp")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"initialDelaySeconds"),(0,r.kt)("br",null),"The number of seconds before health checking is activated.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle%5C#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle\\#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"timeoutSeconds"),(0,r.kt)("br",null),"The number of seconds after which the probe times out.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle%5C#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle\\#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"periodSeconds"),(0,r.kt)("br",null),"How often (in seconds) to perform the probe."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"successThreshold"),(0,r.kt)("br",null),"Minimum consecutive successes for the probe to be considered successful after having failed."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"failureThreshold"),(0,r.kt)("br",null),"Minimum consecutive failures for the probe to be considered failed after having succeeded."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"terminationGracePeriod")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-3"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nprobe = p.Probe {\n probeHandler: p.Http {\n path: "/healthz"\n }\n initialDelaySeconds: 10\n}\n')),(0,r.kt)("h2",{id:"schema-exec"},"Schema Exec"),(0,r.kt)("p",null,'Exec describes a "run in container" action.'),(0,r.kt)("h3",{id:"attributes-4"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command"),(0,r.kt)("br",null),"The command line to execute inside the container."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-4"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nexecProbe = p.Exec {\n command: ["probe.sh"]\n}\n')),(0,r.kt)("h2",{id:"schema-http"},"Schema Http"),(0,r.kt)("p",null,"Http describes an action based on HTTP Get requests."),(0,r.kt)("h3",{id:"attributes-5"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url"),(0,r.kt)("br",null),"The full qualified url to send HTTP requests."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"headers"),(0,r.kt)("br",null),"Collection of custom headers to set in the request"),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-5"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nhttpProbe = p.Http {\n url: "http://localhost:80"\n headers: {\n "X-HEADER": "VALUE"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-tcp"},"Schema Tcp"),(0,r.kt)("p",null,"Tcp describes an action based on opening a socket."),(0,r.kt)("h3",{id:"attributes-6"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url"),(0,r.kt)("br",null),"The full qualified url to open a socket."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-6"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\ntcpProbe = p.Tcp {\n url: "tcp://localhost:1234"\n}\n')),(0,r.kt)("h2",{id:"schema-lifecycle"},"Schema Lifecycle"),(0,r.kt)("p",null,"Lifecycle describes actions that the management system should take in response",(0,r.kt)("br",null),"to container lifecycle events."),(0,r.kt)("h3",{id:"attributes-7"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"preStop"),(0,r.kt)("br",null),"The action to be taken before a container is terminated due to an API request or",(0,r.kt)("br",null),"management event such as liveness/startup probe failure, preemption, resource contention, etc.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/%5C#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/\\#container-hooks")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"postStart"),(0,r.kt)("br",null),"The action to be taken after a container is created.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/%5C#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/\\#container-hooks")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-7"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.container.lifecycle as lc\n\nlifecycleHook = lc.Lifecycle {\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n postStart: p.Http {\n url: "http://localhost:80"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-secret"},"Schema Secret"),(0,r.kt)("p",null,"Secret can be used to store sensitive data."),(0,r.kt)("h3",{id:"attributes-8"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type"),(0,r.kt)("br",null),"Type of secret, used to facilitate programmatic handling of secret data.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/configuration/secret/%5C#secret-types"},"https://kubernetes.io/docs/concepts/configuration/secret/\\#secret-types")),(0,r.kt)("td",{parentName:"tr",align:null},'"basic" ',"|",' "opaque"'),(0,r.kt)("td",{parentName:"tr",align:null},"opaque"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"data"),(0,r.kt)("br",null),"Data contains the non-binary secret data in string form."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"immutable"),(0,r.kt)("br",null),"Immutable, if set to true, ensures that data stored in the Secret cannot be updated."),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-8"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.secret as sec\n\nbasicAuth = sec.Secret {\n type: "basic"\n data: {\n "username": ""\n "password": ""\n }\n}\n')),(0,r.kt)("h2",{id:"schema-port"},"Schema Port"),(0,r.kt)("p",null,"Port defines the exposed port of Service, which can be used to describe how the Service",(0,r.kt)("br",null),"get accessed."),(0,r.kt)("h3",{id:"attributes-9"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"port"),(0,r.kt)("br",null),"The exposed port of the Service."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"80"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"protocol"),(0,r.kt)("br",null),"The protocol to access the port."),(0,r.kt)("td",{parentName:"tr",align:null},'"TCP" ',"|",' "UDP"'),(0,r.kt)("td",{parentName:"tr",align:null},'"TCP"'),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"public"),(0,r.kt)("br",null),"Public defines whether the port can be accessed through Internet."),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"False"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"targetPort"),(0,r.kt)("br",null),"The backend container port. If empty, set it the same as the port."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-9"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.network as n\n\nport = n.Port {\n port: 80\n targetPort: 8080\n protocol: "TCP"\n public: True\n}\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c3570998.3c700b8c.js b/assets/js/c3570998.3c700b8c.js new file mode 100644 index 00000000000..dddd2f70b67 --- /dev/null +++ b/assets/js/c3570998.3c700b8c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9083],{3905:(t,e,a)=>{a.d(e,{Zo:()=>s,kt:()=>c});var n=a(67294);function r(t,e,a){return e in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}function l(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,n)}return a}function i(t){for(var e=1;e=0||(r[a]=t[a]);return r}(t,e);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,a)&&(r[a]=t[a])}return r}var p=n.createContext({}),d=function(t){var e=n.useContext(p),a=e;return t&&(a="function"==typeof t?t(e):i(i({},e),t)),a},s=function(t){var e=d(t.components);return n.createElement(p.Provider,{value:e},t.children)},m={inlineCode:"code",wrapper:function(t){var e=t.children;return n.createElement(n.Fragment,{},e)}},u=n.forwardRef((function(t,e){var a=t.components,r=t.mdxType,l=t.originalType,p=t.parentName,s=o(t,["components","mdxType","originalType","parentName"]),u=d(a),c=r,k=u["".concat(p,".").concat(c)]||u[c]||m[c]||l;return a?n.createElement(k,i(i({ref:e},s),{},{components:a})):n.createElement(k,i({ref:e},s))}));function c(t,e){var a=arguments,r=e&&e.mdxType;if("string"==typeof t||r){var l=a.length,i=new Array(l);i[0]=u;var o={};for(var p in e)hasOwnProperty.call(e,p)&&(o[p]=e[p]);o.originalType=t,o.mdxType="string"==typeof t?t:r,i[1]=o;for(var d=2;d{a.r(e),a.d(e,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>o,toc:()=>d});var n=a(87462),r=(a(67294),a(3905));const l={},i="Service",o={unversionedId:"reference/model/catalog_models/workload/doc_service",id:"version-v0.9/reference/model/catalog_models/workload/doc_service",title:"Service",description:"Schemas",source:"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/workload/doc_service.md",sourceDirName:"reference/model/catalog_models/workload",slug:"/reference/model/catalog_models/workload/doc_service",permalink:"/docs/v0.9/reference/model/catalog_models/workload/doc_service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/catalog_models/workload/doc_service.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Job",permalink:"/docs/v0.9/reference/model/catalog_models/workload/doc_job"},next:{title:"database",permalink:"/docs/v0.9/reference/model/catalog_models/database/doc_database"}},p={},d=[{value:"Schemas",id:"schemas",level:2},{value:"Schema Service",id:"schema-service",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Base Schema",id:"base-schema",level:3},{value:"Schema Container",id:"schema-container",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3},{value:"Schema FileSpec",id:"schema-filespec",level:2},{value:"Attributes",id:"attributes-2",level:3},{value:"Examples",id:"examples-2",level:3},{value:"Schema Probe",id:"schema-probe",level:2},{value:"Attributes",id:"attributes-3",level:3},{value:"Examples",id:"examples-3",level:3},{value:"Schema Exec",id:"schema-exec",level:2},{value:"Attributes",id:"attributes-4",level:3},{value:"Examples",id:"examples-4",level:3},{value:"Schema Http",id:"schema-http",level:2},{value:"Attributes",id:"attributes-5",level:3},{value:"Examples",id:"examples-5",level:3},{value:"Schema Tcp",id:"schema-tcp",level:2},{value:"Attributes",id:"attributes-6",level:3},{value:"Examples",id:"examples-6",level:3},{value:"Schema Lifecycle",id:"schema-lifecycle",level:2},{value:"Attributes",id:"attributes-7",level:3},{value:"Examples",id:"examples-7",level:3},{value:"Schema Secret",id:"schema-secret",level:2},{value:"Attributes",id:"attributes-8",level:3},{value:"Examples",id:"examples-8",level:3},{value:"Schema Port",id:"schema-port",level:2},{value:"Attributes",id:"attributes-9",level:3},{value:"Examples",id:"examples-9",level:3}],s={toc:d};function m(t){let{components:e,...a}=t;return(0,r.kt)("wrapper",(0,n.Z)({},s,a,{components:e,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"service"},"Service"),(0,r.kt)("h2",{id:"schemas"},"Schemas"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-service"},"Service"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-container"},"Container"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-filespec"},"Filespec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-lifecycle"},"LifeCycle")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-probe"},"Probe"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-exec"},"Exec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-http"},"Http")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-tcp"},"Tcp")))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-secret"},"Secret")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-port"},"Port"))))),(0,r.kt)("h2",{id:"schema-service"},"Schema Service"),(0,r.kt)("p",null,"Service is a kind of workload profile that describes how to run your application code. This",(0,r.kt)("br",null),'is typically used for long-running web applications that should "never" go down, and handle',(0,r.kt)("br",null),"short-lived latency-sensitive web requests, or events."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"containers"),(0,r.kt)("br",null),"Containers defines the templates of containers to be ran.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers"},"https://kubernetes.io/docs/concepts/containers")),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-container"},"container.Container"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"replicas"),(0,r.kt)("br",null),"Number of container replicas based on this configuration that should be ran."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"2"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"ports"),(0,r.kt)("br",null),"The list of ports of the Service should get exposed."),(0,r.kt)("td",{parentName:"tr",align:null},"[",(0,r.kt)("a",{parentName:"td",href:"#schema-port"},"network.Port"),"]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"secrets")),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-secret"},"secret.Secret"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"labels"),(0,r.kt)("br",null),"Labels are key/value pairs that are attached to the workload."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"annotations"),(0,r.kt)("br",null),"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type"),(0,r.kt)("br",null),"Type represents the type of workload used by this Service. Currently, it supports several",(0,r.kt)("br",null),"types, including Deployment and CollaSet."),(0,r.kt)("td",{parentName:"tr",align:null},'"Deployment" ',"|",' "CollaSet"'),(0,r.kt)("td",{parentName:"tr",align:null},"Deployment"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'# Instantiate a long-running service and its image is "nginx:v1"\n\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\n\nsvc = wl.Service {\n containers: {\n "nginx": c.Container {\n image: "nginx:v1"\n }\n }\n ports: [\n n.Port {\n port: 80\n public: True\n }\n n.Port {\n port: 9090\n }\n ]\n}\n')),(0,r.kt)("h3",{id:"base-schema"},"Base Schema"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/v0.9/reference/model/catalog_models/internal/doc_common#schema-workloadbase"},"WorkloadBase")),(0,r.kt)("h2",{id:"schema-container"},"Schema Container"),(0,r.kt)("p",null,"Container describes how the Application's tasks are expected to be run. Depending on",(0,r.kt)("br",null),"the replicas parameter 1 or more containers can be created from each template."),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"image"),(0,r.kt)("br",null),"Image refers to the Docker image name to run for this container.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/images"},"https://kubernetes.io/docs/concepts/containers/images")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command"),(0,r.kt)("br",null),"Entrypoint array. Not executed within a shell.",(0,r.kt)("br",null),"Command will overwrite the ENTRYPOINT value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's ENTRYPOINT is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"args"),(0,r.kt)("br",null),"Arguments to the entrypoint.",(0,r.kt)("br",null),"Args will overwrite the CMD value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's CMD is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"env"),(0,r.kt)("br",null),"List of environment variables to set in the container.",(0,r.kt)("br",null),"The value of the environment variable may be static text or a value from a secret."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"workingDir"),(0,r.kt)("br",null),"The working directory of the running process defined in entrypoint.",(0,r.kt)("br",null),"Default container runtime will be used if this is not specified."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"resources"),(0,r.kt)("br",null),"Map of resource requirements the container should run with.",(0,r.kt)("br",null),"The resources parameter is a dict with the key being the resource name and the value being",(0,r.kt)("br",null),"the resource value."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"files"),(0,r.kt)("br",null),"List of files to create in the container.",(0,r.kt)("br",null),"The files parameter is a dict with the key being the file name in the container and the value",(0,r.kt)("br",null),"being the target file specification."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"#schema-filespec"},"container.FileSpec"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"dirs"),(0,r.kt)("br",null),"Collection of volumes mount into the container's filesystem.",(0,r.kt)("br",null),"The dirs parameter is a dict with the key being the folder name in the container and the value",(0,r.kt)("br",null),"being the referenced volume."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"livenessProbe"),(0,r.kt)("br",null),"LivenessProbe indicates if a running process is healthy.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"readinessProbe"),(0,r.kt)("br",null),"ReadinessProbe indicates whether an application is available to handle requests."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"startupProbe"),(0,r.kt)("br",null),"StartupProbe indicates that the container has started for the first time.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"lifecycle"),(0,r.kt)("br",null),"Lifecycle refers to actions that the management system should take in response to container lifecycle events."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-lifecycle"},"lc.Lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container as c\n\nweb = c.Container {\n image: "nginx:latest"\n command: ["/bin/sh", "-c", "echo hi"]\n env: {\n "name": "value"\n }\n resources: {\n "cpu": "2"\n "memory": "4Gi"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-filespec"},"Schema FileSpec"),(0,r.kt)("p",null,"FileSpec defines the target file in a Container."),(0,r.kt)("h3",{id:"attributes-2"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"mode"),(0,r.kt)("br",null),"Mode bits used to set permissions on this file, must be an octal value",(0,r.kt)("br",null),"between 0000 and 0777 or a decimal value between 0 and 511"),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"content"),(0,r.kt)("br",null),"File content in plain text."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"contentFrom"),(0,r.kt)("br",null),"Source for the file content, reference to a secret of configmap value."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-2"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container as c\n\ntmpFile = c.FileSpec {\n content: "some file contents"\n mode: "0777"\n}\n')),(0,r.kt)("h2",{id:"schema-probe"},"Schema Probe"),(0,r.kt)("p",null,"Probe describes a health check to be performed against a container to determine whether it is",(0,r.kt)("br",null),"alive or ready to receive traffic. There are three probe types: readiness, liveness, and startup."),(0,r.kt)("h3",{id:"attributes-3"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"probeHandler"),(0,r.kt)("br",null),"The action taken to determine the alive or health of a container"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-tcp"},"probe.Tcp")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"initialDelaySeconds"),(0,r.kt)("br",null),"The number of seconds before health checking is activated.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle%5C#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle\\#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"timeoutSeconds"),(0,r.kt)("br",null),"The number of seconds after which the probe times out.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle%5C#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle\\#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"periodSeconds"),(0,r.kt)("br",null),"How often (in seconds) to perform the probe."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"successThreshold"),(0,r.kt)("br",null),"Minimum consecutive successes for the probe to be considered successful after having failed."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"failureThreshold"),(0,r.kt)("br",null),"Minimum consecutive failures for the probe to be considered failed after having succeeded."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"terminationGracePeriod")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-3"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nprobe = p.Probe {\n probeHandler: p.Http {\n path: "/healthz"\n }\n initialDelaySeconds: 10\n}\n')),(0,r.kt)("h2",{id:"schema-exec"},"Schema Exec"),(0,r.kt)("p",null,'Exec describes a "run in container" action.'),(0,r.kt)("h3",{id:"attributes-4"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command"),(0,r.kt)("br",null),"The command line to execute inside the container."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-4"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nexecProbe = p.Exec {\n command: ["probe.sh"]\n}\n')),(0,r.kt)("h2",{id:"schema-http"},"Schema Http"),(0,r.kt)("p",null,"Http describes an action based on HTTP Get requests."),(0,r.kt)("h3",{id:"attributes-5"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url"),(0,r.kt)("br",null),"The full qualified url to send HTTP requests."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"headers"),(0,r.kt)("br",null),"Collection of custom headers to set in the request"),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-5"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\nhttpProbe = p.Http {\n url: "http://localhost:80"\n headers: {\n "X-HEADER": "VALUE"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-tcp"},"Schema Tcp"),(0,r.kt)("p",null,"Tcp describes an action based on opening a socket."),(0,r.kt)("h3",{id:"attributes-6"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url"),(0,r.kt)("br",null),"The full qualified url to open a socket."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))))),(0,r.kt)("h3",{id:"examples-6"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\n\ntcpProbe = p.Tcp {\n url: "tcp://localhost:1234"\n}\n')),(0,r.kt)("h2",{id:"schema-lifecycle"},"Schema Lifecycle"),(0,r.kt)("p",null,"Lifecycle describes actions that the management system should take in response",(0,r.kt)("br",null),"to container lifecycle events."),(0,r.kt)("h3",{id:"attributes-7"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"preStop"),(0,r.kt)("br",null),"The action to be taken before a container is terminated due to an API request or",(0,r.kt)("br",null),"management event such as liveness/startup probe failure, preemption, resource contention, etc.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/%5C#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/\\#container-hooks")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"postStart"),(0,r.kt)("br",null),"The action to be taken after a container is created.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/%5C#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/\\#container-hooks")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#schema-exec"},"probe.Exec")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"#schema-http"},"probe.Http")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-7"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.container.lifecycle as lc\n\nlifecycleHook = lc.Lifecycle {\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n postStart: p.Http {\n url: "http://localhost:80"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-secret"},"Schema Secret"),(0,r.kt)("p",null,"Secret can be used to store sensitive data."),(0,r.kt)("h3",{id:"attributes-8"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type"),(0,r.kt)("br",null),"Type of secret, used to facilitate programmatic handling of secret data.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/configuration/secret/%5C#secret-types"},"https://kubernetes.io/docs/concepts/configuration/secret/\\#secret-types")),(0,r.kt)("td",{parentName:"tr",align:null},'"basic" ',"|",' "opaque"'),(0,r.kt)("td",{parentName:"tr",align:null},"opaque"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"data"),(0,r.kt)("br",null),"Data contains the non-binary secret data in string form."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"immutable"),(0,r.kt)("br",null),"Immutable, if set to true, ensures that data stored in the Secret cannot be updated."),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-8"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.secret as sec\n\nbasicAuth = sec.Secret {\n type: "basic"\n data: {\n "username": ""\n "password": ""\n }\n}\n')),(0,r.kt)("h2",{id:"schema-port"},"Schema Port"),(0,r.kt)("p",null,"Port defines the exposed port of Service, which can be used to describe how the Service",(0,r.kt)("br",null),"get accessed."),(0,r.kt)("h3",{id:"attributes-9"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"port"),(0,r.kt)("br",null),"The exposed port of the Service."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"80"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"protocol"),(0,r.kt)("br",null),"The protocol to access the port."),(0,r.kt)("td",{parentName:"tr",align:null},'"TCP" ',"|",' "UDP"'),(0,r.kt)("td",{parentName:"tr",align:null},'"TCP"'),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"public"),(0,r.kt)("br",null),"Public defines whether the port can be accessed through Internet."),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"False"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"targetPort"),(0,r.kt)("br",null),"The backend container port. If empty, set it the same as the port."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples-9"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.network as n\n\nport = n.Port {\n port: 80\n targetPort: 8080\n protocol: "TCP"\n public: True\n}\n')))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c3d74b12.947e859a.js b/assets/js/c3d74b12.947e859a.js new file mode 100644 index 00000000000..b39d7c8af83 --- /dev/null +++ b/assets/js/c3d74b12.947e859a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3496],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),p=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=p(n),m=r,h=u["".concat(l,".").concat(m)]||u[m]||c[m]||o;return n?a.createElement(h,s(s({ref:t},d),{},{components:n})):a.createElement(h,s({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,s=new Array(o);s[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:2},s="Deliver the WordPress Application on Kubernetes",i={unversionedId:"getting-started/deliver-wordpress",id:"version-v0.9/getting-started/deliver-wordpress",title:"Deliver the WordPress Application on Kubernetes",description:"In this tutorial we will walk through how to deploy a WordPress application on Kubernetes with Kusion. The WordPress application will interact with MySQL, which is declared as a database accessory in the config codes and will be automatically created and managed by Kusion.",source:"@site/docs_versioned_docs/version-v0.9/getting-started/deliver-wordpress.md",sourceDirName:"getting-started",slug:"/getting-started/deliver-wordpress",permalink:"/docs/v0.9/getting-started/deliver-wordpress",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/getting-started/deliver-wordpress.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"kusion",previous:{title:"Install Kusion",permalink:"/docs/v0.9/getting-started/install-kusion"},next:{title:"Concepts",permalink:"/docs/v0.9/concepts/"}},l={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Init Project",id:"init-project",level:2},{value:"Review Config Files",id:"review-config-files",level:3},{value:"Delivery",id:"delivery",level:2},{value:"Delete WordPress Application",id:"delete-wordpress-application",level:2}],d={toc:p};function c(e){let{components:t,...o}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,o,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"deliver-the-wordpress-application-on-kubernetes"},"Deliver the WordPress Application on Kubernetes"),(0,r.kt)("p",null,"In this tutorial we will walk through how to deploy a WordPress application on Kubernetes with Kusion. The WordPress application will interact with MySQL, which is declared as a database accessory in the config codes and will be automatically created and managed by Kusion. "),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("p",null,"Before we start to play with this example, we need to have the Kusion CLI installed and run a Kubernetes cluster. Here are some helpful documentations: "),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"install-kusion"},"Kusion CLI")),(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/tasks/tools/#kubectl"},"kubectl")," CLI and run a ",(0,r.kt)("a",{parentName:"li",href:"https://kubernetes.io/"},"Kubernetes")," cluster. Some light and convenient options for local deployment include ",(0,r.kt)("a",{parentName:"li",href:"https://docs.k3s.io/quick-start"},"k3s"),", ",(0,r.kt)("a",{parentName:"li",href:"https://k3d.io/v5.4.4/#installation"},"k3d"),", and ",(0,r.kt)("a",{parentName:"li",href:"https://minikube.sigs.k8s.io/docs/tutorials/multi_node/"},"MiniKube"),". ")),(0,r.kt)("h2",{id:"init-project"},"Init Project"),(0,r.kt)("p",null,"We can start by initializing this tutorial project with online templates: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion init --online\n")),(0,r.kt)("p",null,"All init templates are listed as follows: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"\u279c kusion_playground kusion init --online\n? Please choose a template: [Use arrows to move, type to filter]\n code-city Code City metaphor for visualizing Go source code in 3D.\n deployment-multi-stack A minimal kusion project of multiple stacks\n deployment-single-stack A minimal kusion project of single stack\n> wordpress A sample wordpress project\n wordpress-cloud-rds A sample wordpress project with cloud rds\n")),(0,r.kt)("p",null,"Please select ",(0,r.kt)("inlineCode",{parentName:"p"},"wordpress")," and press ",(0,r.kt)("inlineCode",{parentName:"p"},"Enter"),", after which we will see the hints below and use the default value to config this project and stack. "),(0,r.kt)("p",null,(0,r.kt)("img",{src:n(48024).Z,width:"2560",height:"1440"})),(0,r.kt)("p",null,"The directory structure looks like the following: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"cd wordpress && tree\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"\u279c kusion_playground cd wordpress && tree\n.\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod.lock\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n\n1 directory, 5 files\n\u279c wordpress\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about the directory structure can be found in ",(0,r.kt)("a",{parentName:"p",href:"../concepts/glossary"},"Concepts"),". ")),(0,r.kt)("h3",{id:"review-config-files"},"Review Config Files"),(0,r.kt)("p",null,"Now let's have a glance at the configuration files at ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/main.k"),": "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.trait as t\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.secret as sec\nimport catalog.models.schema.v1.workload.network as n\nimport catalog.models.schema.v1.monitoring as m\nimport catalog.models.schema.v1.accessories.database as db\n\n# main.k declares reusable configurations for dev stacks.\nwordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n wordpress: c.Container {\n image = "wordpress:6.3"\n env: {\n "WORDPRESS_DB_HOST": "$(KUSION_DB_HOST)"\n "WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME)"\n "WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD)"\n "WORDPRESS_DB_NAME": "mysql"\n }\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n database: db.Database {\n type: "local"\n engine: "mysql"\n version: "8.0"\n }\n}\n')),(0,r.kt)("p",null,"The configuration file ",(0,r.kt)("inlineCode",{parentName:"p"},"main.k")," includes an ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," with the name of ",(0,r.kt)("inlineCode",{parentName:"p"},"wordpress"),". The ",(0,r.kt)("inlineCode",{parentName:"p"},"wordpress")," application includes a wordload of type ",(0,r.kt)("inlineCode",{parentName:"p"},"wl.Service"),", which runs on 1 replica and exposes ",(0,r.kt)("inlineCode",{parentName:"p"},"80")," to be accessed. Besides, it declares a local ",(0,r.kt)("inlineCode",{parentName:"p"},"db.Database")," accessory with the engine of ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql:8.0")," for the application. The necessary Kubernetes resources for deploying and using the local database will be generated, and users can get the ",(0,r.kt)("inlineCode",{parentName:"p"},"host address"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"username")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"paasword")," through the ",(0,r.kt)("a",{parentName:"p",href:"../reference/model/naming-conventions#sensitive-database-information"},"magic variables for sensitive database information")," of Kusion in application containers. "),(0,r.kt)("p",null,"This model hides the major complexity of Kubernetes resources such as ",(0,r.kt)("inlineCode",{parentName:"p"},"Namespace"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployment")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Service"),", which providing the concepts that are application-centric and infrastructure-agnostic. "),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about the Models can be found in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"Catalog"))),(0,r.kt)("h2",{id:"delivery"},"Delivery"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"cd dev && kusion apply --watch\n")),(0,r.kt)("p",null,"Go to the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," folder and we will deliver the WordPress application into the Kubernetes cluster with one command ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion apply --watch"),". "),(0,r.kt)("p",null,(0,r.kt)("img",{src:n(11273).Z,width:"2560",height:"1440"})),(0,r.kt)("p",null,"Check ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployment")," status. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kubectl -n wordpress get deployment\n")),(0,r.kt)("p",null,"The expected output is shown as follows: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"\u279c dev kubectl -n wordpress get deploy\nNAME READY UP-TO-DATE AVAILABLE AGE\nwordpress-dev-wordpress 1/1 1 1 2m23s\nwordpress-db-local-deployment 1/1 1 1 2m23s\n")),(0,r.kt)("p",null,"Port-forward our WordPress with the ",(0,r.kt)("inlineCode",{parentName:"p"},"Service"),". "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kubectl port-forward -n wordpress service/wordpress-dev-wordpress-private 12345:80\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"\u279c dev kubectl port-forward -n wordpress service/wordpress-dev-wordpress-private 12345:80\nForwarding from 127.0.0.1:12345 -> 80\nForwarding from [::1]:12345 -> 80\n\n")),(0,r.kt)("p",null,"Now we can visit ",(0,r.kt)("a",{parentName:"p",href:"http://localhost:12345"},"http://localhost:12345")," in our browser and enjoy!"),(0,r.kt)("p",null,(0,r.kt)("img",{src:n(85773).Z,width:"1500",height:"803"})),(0,r.kt)("h2",{id:"delete-wordpress-application"},"Delete WordPress Application"),(0,r.kt)("p",null,"We can delete the WordPress application and related database resources using the following command line: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion destroy --yes\n")),(0,r.kt)("p",null,(0,r.kt)("img",{src:n(82864).Z,width:"2560",height:"1440"})))}c.isMDXComponent=!0},11273:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/apply-wordpress-with-local-db-33e34e0fa75349c20a8d3c561d2d6c5c.gif"},48024:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/init-wordpress-with-local-db-1a3e0c28ac010e686185e787ec2929a3.gif"},85773:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/wordpress-site-page-ef650e640399209d1eec5e6dfe88c454.png"},82864:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/wordpress-with-local-db-destroy-9a46e6e09977721984044b31e29b6b78.gif"}}]); \ No newline at end of file diff --git a/assets/js/c3d74b12.fceaefaa.js b/assets/js/c3d74b12.fceaefaa.js deleted file mode 100644 index f56d7f5bbe7..00000000000 --- a/assets/js/c3d74b12.fceaefaa.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3496],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),p=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),u=p(n),m=r,h=u["".concat(l,".").concat(m)]||u[m]||c[m]||o;return n?a.createElement(h,s(s({ref:t},d),{},{components:n})):a.createElement(h,s({ref:t},d))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,s=new Array(o);s[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:r,s[1]=i;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>p});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:2},s="Deliver the WordPress Application on Kubernetes",i={unversionedId:"getting-started/deliver-wordpress",id:"version-v0.9/getting-started/deliver-wordpress",title:"Deliver the WordPress Application on Kubernetes",description:"In this tutorial we will walk through how to deploy a WordPress application on Kubernetes with Kusion. The WordPress application will interact with MySQL, which is declared as a database accessory in the config codes and will be automatically created and managed by Kusion.",source:"@site/docs_versioned_docs/version-v0.9/getting-started/deliver-wordpress.md",sourceDirName:"getting-started",slug:"/getting-started/deliver-wordpress",permalink:"/docs/v0.9/getting-started/deliver-wordpress",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/getting-started/deliver-wordpress.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"kusion",previous:{title:"Install Kusion",permalink:"/docs/v0.9/getting-started/install-kusion"},next:{title:"Concepts",permalink:"/docs/v0.9/concepts/"}},l={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Init Project",id:"init-project",level:2},{value:"Review Config Files",id:"review-config-files",level:3},{value:"Delivery",id:"delivery",level:2},{value:"Delete WordPress Application",id:"delete-wordpress-application",level:2}],d={toc:p};function c(e){let{components:t,...o}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,o,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"deliver-the-wordpress-application-on-kubernetes"},"Deliver the WordPress Application on Kubernetes"),(0,r.kt)("p",null,"In this tutorial we will walk through how to deploy a WordPress application on Kubernetes with Kusion. The WordPress application will interact with MySQL, which is declared as a database accessory in the config codes and will be automatically created and managed by Kusion. "),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("p",null,"Before we start to play with this example, we need to have the Kusion CLI installed and run a Kubernetes cluster. Here are some helpful documentations: "),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"install-kusion"},"Kusion CLI")),(0,r.kt)("li",{parentName:"ul"},"Install ",(0,r.kt)("a",{parentName:"li",href:"https://kubernetes.io/docs/tasks/tools/#kubectl"},"kubectl")," CLI and run a ",(0,r.kt)("a",{parentName:"li",href:"https://kubernetes.io/"},"Kubernetes")," cluster. Some light and convenient options for local deployment include ",(0,r.kt)("a",{parentName:"li",href:"https://docs.k3s.io/quick-start"},"k3s"),", ",(0,r.kt)("a",{parentName:"li",href:"https://k3d.io/v5.4.4/#installation"},"k3d"),", and ",(0,r.kt)("a",{parentName:"li",href:"https://minikube.sigs.k8s.io/docs/tutorials/multi_node/"},"MiniKube"),". ")),(0,r.kt)("h2",{id:"init-project"},"Init Project"),(0,r.kt)("p",null,"We can start by initializing this tutorial project with online templates: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion init --online\n")),(0,r.kt)("p",null,"All init templates are listed as follows: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"\u279c kusion_playground kusion init --online\n? Please choose a template: [Use arrows to move, type to filter]\n code-city Code City metaphor for visualizing Go source code in 3D.\n deployment-multi-stack A minimal kusion project of multiple stacks\n deployment-single-stack A minimal kusion project of single stack\n> wordpress A sample wordpress project\n wordpress-cloud-rds A sample wordpress project with cloud rds\n")),(0,r.kt)("p",null,"Please select ",(0,r.kt)("inlineCode",{parentName:"p"},"wordpress")," and press ",(0,r.kt)("inlineCode",{parentName:"p"},"Enter"),", after which we will see the hints below and use the default value to config this project and stack. "),(0,r.kt)("p",null,(0,r.kt)("img",{src:n(48024).Z,width:"2560",height:"1440"})),(0,r.kt)("p",null,"The directory structure looks like the following: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"cd wordpress && tree\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"\u279c kusion_playground cd wordpress && tree\n.\n\u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod.lock\n\u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2514\u2500\u2500 project.yaml\n\n1 directory, 5 files\n\u279c wordpress\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about the directory structure can be found in ",(0,r.kt)("a",{parentName:"p",href:"../concepts/glossary"},"Concepts"),". ")),(0,r.kt)("h3",{id:"review-config-files"},"Review Config Files"),(0,r.kt)("p",null,"Now let's have a glance at the configuration files at ",(0,r.kt)("inlineCode",{parentName:"p"},"dev/main.k"),": "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.trait as t\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.secret as sec\nimport catalog.models.schema.v1.workload.network as n\nimport catalog.models.schema.v1.monitoring as m\nimport catalog.models.schema.v1.accessories.database as db\n\n# main.k declares reusable configurations for dev stacks.\nwordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n wordpress: c.Container {\n image = "wordpress:6.3"\n env: {\n "WORDPRESS_DB_HOST": "$(KUSION_DB_HOST)"\n "WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME)"\n "WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD)"\n "WORDPRESS_DB_NAME": "mysql"\n }\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n database: db.Database {\n type: "local"\n engine: "mysql"\n version: "8.0"\n }\n}\n')),(0,r.kt)("p",null,"The configuration file ",(0,r.kt)("inlineCode",{parentName:"p"},"main.k")," includes an ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," with the name of ",(0,r.kt)("inlineCode",{parentName:"p"},"wordpress"),". The ",(0,r.kt)("inlineCode",{parentName:"p"},"wordpress")," application includes a wordload of type ",(0,r.kt)("inlineCode",{parentName:"p"},"wl.Service"),", which runs on 1 replica and exposes ",(0,r.kt)("inlineCode",{parentName:"p"},"80")," to be accessed. Besides, it declares a local ",(0,r.kt)("inlineCode",{parentName:"p"},"db.Database")," accessory with the engine of ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql:8.0")," for the application. The necessary Kubernetes resources for deploying and using the local database will be generated, and users can get the ",(0,r.kt)("inlineCode",{parentName:"p"},"host address"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"username")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"paasword")," through the ",(0,r.kt)("a",{parentName:"p",href:"../reference/model/naming-conventions#sensitive-database-information"},"magic variables for sensitive database information")," of Kusion in application containers. "),(0,r.kt)("p",null,"This model hides the major complexity of Kubernetes resources such as ",(0,r.kt)("inlineCode",{parentName:"p"},"Namespace"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployment")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Service"),", which providing the concepts that are application-centric and infrastructure-agnostic. "),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"More details about the Models can be found in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"Catalog"))),(0,r.kt)("h2",{id:"delivery"},"Delivery"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"cd dev && kusion apply --watch\n")),(0,r.kt)("p",null,"Go to the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," folder and we will deliver the WordPress application into the Kubernetes cluster with one command ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion apply --watch"),". "),(0,r.kt)("p",null,(0,r.kt)("img",{src:n(11273).Z,width:"2560",height:"1440"})),(0,r.kt)("p",null,"Check ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployment")," status. "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kubectl -n wordpress get deployment\n")),(0,r.kt)("p",null,"The expected output is shown as follows: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"\u279c dev kubectl -n wordpress get deploy\nNAME READY UP-TO-DATE AVAILABLE AGE\nwordpress-dev-wordpress 1/1 1 1 2m23s\nwordpress-db-local-deployment 1/1 1 1 2m23s\n")),(0,r.kt)("p",null,"Port-forward our WordPress with the ",(0,r.kt)("inlineCode",{parentName:"p"},"Service"),". "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kubectl port-forward -n wordpress service/wordpress-dev-wordpress-private 12345:80\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"\u279c dev kubectl port-forward -n wordpress service/wordpress-dev-wordpress-private 12345:80\nForwarding from 127.0.0.1:12345 -> 80\nForwarding from [::1]:12345 -> 80\n\n")),(0,r.kt)("p",null,"Now we can visit ",(0,r.kt)("a",{parentName:"p",href:"http://localhost:12345"},"http://localhost:12345")," in our browser and enjoy!"),(0,r.kt)("p",null,(0,r.kt)("img",{src:n(85773).Z,width:"1500",height:"803"})),(0,r.kt)("h2",{id:"delete-wordpress-application"},"Delete WordPress Application"),(0,r.kt)("p",null,"We can delete the WordPress application and related database resources using the following command line: "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"kusion destroy --yes\n")),(0,r.kt)("p",null,(0,r.kt)("img",{src:n(82864).Z,width:"2560",height:"1440"})))}c.isMDXComponent=!0},11273:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/apply-wordpress-with-local-db-33e34e0fa75349c20a8d3c561d2d6c5c.gif"},48024:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/init-wordpress-with-local-db-1a3e0c28ac010e686185e787ec2929a3.gif"},85773:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/wordpress-site-page-ef650e640399209d1eec5e6dfe88c454.png"},82864:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/wordpress-with-local-db-destroy-9a46e6e09977721984044b31e29b6b78.gif"}}]); \ No newline at end of file diff --git a/assets/js/c4ff0a86.1ecf8fd3.js b/assets/js/c4ff0a86.1924faf9.js similarity index 54% rename from assets/js/c4ff0a86.1ecf8fd3.js rename to assets/js/c4ff0a86.1924faf9.js index cecc7937907..2a64c584f70 100644 --- a/assets/js/c4ff0a86.1ecf8fd3.js +++ b/assets/js/c4ff0a86.1924faf9.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5722],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=c(r),m=a,f=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return r?n.createElement(f,l(l({ref:t},p),{},{components:r})):n.createElement(f,l({ref:t},p))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var c=2;c{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const o={},l="job",i={unversionedId:"reference/modules/workspace-configs/workload/job",id:"version-v0.11/reference/modules/workspace-configs/workload/job",title:"job",description:"job can be used to define workspace-level job configuration.",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/workload/job.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/workload",slug:"/reference/modules/workspace-configs/workload/job",permalink:"/docs/reference/modules/workspace-configs/workload/job",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/workload/job.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"opsrule",permalink:"/docs/reference/modules/workspace-configs/opsrule/"},next:{title:"service",permalink:"/docs/reference/modules/workspace-configs/workload/service"}},s={},c=[{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:c};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"job"},"job"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"job")," can be used to define workspace-level job configuration."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"replicas"),(0,a.kt)("br",null),"Number of container replicas based on this configuration that should be ran."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"2"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels"),(0,a.kt)("br",null),"Labels are key/value pairs that are attached to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations"),(0,a.kt)("br",null),"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n job:\n default:\n replicas: 3\n labels:\n label-key: label-value\n annotations:\n annotation-key: annotation-value\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5722],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=c(r),m=a,f=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return r?n.createElement(f,l(l({ref:t},p),{},{components:r})):n.createElement(f,l({ref:t},p))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var c=2;c{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const o={},l="job",i={unversionedId:"reference/modules/workspace-configs/workload/job",id:"version-v0.11/reference/modules/workspace-configs/workload/job",title:"job",description:"job can be used to define workspace-level job configuration.",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/workload/job.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/workload",slug:"/reference/modules/workspace-configs/workload/job",permalink:"/docs/reference/modules/workspace-configs/workload/job",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/workload/job.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"opsrule",permalink:"/docs/reference/modules/workspace-configs/opsrule/"},next:{title:"service",permalink:"/docs/reference/modules/workspace-configs/workload/service"}},s={},c=[{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:c};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"job"},"job"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"job")," can be used to define workspace-level job configuration."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"replicas"),(0,a.kt)("br",null),"Number of container replicas based on this configuration that should be ran."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"2"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels"),(0,a.kt)("br",null),"Labels are key/value pairs that are attached to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations"),(0,a.kt)("br",null),"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n job:\n default:\n replicas: 3\n labels:\n label-key: label-value\n annotations:\n annotation-key: annotation-value\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c5353c60.6a970d87.js b/assets/js/c5353c60.6a970d87.js deleted file mode 100644 index db1b466d9ce..00000000000 --- a/assets/js/c5353c60.6a970d87.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4855],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>d});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=a.createContext({}),l=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=l(e.components);return a.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),m=l(n),d=o,f=m["".concat(p,".").concat(d)]||m[d]||u[d]||r;return n?a.createElement(f,i(i({ref:t},c),{},{components:n})):a.createElement(f,i({ref:t},c))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,i=new Array(r);i[0]=m;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>u,frontMatter:()=>r,metadata:()=>s,toc:()=>l});var a=n(87462),o=(n(67294),n(3905));const r={id:"kusion-vs-x"},i="Kusion vs Other Software",s={unversionedId:"what-is-kusion/kusion-vs-x",id:"what-is-kusion/kusion-vs-x",title:"Kusion vs Other Software",description:"It can be difficult to understand how different software compare to each other. Is one a replacement for the other? Are they complementary? etc. In this section, we compare Kusion to other software.",source:"@site/docs/kusion/1-what-is-kusion/2-kusion-vs-x.md",sourceDirName:"1-what-is-kusion",slug:"/what-is-kusion/kusion-vs-x",permalink:"/docs/next/what-is-kusion/kusion-vs-x",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/1-what-is-kusion/2-kusion-vs-x.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"kusion-vs-x"},sidebar:"kusion",previous:{title:"Overview",permalink:"/docs/next/"},next:{title:"Install Kusion",permalink:"/docs/next/getting-started/install-kusion"}},p={},l=[],c={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-vs-other-software"},"Kusion vs Other Software"),(0,o.kt)("p",null,"It can be difficult to understand how different software compare to each other. Is one a replacement for the other? Are they complementary? etc. In this section, we compare Kusion to other software."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. GitOps (ArgoCD, FluxCD, etc.)")),(0,o.kt)("p",null,"According to the ",(0,o.kt)("a",{parentName:"p",href:"https://opengitops.dev/"},"open GitOps principles"),", GitOps systems typically have its desired state expressed declaratively, continuously observe actual system state and attempt to apply the desired state. In the design of Kusion toolchain, we refer to those principles but have no intention to reinvent any GitOps systems wheel. "),(0,o.kt)("p",null,"Kusion adopts your GitOps process and improves it with richness of features. The declarative ",(0,o.kt)("a",{parentName:"p",href:"../concepts/app-configuration"},"AppConfiguration")," model can be used to express desired intent, once intent is declared ",(0,o.kt)("a",{parentName:"p",href:"../reference/commands"},"Kusion CLI")," takes the role to make production match intent as safely as possible. "),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. PaaS (Heroku, Vercel, etc.)")),(0,o.kt)("p",null,"Kusion shares the same goal with traditional PaaS platforms to provide application delivery and management capabilities. The intuitive difference from the full functionality PaaS platforms is that Kusion is a client-side toolchain, not a complete PaaS platform. "),(0,o.kt)("p",null,"Also traditional PaaS platforms typically constrain the type of applications they can run but there is no such constrain for Kusion which means Kusion provides greater flexibility."),(0,o.kt)("p",null,"Kusion allows you to have platform-like features without the constraints of a traditional PaaS. However, Kusion is not attempting to replace any PaaS platforms, instead Kusion can be used to deploy to a platform such as Heroku."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. KubeVela")),(0,o.kt)("p",null,"KubeVela is a modern software delivery and management control plane which makes it easier to deploy and operate applications on top of Kubernetes."),(0,o.kt)("p",null,"Although some might initially perceive an overlap between Kusion and KubeVela, they are in fact complementary and can be integrated to work together. As a lightweight, purely client-side tool, coupled with corresponding ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion-module-framework"},"Generator")," implementation, Kusion can render ",(0,o.kt)("a",{parentName:"p",href:"../concepts/app-configuration"},"AppConfiguration")," schema to generate CRD resources for KubeVela and leverage KubeVela's control plane to implement application delivery."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. Helm")),(0,o.kt)("p",null,"The concept of Helm originates from the ",(0,o.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Package_manager"},"package management")," mechanism of the operating system. It is a package management tool based on templated YAML files and supports the execution and management of resources in the package. "),(0,o.kt)("p",null,"Kusion is not a package manager. Kusion naturally provides a superset of Helm capabilities with the modeled key-value pairs, so that developers can use Kusion directly as a programable alternative to avoid the pain of writing text templates. For users who have adopted Helm, the stack compilation results in Kusion can be packaged and used in Helm format."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. Kubernetes")),(0,o.kt)("p",null,'Kubernetes(K8s) is a container scheduling and management runtime widely used around the world, an "operating system" core for containers, and a platform for building platforms. Above the Kubernetes API layer, Kusion aims to provide app-centric ',(0,o.kt)("strong",{parentName:"p"},"abstraction")," and unified ",(0,o.kt)("strong",{parentName:"p"},"workspace"),", better ",(0,o.kt)("strong",{parentName:"p"},"user experience")," and automation ",(0,o.kt)("strong",{parentName:"p"},"workflow"),", and helps developers build the app delivery model easily and collaboratively."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c5353c60.8eab6d98.js b/assets/js/c5353c60.8eab6d98.js new file mode 100644 index 00000000000..523b8209f40 --- /dev/null +++ b/assets/js/c5353c60.8eab6d98.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4855],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=a.createContext({}),l=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=l(e.components);return a.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=l(n),m=o,f=d["".concat(p,".").concat(m)]||d[m]||u[m]||r;return n?a.createElement(f,i(i({ref:t},c),{},{components:n})):a.createElement(f,i({ref:t},c))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,i=new Array(r);i[0]=d;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>u,frontMatter:()=>r,metadata:()=>s,toc:()=>l});var a=n(87462),o=(n(67294),n(3905));const r={id:"kusion-vs-x"},i="Kusion vs Other Software",s={unversionedId:"what-is-kusion/kusion-vs-x",id:"what-is-kusion/kusion-vs-x",title:"Kusion vs Other Software",description:"It can be difficult to understand how different software compare to each other. Is one a replacement for the other? Are they complementary? etc. In this section, we compare Kusion to other software.",source:"@site/docs/kusion/1-what-is-kusion/2-kusion-vs-x.md",sourceDirName:"1-what-is-kusion",slug:"/what-is-kusion/kusion-vs-x",permalink:"/docs/next/what-is-kusion/kusion-vs-x",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/1-what-is-kusion/2-kusion-vs-x.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"kusion-vs-x"},sidebar:"kusion",previous:{title:"Overview",permalink:"/docs/next/"},next:{title:"Install Kusion",permalink:"/docs/next/getting-started/install-kusion"}},p={},l=[],c={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-vs-other-software"},"Kusion vs Other Software"),(0,o.kt)("p",null,"It can be difficult to understand how different software compare to each other. Is one a replacement for the other? Are they complementary? etc. In this section, we compare Kusion to other software."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. GitOps (ArgoCD, FluxCD, etc.)")),(0,o.kt)("p",null,"According to the ",(0,o.kt)("a",{parentName:"p",href:"https://opengitops.dev/"},"open GitOps principles"),", GitOps systems typically have its desired state expressed declaratively, continuously observe actual system state and attempt to apply the desired state. In the design of Kusion toolchain, we refer to those principles but have no intention to reinvent any GitOps systems wheel. "),(0,o.kt)("p",null,"Kusion adopts your GitOps process and improves it with richness of features. The declarative ",(0,o.kt)("a",{parentName:"p",href:"../concepts/app-configuration"},"AppConfiguration")," model can be used to express desired intent, once intent is declared ",(0,o.kt)("a",{parentName:"p",href:"../reference/commands"},"Kusion CLI")," takes the role to make production match intent as safely as possible. "),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. PaaS (Heroku, Vercel, etc.)")),(0,o.kt)("p",null,"Kusion shares the same goal with traditional PaaS platforms to provide application delivery and management capabilities. The intuitive difference from the full functionality PaaS platforms is that Kusion is a client-side toolchain, not a complete PaaS platform. "),(0,o.kt)("p",null,"Also traditional PaaS platforms typically constrain the type of applications they can run but there is no such constrain for Kusion which means Kusion provides greater flexibility."),(0,o.kt)("p",null,"Kusion allows you to have platform-like features without the constraints of a traditional PaaS. However, Kusion is not attempting to replace any PaaS platforms, instead Kusion can be used to deploy to a platform such as Heroku."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. KubeVela")),(0,o.kt)("p",null,"KubeVela is a modern software delivery and management control plane which makes it easier to deploy and operate applications on top of Kubernetes."),(0,o.kt)("p",null,"Although some might initially perceive an overlap between Kusion and KubeVela, they are in fact complementary and can be integrated to work together. As a lightweight, purely client-side tool, coupled with corresponding ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion-module-framework"},"Generator")," implementation, Kusion can render ",(0,o.kt)("a",{parentName:"p",href:"../concepts/app-configuration"},"AppConfiguration")," schema to generate CRD resources for KubeVela and leverage KubeVela's control plane to implement application delivery."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. Helm")),(0,o.kt)("p",null,"The concept of Helm originates from the ",(0,o.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Package_manager"},"package management")," mechanism of the operating system. It is a package management tool based on templated YAML files and supports the execution and management of resources in the package. "),(0,o.kt)("p",null,"Kusion is not a package manager. Kusion naturally provides a superset of Helm capabilities with the modeled key-value pairs, so that developers can use Kusion directly as a programable alternative to avoid the pain of writing text templates. For users who have adopted Helm, the stack compilation results in Kusion can be packaged and used in Helm format."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. Kubernetes")),(0,o.kt)("p",null,'Kubernetes(K8s) is a container scheduling and management runtime widely used around the world, an "operating system" core for containers, and a platform for building platforms. Above the Kubernetes API layer, Kusion aims to provide app-centric ',(0,o.kt)("strong",{parentName:"p"},"abstraction")," and unified ",(0,o.kt)("strong",{parentName:"p"},"workspace"),", better ",(0,o.kt)("strong",{parentName:"p"},"user experience")," and automation ",(0,o.kt)("strong",{parentName:"p"},"workflow"),", and helps developers build the app delivery model easily and collaboratively."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c61f38e7.c1e5d186.js b/assets/js/c61f38e7.b2d9e077.js similarity index 54% rename from assets/js/c61f38e7.c1e5d186.js rename to assets/js/c61f38e7.b2d9e077.js index a1d34cfe6fb..2b5fb0cbed6 100644 --- a/assets/js/c61f38e7.c1e5d186.js +++ b/assets/js/c61f38e7.b2d9e077.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5735],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),d=p(r),f=o,m=d["".concat(c,".").concat(f)]||d[f]||u[f]||a;return r?n.createElement(m,i(i({ref:t},l),{},{components:r})):n.createElement(m,i({ref:t},l))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},i="kusion project",s={unversionedId:"reference/commands/kusion-project",id:"version-v0.11/reference/commands/kusion-project",title:"kusion project",description:"Project is a folder that contains a project.yaml file and is linked to a Git repository",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-project.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-project",permalink:"/docs/reference/commands/kusion-project",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-project.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion project create",permalink:"/docs/reference/commands/kusion-project-create"},next:{title:"kusion stack create",permalink:"/docs/reference/commands/kusion-stack-create"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-project"},"kusion project"),(0,o.kt)("p",null,"Project is a folder that contains a project.yaml file and is linked to a Git repository"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Project in Kusion is defined as any folder that contains a project.yaml file and is linked to a Git repository."),(0,o.kt)("p",null," Project organizes logical configurations for internal components to orchestrate the application and assembles them to suit different roles, such as developers and platform engineers."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion project [flags]\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for project\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-project-create"},"kusion project create"),"\t - Create a new project")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5735],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),d=p(r),f=o,m=d["".concat(c,".").concat(f)]||d[f]||u[f]||a;return r?n.createElement(m,i(i({ref:t},l),{},{components:r})):n.createElement(m,i({ref:t},l))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},i="kusion project",s={unversionedId:"reference/commands/kusion-project",id:"version-v0.11/reference/commands/kusion-project",title:"kusion project",description:"Project is a folder that contains a project.yaml file and is linked to a Git repository",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-project.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-project",permalink:"/docs/reference/commands/kusion-project",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-project.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion project create",permalink:"/docs/reference/commands/kusion-project-create"},next:{title:"kusion stack create",permalink:"/docs/reference/commands/kusion-stack-create"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-project"},"kusion project"),(0,o.kt)("p",null,"Project is a folder that contains a project.yaml file and is linked to a Git repository"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Project in Kusion is defined as any folder that contains a project.yaml file and is linked to a Git repository."),(0,o.kt)("p",null," Project organizes logical configurations for internal components to orchestrate the application and assembles them to suit different roles, such as developers and platform engineers."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion project [flags]\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for project\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-project-create"},"kusion project create"),"\t - Create a new project")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c6834bbf.3ffadd29.js b/assets/js/c6834bbf.3ffadd29.js deleted file mode 100644 index bd53bbc69c2..00000000000 --- a/assets/js/c6834bbf.3ffadd29.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3550],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=a.createContext({}),l=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=l(e.components);return a.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=l(n),m=o,f=d["".concat(p,".").concat(m)]||d[m]||u[m]||r;return n?a.createElement(f,i(i({ref:t},c),{},{components:n})):a.createElement(f,i({ref:t},c))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,i=new Array(r);i[0]=d;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>u,frontMatter:()=>r,metadata:()=>s,toc:()=>l});var a=n(87462),o=(n(67294),n(3905));const r={id:"kusion-vs-x"},i="Kusion vs Other Software",s={unversionedId:"what-is-kusion/kusion-vs-x",id:"version-v0.10/what-is-kusion/kusion-vs-x",title:"Kusion vs Other Software",description:"It can be difficult to understand how different software compare to each other. Is one a replacement for the other? Are they complementary? etc. In this section, we compare Kusion to other software.",source:"@site/docs_versioned_docs/version-v0.10/1-what-is-kusion/2-kusion-vs-x.md",sourceDirName:"1-what-is-kusion",slug:"/what-is-kusion/kusion-vs-x",permalink:"/docs/v0.10/what-is-kusion/kusion-vs-x",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/1-what-is-kusion/2-kusion-vs-x.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"kusion-vs-x"},sidebar:"kusion",previous:{title:"Overview",permalink:"/docs/v0.10/"},next:{title:"Install Kusion",permalink:"/docs/v0.10/getting-started/install-kusion"}},p={},l=[],c={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-vs-other-software"},"Kusion vs Other Software"),(0,o.kt)("p",null,"It can be difficult to understand how different software compare to each other. Is one a replacement for the other? Are they complementary? etc. In this section, we compare Kusion to other software."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. GitOps (ArgoCD, FluxCD, etc.)")),(0,o.kt)("p",null,"According to the ",(0,o.kt)("a",{parentName:"p",href:"https://opengitops.dev/"},"open GitOps principles"),", GitOps systems typically have its desired state expressed declaratively, continuously observe actual system state and attempt to apply the desired state. In the design of Kusion toolchain, we refer to those principles but have no intention to reinvent any GitOps systems wheel. "),(0,o.kt)("p",null,"Kusion adopts your GitOps process and improves it with richness of features. The declarative ",(0,o.kt)("a",{parentName:"p",href:"../concepts/app-configuration"},"AppConfiguration")," model can be used to express desired intent, once intent is declared ",(0,o.kt)("a",{parentName:"p",href:"../reference/commands"},"Kusion CLI")," takes the role to make production match intent as safely as possible. "),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. PaaS (Heroku, Vercel, etc.)")),(0,o.kt)("p",null,"Kusion shares the same goal with traditional PaaS platforms to provide application delivery and management capabilities. The intuitive difference from the full functionality PaaS platforms is that Kusion is a client-side toolchain, not a complete PaaS platform. "),(0,o.kt)("p",null,"Also traditional PaaS platforms typically constrain the type of applications they can run but there is no such constrain for Kusion which means Kusion provides greater flexibility."),(0,o.kt)("p",null,"Kusion allows you to have platform-like features without the constraints of a traditional PaaS. However, Kusion is not attempting to replace any PaaS platforms, instead Kusion can be used to deploy to a platform such as Heroku."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. KubeVela")),(0,o.kt)("p",null,"KubeVela is a modern software delivery and management control plane. KubeVela makes it easier to deploy and operate applications on top of Kubernetes."),(0,o.kt)("p",null,"Kusion is not a control plane. Kusion is a client-side tool for describing application intent in a declarative way and providing consistent workflow to apply that desired state."),(0,o.kt)("p",null,"With proper Generator implementation, the target Spec of ",(0,o.kt)("a",{parentName:"p",href:"../concepts/app-configuration"},"AppConfiguration")," can be ",(0,o.kt)("a",{parentName:"p",href:"https://kubevela.io/docs/getting-started/core-concept/"},"KubeVela Application"),' and Kusion can use KubeVela to satisfy the "apply" step.'),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. Helm")),(0,o.kt)("p",null,"The concept of Helm originates from the ",(0,o.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Package_manager"},"package management")," mechanism of the operating system. It is a package management tool based on templated YAML files and supports the execution and management of resources in the package. "),(0,o.kt)("p",null,"Kusion is not a package manager. Kusion naturally provides a superset of Helm capabilities with the modeled key-value pairs, so that developers can use Kusion directly as a programable alternative to avoid the pain of writing text templates. For users who have adopted Helm, the stack compilation results in Kusion can be packaged and used in Helm format."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. Kubernetes")),(0,o.kt)("p",null,'Kubernetes(K8s) is a container scheduling and management runtime widely used around the world, an "operating system" core for containers, and a platform for building platforms. Above the Kubernetes API layer, Kusion aims to provide app-centric ',(0,o.kt)("strong",{parentName:"p"},"abstraction")," and unified ",(0,o.kt)("strong",{parentName:"p"},"workspace"),", better ",(0,o.kt)("strong",{parentName:"p"},"user experience")," and automation ",(0,o.kt)("strong",{parentName:"p"},"workflow"),", and helps developers build the app delivery model easily and collaboratively."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c6834bbf.eb4dba57.js b/assets/js/c6834bbf.eb4dba57.js new file mode 100644 index 00000000000..8b8c99d4fed --- /dev/null +++ b/assets/js/c6834bbf.eb4dba57.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3550],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=a.createContext({}),l=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=l(e.components);return a.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=l(n),m=o,f=d["".concat(p,".").concat(m)]||d[m]||u[m]||r;return n?a.createElement(f,i(i({ref:t},c),{},{components:n})):a.createElement(f,i({ref:t},c))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,i=new Array(r);i[0]=d;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>u,frontMatter:()=>r,metadata:()=>s,toc:()=>l});var a=n(87462),o=(n(67294),n(3905));const r={id:"kusion-vs-x"},i="Kusion vs Other Software",s={unversionedId:"what-is-kusion/kusion-vs-x",id:"version-v0.10/what-is-kusion/kusion-vs-x",title:"Kusion vs Other Software",description:"It can be difficult to understand how different software compare to each other. Is one a replacement for the other? Are they complementary? etc. In this section, we compare Kusion to other software.",source:"@site/docs_versioned_docs/version-v0.10/1-what-is-kusion/2-kusion-vs-x.md",sourceDirName:"1-what-is-kusion",slug:"/what-is-kusion/kusion-vs-x",permalink:"/docs/v0.10/what-is-kusion/kusion-vs-x",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/1-what-is-kusion/2-kusion-vs-x.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"kusion-vs-x"},sidebar:"kusion",previous:{title:"Overview",permalink:"/docs/v0.10/"},next:{title:"Install Kusion",permalink:"/docs/v0.10/getting-started/install-kusion"}},p={},l=[],c={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-vs-other-software"},"Kusion vs Other Software"),(0,o.kt)("p",null,"It can be difficult to understand how different software compare to each other. Is one a replacement for the other? Are they complementary? etc. In this section, we compare Kusion to other software."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. GitOps (ArgoCD, FluxCD, etc.)")),(0,o.kt)("p",null,"According to the ",(0,o.kt)("a",{parentName:"p",href:"https://opengitops.dev/"},"open GitOps principles"),", GitOps systems typically have its desired state expressed declaratively, continuously observe actual system state and attempt to apply the desired state. In the design of Kusion toolchain, we refer to those principles but have no intention to reinvent any GitOps systems wheel. "),(0,o.kt)("p",null,"Kusion adopts your GitOps process and improves it with richness of features. The declarative ",(0,o.kt)("a",{parentName:"p",href:"../concepts/app-configuration"},"AppConfiguration")," model can be used to express desired intent, once intent is declared ",(0,o.kt)("a",{parentName:"p",href:"../reference/commands"},"Kusion CLI")," takes the role to make production match intent as safely as possible. "),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. PaaS (Heroku, Vercel, etc.)")),(0,o.kt)("p",null,"Kusion shares the same goal with traditional PaaS platforms to provide application delivery and management capabilities. The intuitive difference from the full functionality PaaS platforms is that Kusion is a client-side toolchain, not a complete PaaS platform. "),(0,o.kt)("p",null,"Also traditional PaaS platforms typically constrain the type of applications they can run but there is no such constrain for Kusion which means Kusion provides greater flexibility."),(0,o.kt)("p",null,"Kusion allows you to have platform-like features without the constraints of a traditional PaaS. However, Kusion is not attempting to replace any PaaS platforms, instead Kusion can be used to deploy to a platform such as Heroku."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. KubeVela")),(0,o.kt)("p",null,"KubeVela is a modern software delivery and management control plane. KubeVela makes it easier to deploy and operate applications on top of Kubernetes."),(0,o.kt)("p",null,"Kusion is not a control plane. Kusion is a client-side tool for describing application intent in a declarative way and providing consistent workflow to apply that desired state."),(0,o.kt)("p",null,"With proper Generator implementation, the target Spec of ",(0,o.kt)("a",{parentName:"p",href:"../concepts/app-configuration"},"AppConfiguration")," can be ",(0,o.kt)("a",{parentName:"p",href:"https://kubevela.io/docs/getting-started/core-concept/"},"KubeVela Application"),' and Kusion can use KubeVela to satisfy the "apply" step.'),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. Helm")),(0,o.kt)("p",null,"The concept of Helm originates from the ",(0,o.kt)("a",{parentName:"p",href:"https://en.wikipedia.org/wiki/Package_manager"},"package management")," mechanism of the operating system. It is a package management tool based on templated YAML files and supports the execution and management of resources in the package. "),(0,o.kt)("p",null,"Kusion is not a package manager. Kusion naturally provides a superset of Helm capabilities with the modeled key-value pairs, so that developers can use Kusion directly as a programable alternative to avoid the pain of writing text templates. For users who have adopted Helm, the stack compilation results in Kusion can be packaged and used in Helm format."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},"vs. Kubernetes")),(0,o.kt)("p",null,'Kubernetes(K8s) is a container scheduling and management runtime widely used around the world, an "operating system" core for containers, and a platform for building platforms. Above the Kubernetes API layer, Kusion aims to provide app-centric ',(0,o.kt)("strong",{parentName:"p"},"abstraction")," and unified ",(0,o.kt)("strong",{parentName:"p"},"workspace"),", better ",(0,o.kt)("strong",{parentName:"p"},"user experience")," and automation ",(0,o.kt)("strong",{parentName:"p"},"workflow"),", and helps developers build the app delivery model easily and collaboratively."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c6c2c73a.2d4e6873.js b/assets/js/c6c2c73a.2d4e6873.js deleted file mode 100644 index d6f4095b4cb..00000000000 --- a/assets/js/c6c2c73a.2d4e6873.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1407],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=l(r),f=o,m=d["".concat(p,".").concat(f)]||d[f]||u[f]||i;return r?n.createElement(m,a(a({ref:t},c),{},{components:r})):n.createElement(m,a({ref:t},c))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=d;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var l=2;l{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const i={},a="kusion preview",s={unversionedId:"reference/commands/kusion-preview",id:"version-v0.11/reference/commands/kusion-preview",title:"kusion preview",description:"Preview a series of resource changes within the stack",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-preview.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-preview",permalink:"/docs/reference/commands/kusion-preview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-preview.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion options",permalink:"/docs/reference/commands/kusion-options"},next:{title:"kusion project create",permalink:"/docs/reference/commands/kusion-project-create"}},p={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],c={toc:l};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-preview"},"kusion preview"),(0,o.kt)("p",null,"Preview a series of resource changes within the stack"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Preview a series of resource changes within the stack."),(0,o.kt)("p",null," Create, update or delete resources according to the intent described in the stack. By default, Kusion will generate an execution preview and present it for your approval before taking any action."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion preview [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' # Preview with specified work directory\n kusion preview -w /path/to/workdir\n \n # Preview with specified arguments\n kusion preview -D name=test -D age=18\n \n # Preview with ignored fields\n kusion preview --ignore-fields="metadata.generation,metadata.managedFields\n \n # Preview with json format result\n kusion preview -o json\n \n # Preview without output style and color\n kusion preview --no-style=true\n')),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -a, --all --detail Automatically show all preview details, combined use with flag --detail\n --backend string The backend to use, supports 'local', 'oss' and 's3'.\n -d, --detail Automatically show preview details with interactive options (default true)\n -h, --help help for preview\n --ignore-fields strings Ignore differences of target fields\n --no-style no-style sets to RawOutput mode and disables all of styling\n --operator string Specify the operator\n -o, --output string Specify the output format\n -w, --workdir string The work directory to run Kusion CLI.\n --workspace string The name of target workspace to operate in.\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c6c2c73a.7ac6213d.js b/assets/js/c6c2c73a.7ac6213d.js new file mode 100644 index 00000000000..79acf4f36ed --- /dev/null +++ b/assets/js/c6c2c73a.7ac6213d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1407],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var p=n.createContext({}),l=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=l(r),f=o,m=d["".concat(p,".").concat(f)]||d[f]||u[f]||i;return r?n.createElement(m,a(a({ref:t},c),{},{components:r})):n.createElement(m,a({ref:t},c))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=d;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var l=2;l{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const i={},a="kusion preview",s={unversionedId:"reference/commands/kusion-preview",id:"version-v0.11/reference/commands/kusion-preview",title:"kusion preview",description:"Preview a series of resource changes within the stack",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-preview.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-preview",permalink:"/docs/reference/commands/kusion-preview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-preview.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion options",permalink:"/docs/reference/commands/kusion-options"},next:{title:"kusion project create",permalink:"/docs/reference/commands/kusion-project-create"}},p={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],c={toc:l};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-preview"},"kusion preview"),(0,o.kt)("p",null,"Preview a series of resource changes within the stack"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Preview a series of resource changes within the stack."),(0,o.kt)("p",null," Create, update or delete resources according to the intent described in the stack. By default, Kusion will generate an execution preview and present it for your approval before taking any action."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion preview [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' # Preview with specified work directory\n kusion preview -w /path/to/workdir\n \n # Preview with specified arguments\n kusion preview -D name=test -D age=18\n \n # Preview with ignored fields\n kusion preview --ignore-fields="metadata.generation,metadata.managedFields\n \n # Preview with json format result\n kusion preview -o json\n \n # Preview without output style and color\n kusion preview --no-style=true\n')),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -a, --all --detail Automatically show all preview details, combined use with flag --detail\n --backend string The backend to use, supports 'local', 'oss' and 's3'.\n -d, --detail Automatically show preview details with interactive options (default true)\n -h, --help help for preview\n --ignore-fields strings Ignore differences of target fields\n --no-style no-style sets to RawOutput mode and disables all of styling\n --operator string Specify the operator\n -o, --output string Specify the output format\n -w, --workdir string The work directory to run Kusion CLI.\n --workspace string The name of target workspace to operate in.\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c7fa01e5.7af0056d.js b/assets/js/c7fa01e5.7af0056d.js deleted file mode 100644 index bce0fda4d2f..00000000000 --- a/assets/js/c7fa01e5.7af0056d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5523],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>h});var o=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function a(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=o.createContext({}),p=function(e){var n=o.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},c=function(e){var n=p(e.components);return o.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},d=o.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(t),h=r,m=d["".concat(s,".").concat(h)]||d[h]||u[h]||i;return t?o.createElement(m,a(a({ref:n},c),{},{components:t})):o.createElement(m,a({ref:n},c))}));function h(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,a=new Array(i);a[0]=d;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,a[1]=l;for(var p=2;p{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var o=t(87462),r=(t(67294),t(3905));const i={id:"job"},a="Schedule a Job",l={unversionedId:"user-guides/working-with-k8s/job",id:"user-guides/working-with-k8s/job",title:"Schedule a Job",description:"The guides above provide examples on how to configure workloads of the type wl.Service, which is typically used for long-running web applications that should never go down. Alternatively, you could also schedule another kind of workload profile, namely wl.Job which corresponds to a one-off or recurring execution of tasks that run to completion and then stop.",source:"@site/docs/kusion/5-user-guides/2-working-with-k8s/7-job.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/job",permalink:"/docs/next/user-guides/working-with-k8s/job",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/5-user-guides/2-working-with-k8s/7-job.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:7,frontMatter:{id:"job"},sidebar:"kusion",previous:{title:"Set up Operational Rules",permalink:"/docs/next/user-guides/working-with-k8s/set-up-operational-rules"},next:{title:"Configure Monitoring Behavior With Prometheus",permalink:"/docs/next/user-guides/observability/prometheus"}},s={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],c={toc:p};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,o.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"schedule-a-job"},"Schedule a Job"),(0,r.kt)("p",null,"The guides above provide examples on how to configure workloads of the type ",(0,r.kt)("inlineCode",{parentName:"p"},"wl.Service"),", which is typically used for long-running web applications that should ",(0,r.kt)("strong",{parentName:"p"},"never")," go down. Alternatively, you could also schedule another kind of workload profile, namely ",(0,r.kt)("inlineCode",{parentName:"p"},"wl.Job")," which corresponds to a one-off or recurring execution of tasks that run to completion and then stop."),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("p",null,"Please refer to the ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for scheduling a job."),(0,r.kt)("p",null,"The example below also requires you to have ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,r.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,r.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,r.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there. Alternatively, if you have updated your workspace config in the previous guides, no changes need to be made either."),(0,r.kt)("p",null,"However, if you (or the platform team) would like to set default values for the workloads to standardize the behavior of applications in the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace, you can do so by updating the ",(0,r.kt)("inlineCode",{parentName:"p"},"~/dev.yaml"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n service:\n default:\n replicas: 3\n labels:\n label-key: label-value\n annotations:\n annotation-key: annotation-value\n")),(0,r.kt)("p",null,"Please note that the ",(0,r.kt)("inlineCode",{parentName:"p"},"replicas")," in the workspace configuration only works as a default value and will be overridden by the value set in the application configuration."),(0,r.kt)("p",null,"The workspace configuration need to be updated with the command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace update dev -f ~/dev.yaml\n")),(0,r.kt)("p",null,"For a full reference of what can be configured in the workspace level, please see the ",(0,r.kt)("a",{parentName:"p",href:"../../reference/modules/workspace-configs/workload/job"},"workspace reference"),"."),(0,r.kt)("h2",{id:"example"},"Example"),(0,r.kt)("p",null,"To schedule a job with cron expression, update ",(0,r.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k")," to the following:"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-py"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Job {\n containers: {\n "busybox": c.Container {\n # The target image\n image: "busybox:1.28"\n # Run the following command as defined\n command: ["/bin/sh", "-c", "echo hello"]\n }\n }\n # Run every minute.\n schedule: "* * * * *"\n }\n}\n')),(0,r.kt)("p",null,"The KCL snippet above schedules a job. Alternatively, if you want a one-time job without cron, simply remove the ",(0,r.kt)("inlineCode",{parentName:"p"},"schedule")," from the configuration."),(0,r.kt)("p",null,"You can find the full example in here in the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/tree/main/example/simple-job"},"konfig repo"),"."),(0,r.kt)("h2",{id:"applying"},"Applying"),(0,r.kt)("p",null,"Re-run steps in ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying")," and schedule the job. Your output might look like one of the following:"),(0,r.kt)("p",null,"If you are starting from scratch, all resources are created on the spot:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service Create\n* \u2514\u2500 batch/v1:CronJob:simple-service:simple-service-dev-helloworld Create\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS Create v1:Namespace:simple-service success \n SUCCESS Create batch/v1:CronJob:simple-service:helloworld-dev-helloworld success \nCreate batch/v1:CronJob:simple-service:simple-service-dev-helloworld success [2/2] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 2 created, 0 updated, 0 deleted.\n")),(0,r.kt)("p",null,"If you are starting from the last guide which configures an ",(0,r.kt)("inlineCode",{parentName:"p"},"opsrule"),", the output looks like the following which destroys the ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployment")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Service")," and replace it with a ",(0,r.kt)("inlineCode",{parentName:"p"},"CronJob"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 batch/v1:CronJob:simple-service:simple-service-dev-helloworld Create\n* \u251c\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Delete\n* \u2514\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private Delete\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS Delete apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \n SUCCESS Create batch/v1:CronJob:simple-service:simple-service-dev-helloworld success \n SUCCESS Delete v1:Service:simple-service:simple-service-dev-helloworld-private success \nDelete v1:Service:simple-service:simple-service-dev-helloworld-private success [4/4] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 1 created, 0 updated, 2 deleted.\n")),(0,r.kt)("h2",{id:"validation"},"Validation"),(0,r.kt)("p",null,"We can verify the job has now been scheduled:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"$ kubectl get cronjob -n simple-service\nNAME SCHEDULE SUSPEND ACTIVE LAST SCHEDULE AGE\nsimple-service-dev-helloworld * * * * * False 0 2m18s\n")),(0,r.kt)("p",null,"Verify the job has been triggered after the minute mark since we scheduled it to run every minute:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"$ kubectl get job -n simple-service\nNAME COMPLETIONS DURATION AGE\nsimple-service-dev-helloworld-28415748 1/1 5s 11s\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c7fa01e5.7caa0d33.js b/assets/js/c7fa01e5.7caa0d33.js new file mode 100644 index 00000000000..99988c26d27 --- /dev/null +++ b/assets/js/c7fa01e5.7caa0d33.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5523],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>h});var o=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function a(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=o.createContext({}),p=function(e){var n=o.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},c=function(e){var n=p(e.components);return o.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},d=o.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(t),h=r,m=d["".concat(s,".").concat(h)]||d[h]||u[h]||i;return t?o.createElement(m,a(a({ref:n},c),{},{components:t})):o.createElement(m,a({ref:n},c))}));function h(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,a=new Array(i);a[0]=d;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,a[1]=l;for(var p=2;p{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var o=t(87462),r=(t(67294),t(3905));const i={id:"job"},a="Schedule a Job",l={unversionedId:"user-guides/working-with-k8s/job",id:"user-guides/working-with-k8s/job",title:"Schedule a Job",description:"The guides above provide examples on how to configure workloads of the type wl.Service, which is typically used for long-running web applications that should never go down. Alternatively, you could also schedule another kind of workload profile, namely wl.Job which corresponds to a one-off or recurring execution of tasks that run to completion and then stop.",source:"@site/docs/kusion/5-user-guides/2-working-with-k8s/7-job.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/job",permalink:"/docs/next/user-guides/working-with-k8s/job",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/5-user-guides/2-working-with-k8s/7-job.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:7,frontMatter:{id:"job"},sidebar:"kusion",previous:{title:"Set up Operational Rules",permalink:"/docs/next/user-guides/working-with-k8s/set-up-operational-rules"},next:{title:"Configure Monitoring Behavior With Prometheus",permalink:"/docs/next/user-guides/observability/prometheus"}},s={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],c={toc:p};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,o.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"schedule-a-job"},"Schedule a Job"),(0,r.kt)("p",null,"The guides above provide examples on how to configure workloads of the type ",(0,r.kt)("inlineCode",{parentName:"p"},"wl.Service"),", which is typically used for long-running web applications that should ",(0,r.kt)("strong",{parentName:"p"},"never")," go down. Alternatively, you could also schedule another kind of workload profile, namely ",(0,r.kt)("inlineCode",{parentName:"p"},"wl.Job")," which corresponds to a one-off or recurring execution of tasks that run to completion and then stop."),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("p",null,"Please refer to the ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for scheduling a job."),(0,r.kt)("p",null,"The example below also requires you to have ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,r.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,r.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,r.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there. Alternatively, if you have updated your workspace config in the previous guides, no changes need to be made either."),(0,r.kt)("p",null,"However, if you (or the platform team) would like to set default values for the workloads to standardize the behavior of applications in the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace, you can do so by updating the ",(0,r.kt)("inlineCode",{parentName:"p"},"~/dev.yaml"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n service:\n default:\n replicas: 3\n labels:\n label-key: label-value\n annotations:\n annotation-key: annotation-value\n")),(0,r.kt)("p",null,"Please note that the ",(0,r.kt)("inlineCode",{parentName:"p"},"replicas")," in the workspace configuration only works as a default value and will be overridden by the value set in the application configuration."),(0,r.kt)("p",null,"The workspace configuration need to be updated with the command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace update dev -f ~/dev.yaml\n")),(0,r.kt)("p",null,"For a full reference of what can be configured in the workspace level, please see the ",(0,r.kt)("a",{parentName:"p",href:"../../reference/modules/workspace-configs/workload/job"},"workspace reference"),"."),(0,r.kt)("h2",{id:"example"},"Example"),(0,r.kt)("p",null,"To schedule a job with cron expression, update ",(0,r.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k")," to the following:"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-py"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Job {\n containers: {\n "busybox": c.Container {\n # The target image\n image: "busybox:1.28"\n # Run the following command as defined\n command: ["/bin/sh", "-c", "echo hello"]\n }\n }\n # Run every minute.\n schedule: "* * * * *"\n }\n}\n')),(0,r.kt)("p",null,"The KCL snippet above schedules a job. Alternatively, if you want a one-time job without cron, simply remove the ",(0,r.kt)("inlineCode",{parentName:"p"},"schedule")," from the configuration."),(0,r.kt)("p",null,"You can find the full example in here in the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/tree/main/example/simple-job"},"konfig repo"),"."),(0,r.kt)("h2",{id:"applying"},"Applying"),(0,r.kt)("p",null,"Re-run steps in ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying")," and schedule the job. Your output might look like one of the following:"),(0,r.kt)("p",null,"If you are starting from scratch, all resources are created on the spot:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service Create\n* \u2514\u2500 batch/v1:CronJob:simple-service:simple-service-dev-helloworld Create\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS Create v1:Namespace:simple-service success \n SUCCESS Create batch/v1:CronJob:simple-service:helloworld-dev-helloworld success \nCreate batch/v1:CronJob:simple-service:simple-service-dev-helloworld success [2/2] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 2 created, 0 updated, 0 deleted.\n")),(0,r.kt)("p",null,"If you are starting from the last guide which configures an ",(0,r.kt)("inlineCode",{parentName:"p"},"opsrule"),", the output looks like the following which destroys the ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployment")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Service")," and replace it with a ",(0,r.kt)("inlineCode",{parentName:"p"},"CronJob"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 batch/v1:CronJob:simple-service:simple-service-dev-helloworld Create\n* \u251c\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Delete\n* \u2514\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private Delete\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS Delete apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \n SUCCESS Create batch/v1:CronJob:simple-service:simple-service-dev-helloworld success \n SUCCESS Delete v1:Service:simple-service:simple-service-dev-helloworld-private success \nDelete v1:Service:simple-service:simple-service-dev-helloworld-private success [4/4] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 1 created, 0 updated, 2 deleted.\n")),(0,r.kt)("h2",{id:"validation"},"Validation"),(0,r.kt)("p",null,"We can verify the job has now been scheduled:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"$ kubectl get cronjob -n simple-service\nNAME SCHEDULE SUSPEND ACTIVE LAST SCHEDULE AGE\nsimple-service-dev-helloworld * * * * * False 0 2m18s\n")),(0,r.kt)("p",null,"Verify the job has been triggered after the minute mark since we scheduled it to run every minute:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"$ kubectl get job -n simple-service\nNAME COMPLETIONS DURATION AGE\nsimple-service-dev-helloworld-28415748 1/1 5s 11s\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c89433e3.1f981f18.js b/assets/js/c89433e3.1f981f18.js new file mode 100644 index 00000000000..be72c635a98 --- /dev/null +++ b/assets/js/c89433e3.1f981f18.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9946],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(n),d=o,g=u["".concat(s,".").concat(d)]||u[d]||m[d]||a;return n?r.createElement(g,i(i({ref:t},c),{},{components:n})):r.createElement(g,i({ref:t},c))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>l,toc:()=>p});var r=n(87462),o=(n(67294),n(3905));const a={},i="monitoring",l={unversionedId:"reference/modules/workspace-configs/monitoring/prometheus",id:"version-v0.10/reference/modules/workspace-configs/monitoring/prometheus",title:"monitoring",description:"monitoring can be used to define workspace-level monitoring configurations.",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/monitoring/prometheus.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/monitoring",slug:"/reference/modules/workspace-configs/monitoring/prometheus",permalink:"/docs/v0.10/reference/modules/workspace-configs/monitoring/prometheus",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/monitoring/prometheus.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"postgres",permalink:"/docs/v0.10/reference/modules/workspace-configs/database/postgres"},next:{title:"port",permalink:"/docs/v0.10/reference/modules/workspace-configs/networking/port"}},s={},p=[{value:"Attributes",id:"attributes",level:2},{value:"Examples",id:"examples",level:3}],c={toc:p};function m(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"monitoring"},"monitoring"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"monitoring")," can be used to define workspace-level monitoring configurations."),(0,o.kt)("h2",{id:"attributes"},"Attributes"),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,o.kt)("th",{parentName:"tr",align:null},"Type"),(0,o.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,o.kt)("th",{parentName:"tr",align:null},"Required"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"operatorMode"),(0,o.kt)("br",null),"Whether the Prometheus instance installed in the cluster runs as a Kubernetes operator or not. This determines the different kinds of resources Kusion manages."),(0,o.kt)("td",{parentName:"tr",align:null},"true ","|"," false"),(0,o.kt)("td",{parentName:"tr",align:null},"false"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"monitorType"),(0,o.kt)("br",null),"The kind of monitor to create. It only applies when operatorMode is set to True."),(0,o.kt)("td",{parentName:"tr",align:null},'"Service" ',"|",' "Pod"'),(0,o.kt)("td",{parentName:"tr",align:null},'"Service"'),(0,o.kt)("td",{parentName:"tr",align:null},"optional")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"interval"),(0,o.kt)("br",null),"The time interval which Prometheus scrapes metrics data. Only applicable when operator mode is set to true.",(0,o.kt)("br",null),"When operator mode is set to false, the scraping interval can only be set in the scraping job configuration, which kusion does not have permission to manage directly."),(0,o.kt)("td",{parentName:"tr",align:null},"str"),(0,o.kt)("td",{parentName:"tr",align:null},"30s"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"timeout"),(0,o.kt)("br",null),"The timeout when Prometheus scrapes metrics data. Only applicable when operator mode is set to true.",(0,o.kt)("br",null),"When operator mode is set to false, the scraping timeout can only be set in the scraping job configuration, which kusion does not have permission to manage directly."),(0,o.kt)("td",{parentName:"tr",align:null},"str"),(0,o.kt)("td",{parentName:"tr",align:null},"15s"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"scheme"),(0,o.kt)("br",null),"The scheme to scrape metrics from. Possible values are http and https."),(0,o.kt)("td",{parentName:"tr",align:null},'"http" ',"|",' "https"'),(0,o.kt)("td",{parentName:"tr",align:null},"http"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")))),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n monitoring:\n default:\n operatorMode: True\n monitorType: Pod\n scheme: http\n interval: 30s\n timeout: 15s\n low_frequency:\n operatorMode: False\n interval: 2m\n timeout: 1m\n projectSelector:\n - foo\n - bar\n high_frequency:\n monitorType: Service\n interval: 10s\n timeout: 5s\n projectSelector:\n - helloworld\n - wordpress\n - prometheus-sample-app\n")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c89433e3.7aa27d5a.js b/assets/js/c89433e3.7aa27d5a.js deleted file mode 100644 index 78db5726486..00000000000 --- a/assets/js/c89433e3.7aa27d5a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9946],{3905:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},m=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,m=l(e,["components","mdxType","originalType","parentName"]),u=p(n),d=o,g=u["".concat(s,".").concat(d)]||u[d]||c[d]||a;return n?r.createElement(g,i(i({ref:t},m),{},{components:n})):r.createElement(g,i({ref:t},m))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>c,frontMatter:()=>a,metadata:()=>l,toc:()=>p});var r=n(87462),o=(n(67294),n(3905));const a={},i="monitoring",l={unversionedId:"reference/modules/workspace-configs/monitoring/prometheus",id:"version-v0.10/reference/modules/workspace-configs/monitoring/prometheus",title:"monitoring",description:"monitoring can be used to define workspace-level monitoring configurations.",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/monitoring/prometheus.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/monitoring",slug:"/reference/modules/workspace-configs/monitoring/prometheus",permalink:"/docs/v0.10/reference/modules/workspace-configs/monitoring/prometheus",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/monitoring/prometheus.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"postgres",permalink:"/docs/v0.10/reference/modules/workspace-configs/database/postgres"},next:{title:"port",permalink:"/docs/v0.10/reference/modules/workspace-configs/networking/port"}},s={},p=[{value:"Attributes",id:"attributes",level:2},{value:"Examples",id:"examples",level:3}],m={toc:p};function c(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"monitoring"},"monitoring"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"monitoring")," can be used to define workspace-level monitoring configurations."),(0,o.kt)("h2",{id:"attributes"},"Attributes"),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,o.kt)("th",{parentName:"tr",align:null},"Type"),(0,o.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,o.kt)("th",{parentName:"tr",align:null},"Required"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"operatorMode"),(0,o.kt)("br",null),"Whether the Prometheus instance installed in the cluster runs as a Kubernetes operator or not. This determines the different kinds of resources Kusion manages."),(0,o.kt)("td",{parentName:"tr",align:null},"true ","|"," false"),(0,o.kt)("td",{parentName:"tr",align:null},"false"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"monitorType"),(0,o.kt)("br",null),"The kind of monitor to create. It only applies when operatorMode is set to True."),(0,o.kt)("td",{parentName:"tr",align:null},'"Service" ',"|",' "Pod"'),(0,o.kt)("td",{parentName:"tr",align:null},'"Service"'),(0,o.kt)("td",{parentName:"tr",align:null},"optional")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"interval"),(0,o.kt)("br",null),"The time interval which Prometheus scrapes metrics data. Only applicable when operator mode is set to true.",(0,o.kt)("br",null),"When operator mode is set to false, the scraping interval can only be set in the scraping job configuration, which kusion does not have permission to manage directly."),(0,o.kt)("td",{parentName:"tr",align:null},"str"),(0,o.kt)("td",{parentName:"tr",align:null},"30s"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"timeout"),(0,o.kt)("br",null),"The timeout when Prometheus scrapes metrics data. Only applicable when operator mode is set to true.",(0,o.kt)("br",null),"When operator mode is set to false, the scraping timeout can only be set in the scraping job configuration, which kusion does not have permission to manage directly."),(0,o.kt)("td",{parentName:"tr",align:null},"str"),(0,o.kt)("td",{parentName:"tr",align:null},"15s"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"scheme"),(0,o.kt)("br",null),"The scheme to scrape metrics from. Possible values are http and https."),(0,o.kt)("td",{parentName:"tr",align:null},'"http" ',"|",' "https"'),(0,o.kt)("td",{parentName:"tr",align:null},"http"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")))),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n monitoring:\n default:\n operatorMode: True\n monitorType: Pod\n scheme: http\n interval: 30s\n timeout: 15s\n low_frequency:\n operatorMode: False\n interval: 2m\n timeout: 1m\n projectSelector:\n - foo\n - bar\n high_frequency:\n monitorType: Service\n interval: 10s\n timeout: 5s\n projectSelector:\n - helloworld\n - wordpress\n - prometheus-sample-app\n")))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c89804bb.c65aabdc.js b/assets/js/c89804bb.7cf91a3f.js similarity index 57% rename from assets/js/c89804bb.c65aabdc.js rename to assets/js/c89804bb.7cf91a3f.js index 947ba888b41..1aade4b1d2a 100644 --- a/assets/js/c89804bb.c65aabdc.js +++ b/assets/js/c89804bb.7cf91a3f.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4124],{3905:(e,t,r)=>{r.d(t,{Zo:()=>m,kt:()=>d});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},m=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,m=i(e,["components","mdxType","originalType","parentName"]),u=p(r),d=o,h=u["".concat(l,".").concat(d)]||u[d]||c[d]||a;return r?n.createElement(h,s(s({ref:t},m),{},{components:r})):n.createElement(h,s({ref:t},m))}));function d(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},s="prometheus",i={unversionedId:"reference/modules/developer-schemas/monitoring/prometheus",id:"reference/modules/developer-schemas/monitoring/prometheus",title:"prometheus",description:"Schema Prometheus",source:"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/monitoring/prometheus.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/monitoring",slug:"/reference/modules/developer-schemas/monitoring/prometheus",permalink:"/docs/next/reference/modules/developer-schemas/monitoring/prometheus",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/1-developer-schemas/monitoring/prometheus.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"secret",permalink:"/docs/next/reference/modules/developer-schemas/internal/secret/"},next:{title:"network",permalink:"/docs/next/reference/modules/developer-schemas/network/"}},l={},p=[{value:"Schema Prometheus",id:"schema-prometheus",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],m={toc:p};function c(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"prometheus"},"prometheus"),(0,o.kt)("h2",{id:"schema-prometheus"},"Schema Prometheus"),(0,o.kt)("p",null,"Prometheus can be used to define monitoring requirements"),(0,o.kt)("h3",{id:"attributes"},"Attributes"),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:null},"name"),(0,o.kt)("th",{parentName:"tr",align:null},"type"),(0,o.kt)("th",{parentName:"tr",align:null},"description"),(0,o.kt)("th",{parentName:"tr",align:null},"default value"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"path")),(0,o.kt)("td",{parentName:"tr",align:null},"str"),(0,o.kt)("td",{parentName:"tr",align:null},"The path to scrape metrics from."),(0,o.kt)("td",{parentName:"tr",align:null},'"/metrics"')),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"port")),(0,o.kt)("td",{parentName:"tr",align:null},"str"),(0,o.kt)("td",{parentName:"tr",align:null},"The port to scrape metrics from. When using Prometheus operator, this needs to be the port NAME. Otherwise, this can be a port name or a number."),(0,o.kt)("td",{parentName:"tr",align:null},"container ports when scraping pod (monitorType is pod) and service port when scraping service (monitorType is service)")))),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-python"},'import monitoring as m\n\n"monitoring": m.Prometheus {\n path: "/metrics"\n port: "web"\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4124],{3905:(e,t,r)=>{r.d(t,{Zo:()=>m,kt:()=>d});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},m=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,m=i(e,["components","mdxType","originalType","parentName"]),u=p(r),d=o,h=u["".concat(l,".").concat(d)]||u[d]||c[d]||a;return r?n.createElement(h,s(s({ref:t},m),{},{components:r})):n.createElement(h,s({ref:t},m))}));function d(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=u;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>c,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},s="prometheus",i={unversionedId:"reference/modules/developer-schemas/monitoring/prometheus",id:"reference/modules/developer-schemas/monitoring/prometheus",title:"prometheus",description:"Schema Prometheus",source:"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/monitoring/prometheus.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/monitoring",slug:"/reference/modules/developer-schemas/monitoring/prometheus",permalink:"/docs/next/reference/modules/developer-schemas/monitoring/prometheus",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/1-developer-schemas/monitoring/prometheus.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"secret",permalink:"/docs/next/reference/modules/developer-schemas/internal/secret/"},next:{title:"network",permalink:"/docs/next/reference/modules/developer-schemas/network/"}},l={},p=[{value:"Schema Prometheus",id:"schema-prometheus",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],m={toc:p};function c(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},m,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"prometheus"},"prometheus"),(0,o.kt)("h2",{id:"schema-prometheus"},"Schema Prometheus"),(0,o.kt)("p",null,"Prometheus can be used to define monitoring requirements"),(0,o.kt)("h3",{id:"attributes"},"Attributes"),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:null},"name"),(0,o.kt)("th",{parentName:"tr",align:null},"type"),(0,o.kt)("th",{parentName:"tr",align:null},"description"),(0,o.kt)("th",{parentName:"tr",align:null},"default value"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"path")),(0,o.kt)("td",{parentName:"tr",align:null},"str"),(0,o.kt)("td",{parentName:"tr",align:null},"The path to scrape metrics from."),(0,o.kt)("td",{parentName:"tr",align:null},'"/metrics"')),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"port")),(0,o.kt)("td",{parentName:"tr",align:null},"str"),(0,o.kt)("td",{parentName:"tr",align:null},"The port to scrape metrics from. When using Prometheus operator, this needs to be the port NAME. Otherwise, this can be a port name or a number."),(0,o.kt)("td",{parentName:"tr",align:null},"container ports when scraping pod (monitorType is pod) and service port when scraping service (monitorType is service)")))),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-python"},'import monitoring as m\n\n"monitoring": m.Prometheus {\n path: "/metrics"\n port: "web"\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c9777963.5ba749f7.js b/assets/js/c9777963.5ba749f7.js new file mode 100644 index 00000000000..b724481083f --- /dev/null +++ b/assets/js/c9777963.5ba749f7.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8052],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=p(r),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(f,s(s({ref:t},l),{},{components:r})):n.createElement(f,s({ref:t},l))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion destroy",i={unversionedId:"reference/commands/kusion-destroy",id:"version-v0.10/reference/commands/kusion-destroy",title:"kusion destroy",description:"Destroy resources within the stack.",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-destroy.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-destroy",permalink:"/docs/v0.10/reference/commands/kusion-destroy",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-destroy.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion compile",permalink:"/docs/v0.10/reference/commands/kusion-compile"},next:{title:"kusion init",permalink:"/docs/v0.10/reference/commands/kusion-init"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],l={toc:p};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-destroy"},"kusion destroy"),(0,o.kt)("p",null,"Destroy resources within the stack."),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Destroy resources within the stack."),(0,o.kt)("p",null," Please note that the destroy command does NOT perform resource version checks. Therefore, if someone submits an update to a resource at the same time you execute a destroy command, their update will be lost along with the rest of the resource."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion destroy [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Delete resources of current stack\n kusion destroy\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -D, --argument stringToString Specify the top-level argument (default [])\n -C, --backend-config strings backend-config config state storage backend\n --backend-type string backend-type specify state storage backend\n -d, --detail Automatically show plan details after previewing it\n -h, --help help for destroy\n --operator string Specify the operator\n -Y, --setting strings Specify the command line setting files\n -w, --workdir string Specify the work directory\n -y, --yes Automatically approve and perform the update after previewing it\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of KusionStack")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c9777963.7e80098d.js b/assets/js/c9777963.7e80098d.js deleted file mode 100644 index 8ad0ca0b264..00000000000 --- a/assets/js/c9777963.7e80098d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8052],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,s=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(r),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||s;return r?n.createElement(f,a(a({ref:t},p),{},{components:r})):n.createElement(f,a({ref:t},p))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var s=r.length,a=new Array(s);a[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,a[1]=i;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>s,metadata:()=>i,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const s={},a="kusion destroy",i={unversionedId:"reference/commands/kusion-destroy",id:"version-v0.10/reference/commands/kusion-destroy",title:"kusion destroy",description:"Destroy resources within the stack.",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-destroy.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-destroy",permalink:"/docs/v0.10/reference/commands/kusion-destroy",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-destroy.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion compile",permalink:"/docs/v0.10/reference/commands/kusion-compile"},next:{title:"kusion init",permalink:"/docs/v0.10/reference/commands/kusion-init"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],p={toc:l};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-destroy"},"kusion destroy"),(0,o.kt)("p",null,"Destroy resources within the stack."),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Destroy resources within the stack."),(0,o.kt)("p",null," Please note that the destroy command does NOT perform resource version checks. Therefore, if someone submits an update to a resource at the same time you execute a destroy command, their update will be lost along with the rest of the resource."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion destroy [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Delete resources of current stack\n kusion destroy\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -D, --argument stringToString Specify the top-level argument (default [])\n -C, --backend-config strings backend-config config state storage backend\n --backend-type string backend-type specify state storage backend\n -d, --detail Automatically show plan details after previewing it\n -h, --help help for destroy\n --operator string Specify the operator\n -Y, --setting strings Specify the command line setting files\n -w, --workdir string Specify the work directory\n -y, --yes Automatically approve and perform the update after previewing it\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of KusionStack")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ca110a3e.8c10aa50.js b/assets/js/ca110a3e.8c10aa50.js deleted file mode 100644 index 9ce138ffec9..00000000000 --- a/assets/js/ca110a3e.8c10aa50.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[65],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>h});var o=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function a(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=o.createContext({}),p=function(e){var n=o.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},c=function(e){var n=p(e.components);return o.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},d=o.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(t),h=r,m=d["".concat(s,".").concat(h)]||d[h]||u[h]||i;return t?o.createElement(m,a(a({ref:n},c),{},{components:t})):o.createElement(m,a({ref:n},c))}));function h(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,a=new Array(i);a[0]=d;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,a[1]=l;for(var p=2;p{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var o=t(87462),r=(t(67294),t(3905));const i={},a="Schedule a Job",l={unversionedId:"user-guides/working-with-k8s/job",id:"version-v0.10/user-guides/working-with-k8s/job",title:"Schedule a Job",description:'The guides above provide examples on how to configure workloads of the type wl.Service, which is typically used for long-running web applications that should "never" go down. Alternatively, you could also schedule another kind of workload profile, namely wl.Job which corresponds to a one-off or recurring execution of tasks that run to completion and then stop.',source:"@site/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/7-job.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/job",permalink:"/docs/v0.10/user-guides/working-with-k8s/job",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/7-job.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:7,frontMatter:{},sidebar:"kusion",previous:{title:"Set up Operational Rules",permalink:"/docs/v0.10/user-guides/working-with-k8s/set-up-operational-rules"},next:{title:"Configure Monitoring Behavior With Prometheus",permalink:"/docs/v0.10/user-guides/observability/prometheus"}},s={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],c={toc:p};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,o.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"schedule-a-job"},"Schedule a Job"),(0,r.kt)("p",null,"The guides above provide examples on how to configure workloads of the type ",(0,r.kt)("inlineCode",{parentName:"p"},"wl.Service"),', which is typically used for long-running web applications that should "never" go down. Alternatively, you could also schedule another kind of workload profile, namely ',(0,r.kt)("inlineCode",{parentName:"p"},"wl.Job")," which corresponds to a one-off or recurring execution of tasks that run to completion and then stop."),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("p",null,"Please refer to the ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for scheduling a job."),(0,r.kt)("p",null,"The example below also requires you to have ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,r.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,r.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,r.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there. Alternatively, if you have updated your workspace config in the previous guides, no changes need to be made either."),(0,r.kt)("p",null,"However, if you (or the platform team) would like to set default values for the workloads to standardize the behavior of applications in the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace, you can do so by updating the ",(0,r.kt)("inlineCode",{parentName:"p"},"~/dev.yaml"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n service:\n default:\n replicas: 3\n labels:\n label-key: label-value\n annotations:\n annotation-key: annotation-value\n")),(0,r.kt)("p",null,"Please note that the ",(0,r.kt)("inlineCode",{parentName:"p"},"replicas")," in the workspace configuration only works as a default value and will be overridden by the value set in the application configuration."),(0,r.kt)("p",null,"The workspace configuration need to be updated with the command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace update dev -f ~/dev.yaml\n")),(0,r.kt)("p",null,"For a full reference of what can be configured in the workspace level, please see the ",(0,r.kt)("a",{parentName:"p",href:"../../reference/modules/workspace-configs/workload/job"},"workspace reference"),"."),(0,r.kt)("h2",{id:"example"},"Example"),(0,r.kt)("p",null,"To schedule a job with cron expression, update ",(0,r.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k")," to the following:"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-py"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Job {\n containers: {\n "busybox": c.Container {\n # The target image\n image: "busybox:1.28"\n # Run the following command as defined\n command: ["/bin/sh", "-c", "echo hello"]\n }\n }\n # Run every minute.\n schedule: "* * * * *"\n }\n}\n')),(0,r.kt)("p",null,"The KCL snippet above schedules a job. Alternatively, if you want a one-time job without cron, simply remove the ",(0,r.kt)("inlineCode",{parentName:"p"},"schedule")," from the configuration."),(0,r.kt)("p",null,"You can find the full example in here in the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/tree/main/example/simple-job"},"konfig repo"),"."),(0,r.kt)("h2",{id:"applying"},"Applying"),(0,r.kt)("p",null,"Re-run steps in ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying")," and schedule the job. Your output might look like one of the following:"),(0,r.kt)("p",null,"If you are starting from scratch, all resources are created on the spot:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Intent in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service Create\n* \u2514\u2500 batch/v1:CronJob:simple-service:simple-service-dev-helloworld Create\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS Create v1:Namespace:simple-service success \n SUCCESS Create batch/v1:CronJob:simple-service:helloworld-dev-helloworld success \nCreate batch/v1:CronJob:simple-service:simple-service-dev-helloworld success [2/2] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 2 created, 0 updated, 0 deleted.\n")),(0,r.kt)("p",null,"If you are starting from the last guide which configures an ",(0,r.kt)("inlineCode",{parentName:"p"},"opsRule"),", the output looks like the following which destroys the ",(0,r.kt)("inlineCode",{parentName:"p"},"Deployment")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"Service")," and replace it with a ",(0,r.kt)("inlineCode",{parentName:"p"},"CronJob"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Intent in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 batch/v1:CronJob:simple-service:simple-service-dev-helloworld Create\n* \u251c\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Delete\n* \u2514\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private Delete\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS Delete apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \n SUCCESS Create batch/v1:CronJob:simple-service:simple-service-dev-helloworld success \n SUCCESS Delete v1:Service:simple-service:simple-service-dev-helloworld-private success \nDelete v1:Service:simple-service:simple-service-dev-helloworld-private success [4/4] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 1 created, 0 updated, 2 deleted.\n")),(0,r.kt)("h2",{id:"validation"},"Validation"),(0,r.kt)("p",null,"We can verify the job has now been scheduled:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"$ kubectl get cronjob -n simple-service\nNAME SCHEDULE SUSPEND ACTIVE LAST SCHEDULE AGE\nsimple-service-dev-helloworld * * * * * False 0 2m18s\n")),(0,r.kt)("p",null,"Verify the job has been triggered after the minute mark since we scheduled it to run every minute:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},"$ kubectl get job -n simple-service\nNAME COMPLETIONS DURATION AGE\nsimple-service-dev-helloworld-28415748 1/1 5s 11s\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ca110a3e.a1c26b21.js b/assets/js/ca110a3e.a1c26b21.js new file mode 100644 index 00000000000..9422c726914 --- /dev/null +++ b/assets/js/ca110a3e.a1c26b21.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[65],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>h});var o=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function i(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=o.createContext({}),p=function(e){var n=o.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},c=function(e){var n=p(e.components);return o.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},d=o.forwardRef((function(e,n){var t=e.components,a=e.mdxType,r=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(t),h=a,m=d["".concat(s,".").concat(h)]||d[h]||u[h]||r;return t?o.createElement(m,i(i({ref:n},c),{},{components:t})):o.createElement(m,i({ref:n},c))}));function h(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var r=t.length,i=new Array(r);i[0]=d;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var p=2;p{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>i,default:()=>u,frontMatter:()=>r,metadata:()=>l,toc:()=>p});var o=t(87462),a=(t(67294),t(3905));const r={},i="Schedule a Job",l={unversionedId:"user-guides/working-with-k8s/job",id:"version-v0.10/user-guides/working-with-k8s/job",title:"Schedule a Job",description:'The guides above provide examples on how to configure workloads of the type wl.Service, which is typically used for long-running web applications that should "never" go down. Alternatively, you could also schedule another kind of workload profile, namely wl.Job which corresponds to a one-off or recurring execution of tasks that run to completion and then stop.',source:"@site/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/7-job.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/job",permalink:"/docs/v0.10/user-guides/working-with-k8s/job",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/7-job.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:7,frontMatter:{},sidebar:"kusion",previous:{title:"Set up Operational Rules",permalink:"/docs/v0.10/user-guides/working-with-k8s/set-up-operational-rules"},next:{title:"Configure Monitoring Behavior With Prometheus",permalink:"/docs/v0.10/user-guides/observability/prometheus"}},s={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],c={toc:p};function u(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,o.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"schedule-a-job"},"Schedule a Job"),(0,a.kt)("p",null,"The guides above provide examples on how to configure workloads of the type ",(0,a.kt)("inlineCode",{parentName:"p"},"wl.Service"),', which is typically used for long-running web applications that should "never" go down. Alternatively, you could also schedule another kind of workload profile, namely ',(0,a.kt)("inlineCode",{parentName:"p"},"wl.Job")," which corresponds to a one-off or recurring execution of tasks that run to completion and then stop."),(0,a.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,a.kt)("p",null,"Please refer to the ",(0,a.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for scheduling a job."),(0,a.kt)("p",null,"The example below also requires you to have ",(0,a.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,a.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,a.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,a.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,a.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,a.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there. Alternatively, if you have updated your workspace config in the previous guides, no changes need to be made either."),(0,a.kt)("p",null,"However, if you (or the platform team) would like to set default values for the workloads to standardize the behavior of applications in the ",(0,a.kt)("inlineCode",{parentName:"p"},"dev")," workspace, you can do so by updating the ",(0,a.kt)("inlineCode",{parentName:"p"},"~/dev.yaml"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n service:\n default:\n replicas: 3\n labels:\n label-key: label-value\n annotations:\n annotation-key: annotation-value\n")),(0,a.kt)("p",null,"Please note that the ",(0,a.kt)("inlineCode",{parentName:"p"},"replicas")," in the workspace configuration only works as a default value and will be overridden by the value set in the application configuration."),(0,a.kt)("p",null,"The workspace configuration need to be updated with the command:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace update dev -f ~/dev.yaml\n")),(0,a.kt)("p",null,"For a full reference of what can be configured in the workspace level, please see the ",(0,a.kt)("a",{parentName:"p",href:"../../reference/modules/workspace-configs/workload/job"},"workspace reference"),"."),(0,a.kt)("h2",{id:"example"},"Example"),(0,a.kt)("p",null,"To schedule a job with cron expression, update ",(0,a.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k")," to the following:"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-py"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Job {\n containers: {\n "busybox": c.Container {\n # The target image\n image: "busybox:1.28"\n # Run the following command as defined\n command: ["/bin/sh", "-c", "echo hello"]\n }\n }\n # Run every minute.\n schedule: "* * * * *"\n }\n}\n')),(0,a.kt)("p",null,"The KCL snippet above schedules a job. Alternatively, if you want a one-time job without cron, simply remove the ",(0,a.kt)("inlineCode",{parentName:"p"},"schedule")," from the configuration."),(0,a.kt)("p",null,"You can find the full example in here in the ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/konfig/tree/main/example/simple-job"},"konfig repo"),"."),(0,a.kt)("h2",{id:"applying"},"Applying"),(0,a.kt)("p",null,"Re-run steps in ",(0,a.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying")," and schedule the job. Your output might look like one of the following:"),(0,a.kt)("p",null,"If you are starting from scratch, all resources are created on the spot:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Intent in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service Create\n* \u2514\u2500 batch/v1:CronJob:simple-service:simple-service-dev-helloworld Create\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS Create v1:Namespace:simple-service success \n SUCCESS Create batch/v1:CronJob:simple-service:helloworld-dev-helloworld success \nCreate batch/v1:CronJob:simple-service:simple-service-dev-helloworld success [2/2] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 2 created, 0 updated, 0 deleted.\n")),(0,a.kt)("p",null,"If you are starting from the last guide which configures an ",(0,a.kt)("inlineCode",{parentName:"p"},"opsRule"),", the output looks like the following which destroys the ",(0,a.kt)("inlineCode",{parentName:"p"},"Deployment")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"Service")," and replace it with a ",(0,a.kt)("inlineCode",{parentName:"p"},"CronJob"),":"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Intent in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 batch/v1:CronJob:simple-service:simple-service-dev-helloworld Create\n* \u251c\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Delete\n* \u2514\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private Delete\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS Delete apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \n SUCCESS Create batch/v1:CronJob:simple-service:simple-service-dev-helloworld success \n SUCCESS Delete v1:Service:simple-service:simple-service-dev-helloworld-private success \nDelete v1:Service:simple-service:simple-service-dev-helloworld-private success [4/4] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 1 created, 0 updated, 2 deleted.\n")),(0,a.kt)("h2",{id:"validation"},"Validation"),(0,a.kt)("p",null,"We can verify the job has now been scheduled:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"$ kubectl get cronjob -n simple-service\nNAME SCHEDULE SUSPEND ACTIVE LAST SCHEDULE AGE\nsimple-service-dev-helloworld * * * * * False 0 2m18s\n")),(0,a.kt)("p",null,"Verify the job has been triggered after the minute mark since we scheduled it to run every minute:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"$ kubectl get job -n simple-service\nNAME COMPLETIONS DURATION AGE\nsimple-service-dev-helloworld-28415748 1/1 5s 11s\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/cae059c7.41f1107d.js b/assets/js/cae059c7.41f1107d.js new file mode 100644 index 00000000000..35ec78e2830 --- /dev/null +++ b/assets/js/cae059c7.41f1107d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8417],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),l=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},c=function(e){var t=l(e.components);return r.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=l(n),m=o,f=d["".concat(p,".").concat(m)]||d[m]||u[m]||i;return n?r.createElement(f,a(a({ref:t},c),{},{components:n})):r.createElement(f,a({ref:t},c))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=d;var s={};for(var p in t)hasOwnProperty.call(t,p)&&(s[p]=t[p]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const i={},a="kusion options",s={unversionedId:"reference/commands/kusion-options",id:"version-v0.11/reference/commands/kusion-options",title:"kusion options",description:"Print the list of flags inherited by all commands",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-options.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-options",permalink:"/docs/reference/commands/kusion-options",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-options.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion mod",permalink:"/docs/reference/commands/kusion-mod"},next:{title:"kusion preview",permalink:"/docs/reference/commands/kusion-preview"}},p={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],c={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-options"},"kusion options"),(0,o.kt)("p",null,"Print the list of flags inherited by all commands"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Print the list of flags inherited by all commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion options [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Print flags inherited by all commands\n kubectl options\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for options\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/cae059c7.9a3294b2.js b/assets/js/cae059c7.9a3294b2.js deleted file mode 100644 index 87509065574..00000000000 --- a/assets/js/cae059c7.9a3294b2.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8417],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(n),m=o,f=d["".concat(l,".").concat(m)]||d[m]||u[m]||i;return n?r.createElement(f,a(a({ref:t},c),{},{components:n})):r.createElement(f,a({ref:t},c))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>p});var r=n(87462),o=(n(67294),n(3905));const i={},a="kusion options",s={unversionedId:"reference/commands/kusion-options",id:"version-v0.11/reference/commands/kusion-options",title:"kusion options",description:"Print the list of flags inherited by all commands",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-options.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-options",permalink:"/docs/reference/commands/kusion-options",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-options.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion mod",permalink:"/docs/reference/commands/kusion-mod"},next:{title:"kusion preview",permalink:"/docs/reference/commands/kusion-preview"}},l={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-options"},"kusion options"),(0,o.kt)("p",null,"Print the list of flags inherited by all commands"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Print the list of flags inherited by all commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion options [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Print flags inherited by all commands\n kubectl options\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for options\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/cbd4dc33.9e38ea9e.js b/assets/js/cbd4dc33.1d5c2b1e.js similarity index 51% rename from assets/js/cbd4dc33.9e38ea9e.js rename to assets/js/cbd4dc33.1d5c2b1e.js index dc2fdb7df7e..7496c846c4d 100644 --- a/assets/js/cbd4dc33.9e38ea9e.js +++ b/assets/js/cbd4dc33.1d5c2b1e.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6355],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>u});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),i=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},d=function(e){var t=i(e.components);return n.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),m=i(r),u=a,f=m["".concat(s,".").concat(u)]||m[u]||p[u]||o;return r?n.createElement(f,l(l({ref:t},d),{},{components:r})):n.createElement(f,l({ref:t},d))}));function u(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=m;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,l[1]=c;for(var i=2;i{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>i});var n=r(87462),a=(r(67294),r(3905));const o={},l="secret",c={unversionedId:"reference/model/catalog_models/internal/secret/doc_secret",id:"version-v0.9/reference/model/catalog_models/internal/secret/doc_secret",title:"secret",description:"Schema Secret",source:"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/secret/doc_secret.md",sourceDirName:"reference/model/catalog_models/internal/secret",slug:"/reference/model/catalog_models/internal/secret/doc_secret",permalink:"/docs/v0.9/reference/model/catalog_models/internal/secret/doc_secret",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/secret/doc_secret.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"port",permalink:"/docs/v0.9/reference/model/catalog_models/internal/network/doc_port"},next:{title:"Naming Conventions",permalink:"/docs/v0.9/reference/model/naming-conventions"}},s={},i=[{value:"Schema Secret",id:"schema-secret",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],d={toc:i};function p(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"secret"},"secret"),(0,a.kt)("h2",{id:"schema-secret"},"Schema Secret"),(0,a.kt)("p",null,"Secret can be used to store sensitive data."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"type"),(0,a.kt)("br",null),"Type of secret, used to facilitate programmatic handling of secret data.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/configuration/secret/%5C#secret-types"},"https://kubernetes.io/docs/concepts/configuration/secret/\\#secret-types")),(0,a.kt)("td",{parentName:"tr",align:null},'"basic" ',"|",' "opaque"'),(0,a.kt)("td",{parentName:"tr",align:null},"opaque"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"data"),(0,a.kt)("br",null),"Data contains the non-binary secret data in string form."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"immutable"),(0,a.kt)("br",null),"Immutable, if set to true, ensures that data stored in the Secret cannot be updated."),(0,a.kt)("td",{parentName:"tr",align:null},"bool"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.secret as sec\n\nbasicAuth = sec.Secret {\n type: "basic"\n data: {\n "username": ""\n "password": ""\n }\n}\n')))}p.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6355],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>u});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),i=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},d=function(e){var t=i(e.components);return n.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,d=c(e,["components","mdxType","originalType","parentName"]),m=i(r),u=a,f=m["".concat(s,".").concat(u)]||m[u]||p[u]||o;return r?n.createElement(f,l(l({ref:t},d),{},{components:r})):n.createElement(f,l({ref:t},d))}));function u(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=m;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:a,l[1]=c;for(var i=2;i{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>p,frontMatter:()=>o,metadata:()=>c,toc:()=>i});var n=r(87462),a=(r(67294),r(3905));const o={},l="secret",c={unversionedId:"reference/model/catalog_models/internal/secret/doc_secret",id:"version-v0.9/reference/model/catalog_models/internal/secret/doc_secret",title:"secret",description:"Schema Secret",source:"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/secret/doc_secret.md",sourceDirName:"reference/model/catalog_models/internal/secret",slug:"/reference/model/catalog_models/internal/secret/doc_secret",permalink:"/docs/v0.9/reference/model/catalog_models/internal/secret/doc_secret",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/secret/doc_secret.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"port",permalink:"/docs/v0.9/reference/model/catalog_models/internal/network/doc_port"},next:{title:"Naming Conventions",permalink:"/docs/v0.9/reference/model/naming-conventions"}},s={},i=[{value:"Schema Secret",id:"schema-secret",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],d={toc:i};function p(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"secret"},"secret"),(0,a.kt)("h2",{id:"schema-secret"},"Schema Secret"),(0,a.kt)("p",null,"Secret can be used to store sensitive data."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"type"),(0,a.kt)("br",null),"Type of secret, used to facilitate programmatic handling of secret data.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/configuration/secret/%5C#secret-types"},"https://kubernetes.io/docs/concepts/configuration/secret/\\#secret-types")),(0,a.kt)("td",{parentName:"tr",align:null},'"basic" ',"|",' "opaque"'),(0,a.kt)("td",{parentName:"tr",align:null},"opaque"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"data"),(0,a.kt)("br",null),"Data contains the non-binary secret data in string form."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"immutable"),(0,a.kt)("br",null),"Immutable, if set to true, ensures that data stored in the Secret cannot be updated."),(0,a.kt)("td",{parentName:"tr",align:null},"bool"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.secret as sec\n\nbasicAuth = sec.Secret {\n type: "basic"\n data: {\n "username": ""\n "password": ""\n }\n}\n')))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/cc1bc459.3169c291.js b/assets/js/cc1bc459.3169c291.js new file mode 100644 index 00000000000..f34265ed314 --- /dev/null +++ b/assets/js/cc1bc459.3169c291.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3780],{3905:(e,n,t)=>{t.d(n,{Zo:()=>l,kt:()=>d});var o=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function i(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var c=o.createContext({}),p=function(e){var n=o.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},l=function(e){var n=p(e.components);return o.createElement(c.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},m=o.forwardRef((function(e,n){var t=e.components,r=e.mdxType,a=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),m=p(t),d=r,f=m["".concat(c,".").concat(d)]||m[d]||u[d]||a;return t?o.createElement(f,i(i({ref:n},l),{},{components:t})):o.createElement(f,i({ref:n},l))}));function d(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var a=t.length,i=new Array(a);i[0]=m;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var p=2;p{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var o=t(87462),r=(t(67294),t(3905));const a={},i="kusion mod",s={unversionedId:"reference/commands/kusion-mod",id:"version-v0.11/reference/commands/kusion-mod",title:"kusion mod",description:"Manage Kusion modules",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-mod.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-mod",permalink:"/docs/reference/commands/kusion-mod",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-mod.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion mod push",permalink:"/docs/reference/commands/kusion-mod-push"},next:{title:"kusion options",permalink:"/docs/reference/commands/kusion-options"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,o.Z)({},l,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"kusion-mod"},"kusion mod"),(0,r.kt)("p",null,"Manage Kusion modules"),(0,r.kt)("h3",{id:"synopsis"},"Synopsis"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"}," Commands for managing Kusion modules.\n\n These commands help you manage the lifecycle of Kusion modules.\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kusion mod\n")),(0,r.kt)("h3",{id:"options"},"Options"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"}," -h, --help help for mod\n")),(0,r.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,r.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-mod-init"},"kusion mod init"),"\t - Create a kusion module along with common files and directories in the current directory"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-mod-push"},"kusion mod push"),"\t - Push a module to OCI registry")),(0,r.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/cc1bc459.fd1982bd.js b/assets/js/cc1bc459.fd1982bd.js deleted file mode 100644 index 6b408eb8d6a..00000000000 --- a/assets/js/cc1bc459.fd1982bd.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3780],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>d});var o=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function i(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var c=o.createContext({}),l=function(e){var n=o.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},p=function(e){var n=l(e.components);return o.createElement(c.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},m=o.forwardRef((function(e,n){var t=e.components,r=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),m=l(t),d=r,f=m["".concat(c,".").concat(d)]||m[d]||u[d]||a;return t?o.createElement(f,i(i({ref:n},p),{},{components:t})):o.createElement(f,i({ref:n},p))}));function d(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var a=t.length,i=new Array(a);i[0]=m;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var l=2;l{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var o=t(87462),r=(t(67294),t(3905));const a={},i="kusion mod",s={unversionedId:"reference/commands/kusion-mod",id:"version-v0.11/reference/commands/kusion-mod",title:"kusion mod",description:"Manage Kusion modules",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-mod.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-mod",permalink:"/docs/reference/commands/kusion-mod",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-mod.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion mod push",permalink:"/docs/reference/commands/kusion-mod-push"},next:{title:"kusion options",permalink:"/docs/reference/commands/kusion-options"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:l};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,o.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"kusion-mod"},"kusion mod"),(0,r.kt)("p",null,"Manage Kusion modules"),(0,r.kt)("h3",{id:"synopsis"},"Synopsis"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"}," Commands for managing Kusion modules.\n\n These commands help you manage the lifecycle of Kusion modules.\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kusion mod\n")),(0,r.kt)("h3",{id:"options"},"Options"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"}," -h, --help help for mod\n")),(0,r.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,r.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-mod-init"},"kusion mod init"),"\t - Create a kusion module along with common files and directories in the current directory"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-mod-push"},"kusion mod push"),"\t - Push a module to OCI registry")),(0,r.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/cc91f96a.54c6a58a.js b/assets/js/cc91f96a.54c6a58a.js new file mode 100644 index 00000000000..fe31f9a7249 --- /dev/null +++ b/assets/js/cc91f96a.54c6a58a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2534],{3905:(e,n,t)=>{t.d(n,{Zo:()=>d,kt:()=>c});var o=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function i(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=o.createContext({}),p=function(e){var n=o.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},d=function(e){var n=p(e.components);return o.createElement(s.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},u=o.forwardRef((function(e,n){var t=e.components,a=e.mdxType,r=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(t),c=a,k=u["".concat(s,".").concat(c)]||u[c]||m[c]||r;return t?o.createElement(k,i(i({ref:n},d),{},{components:t})):o.createElement(k,i({ref:n},d))}));function c(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var r=t.length,i=new Array(r);i[0]=u;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var p=2;p{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>i,default:()=>m,frontMatter:()=>r,metadata:()=>l,toc:()=>p});var o=t(87462),a=(t(67294),t(3905));const r={},i="Platform Engineer Develop Guide",l={unversionedId:"concepts/kusion-module/develop-guide",id:"version-v0.11/concepts/kusion-module/develop-guide",title:"Platform Engineer Develop Guide",description:"Prerequisites",source:"@site/docs_versioned_docs/version-v0.11/3-concepts/3-kusion-module/2-develop-guide.md",sourceDirName:"3-concepts/3-kusion-module",slug:"/concepts/kusion-module/develop-guide",permalink:"/docs/concepts/kusion-module/develop-guide",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/3-concepts/3-kusion-module/2-develop-guide.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{},sidebar:"kusion",previous:{title:"Overview",permalink:"/docs/concepts/kusion-module/overview"},next:{title:"Application Developer User Guide",permalink:"/docs/concepts/kusion-module/app-dev-guide"}},s={},p=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Workflow",id:"workflow",level:2},{value:"Set up a developing environment",id:"set-up-a-developing-environment",level:2},{value:"Developing",id:"developing",level:2},{value:"Publish",id:"publish",level:2},{value:"Initialize the workspace",id:"initialize-the-workspace",level:2}],d={toc:p};function m(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,o.Z)({},d,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"platform-engineer-develop-guide"},"Platform Engineer Develop Guide"),(0,a.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,a.kt)("p",null,"To follow this guide, you will need:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Go 1.22 or higher installed and configured"),(0,a.kt)("li",{parentName:"ul"},"Kusion v0.11.1 or higher installed locally")),(0,a.kt)("h2",{id:"workflow"},"Workflow"),(0,a.kt)("p",null,"As a platform engineer, the workflow of developing a Kusion module looks like this:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Communicate with app developers and identify the fields that should exposed to them in the dev-orient schema"),(0,a.kt)("li",{parentName:"ol"},"Identify module input parameters that should be configured by platform engineers in the ",(0,a.kt)("a",{parentName:"li",href:"../workspace"},"workspace")),(0,a.kt)("li",{parentName:"ol"},"Define the app dev-orient schema"),(0,a.kt)("li",{parentName:"ol"},"Develop the module by implementing gRPC interfaces")),(0,a.kt)("p",null,"The first two steps primarily involve communication with the application development team, and the specific details are not included in this tutorial. This tutorial begins with the subsequent two steps."),(0,a.kt)("h2",{id:"set-up-a-developing-environment"},"Set up a developing environment"),(0,a.kt)("p",null,"Developing a Kusion module includes defining a KCL schema and developing a module binary in golang. We will provide a scaffold repository and a new command ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion mod init")," to help developers set up the developing environment easily."),(0,a.kt)("p",null,"After executing the command"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"kusion mod init \n")),(0,a.kt)("p",null,"Kusion will download a ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion-module-scaffolding"},"scaffold repository")," and rename this project with your module name. The scaffold contains code templates and all files needed for developing a Kusion module."),(0,a.kt)("h2",{id:"developing"},"Developing"),(0,a.kt)("p",null,"The scaffold repository directory structure is shown below:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"$ tree kawesome/\n.\n\u251c\u2500\u2500 example\n\u2502\xa0\xa0 \u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 example_workspace.yaml\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2502\xa0\xa0 \u2514\u2500\u2500 project.yaml\n\u251c\u2500\u2500 kawesome.k\n\u251c\u2500\u2500 kcl.mod\n\u2514\u2500\u2500 src\n \u251c\u2500\u2500 Makefile\n \u251c\u2500\u2500 go.mod\n \u251c\u2500\u2500 go.sum\n \u251c\u2500\u2500 kawesome_generator.go\n \u2514\u2500\u2500 kawesome_generator_test.go\n")),(0,a.kt)("p",null,"When developing a Kusion module with the scaffold repository, you could follow the steps below:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("p",{parentName:"li"},(0,a.kt)("strong",{parentName:"p"},"Define the module name and version")," "),(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},"For go files. Rename the module name in the ",(0,a.kt)("inlineCode",{parentName:"li"},"go.mod")," and related files to your Kusion module name.")),(0,a.kt)("pre",{parentName:"li"},(0,a.kt)("code",{parentName:"pre",className:"language-yaml"}," module kawsome\n go 1.22\n require (\n ...\n )\n")),(0,a.kt)("ul",{parentName:"li"},(0,a.kt)("li",{parentName:"ul"},"For KCL files. Rename package name and version in the ",(0,a.kt)("inlineCode",{parentName:"li"},"kcl.mod"))),(0,a.kt)("pre",{parentName:"li"},(0,a.kt)("code",{parentName:"pre",className:"language-toml"},' [package]\n name = "kawesome"\n version = 0.1.0\n')),(0,a.kt)("p",{parentName:"li"}," We assume the module named is ",(0,a.kt)("inlineCode",{parentName:"p"},"kawesome")," and the version is ",(0,a.kt)("inlineCode",{parentName:"p"},"0.1.0")," in this guide.")),(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("p",{parentName:"li"},(0,a.kt)("strong",{parentName:"p"},"Define the dev-orient schemas"),". They would be initialized by app developers. In this scaffold repository, we've defined a schema named Kawesome in ",(0,a.kt)("inlineCode",{parentName:"p"},"kawesome.k")," that consists of two resources ",(0,a.kt)("inlineCode",{parentName:"p"},"Service")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"RandomPassword")," and they will be generated into a Kubernetes Service and a Terraform RandomPassword later."))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'schema Kawesome: \n""" Kawesome is a sample module schema consisting of Service\nand RandomPassword\n\nAttributes\n----------\nservice: Service, default is Undefined, required. \n The exposed port of Workload, which will be generated into Kubernetes Service. \nrandomPassword: RandomPassword, default is Undefined, required. \n The sensitive random string, which will be generated into Terraform random_password. \n\nExamples\n--------\nimport kawesome as ks\n\naccessories: {\n "kusionstack/kawesome@v0.1.0": ks.Kawesome {\n service: ks.Service {\n port: 8080\n }\n randomPassword: ks.RandomPassword {\n length: 20\n }\n }\n}\n"""\n\n# The exposed port of Workload, which will be generated into Kubernetes Service. \nservice: Service\n\n# The sensitive random string, which will be generated into Terraform random_password. \nrandomPassword: RandomPassword\n')),(0,a.kt)("ol",{start:3},(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("strong",{parentName:"li"},"Implement the gRPC generate interface.")," The ",(0,a.kt)("inlineCode",{parentName:"li"},"generate")," interface consumes the application developer's config described in the ",(0,a.kt)("a",{parentName:"li",href:"../app-configuration"},(0,a.kt)("inlineCode",{parentName:"a"},"AppConfiguration"))," and the platform engineer's config described in the ",(0,a.kt)("a",{parentName:"li",href:"../workspace"},(0,a.kt)("inlineCode",{parentName:"a"},"workspace"))," to generate all infrastructure resources represented by this module.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-go"},'func (k *Kawesome) Generate(_ context.Context, request *module.GeneratorRequest) (*module.GeneratorResponse, error){\n // generate your infrastructure resoruces\n}\n\n// Patcher contains fields should be patched into the workload corresponding fields\ntype Patcher struct {\n // Environments represent the environment variables patched to all containers in the workload.\n Environments []v1.EnvVar `json:"environments" yaml:"environments"`\n // Labels represent the labels patched to both the workload and pod.\n Labels map[string]string `json:"labels" yaml:"labels"`\n // Annotations represent the annotations patched to both the workload and pod.\n Annotations map[string]string `json:"annotations" yaml:"annotations"`\n}\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"GeneratorRequest")," contains the application developer's config, platform engineer's config, workload config and related metadata a module could need to generate infrastructure resources.\nIn the ",(0,a.kt)("inlineCode",{parentName:"p"},"GeneratorResponse"),", there are two fields, ",(0,a.kt)("inlineCode",{parentName:"p"},"Resources")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"Patchers"),". The ",(0,a.kt)("inlineCode",{parentName:"p"},"Resource")," represents resources that should operated by Kusion and they will be appended into the ",(0,a.kt)("a",{parentName:"p",href:"../spec"},"Spec"),". The ",(0,a.kt)("inlineCode",{parentName:"p"},"Patchers")," are used to patch other resources. In this version, Kusion will parse them and patch workload corresponding fields."),(0,a.kt)("h2",{id:"publish"},"Publish"),(0,a.kt)("p",null,"Publish the Kusion module to an OCI registry with the command ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion mod push"),"."),(0,a.kt)("p",null,"Publish a stable version"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"kusion mod push /path/to/your-module oci://ghcr.io/kusionstack --latest=true --creds \n")),(0,a.kt)("p",null,"Publish a pre-release version"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"kusion mod push /path/to/your-module oci://ghcr.io/kusionstack --latest=false --creds \n")),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"The OCI URL format is ",(0,a.kt)("inlineCode",{parentName:"p"},"oci:///")," and please ensure that your token has the appropriate permissions to write to the registry.")),(0,a.kt)("p",null,"More details can be found in the ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion mod push")," reference doc."),(0,a.kt)("h2",{id:"initialize-the-workspace"},"Initialize the workspace"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},"modules: \n kusionstack/kawesome@0.1.0: \n default: \n service: \n labels: \n kusionstack.io/module-name: kawesome\n")),(0,a.kt)("p",null,"Initialize module platform configuration in the ",(0,a.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," to standardize the module's behavior. Please notice the key of this module should match this format: ",(0,a.kt)("inlineCode",{parentName:"p"},"namespace/moduleName@version")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/cc91f96a.5ae33ec2.js b/assets/js/cc91f96a.5ae33ec2.js deleted file mode 100644 index d19fd29f8f3..00000000000 --- a/assets/js/cc91f96a.5ae33ec2.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2534],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>c});var o=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function i(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var s=o.createContext({}),d=function(e){var n=o.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},p=function(e){var n=d(e.components);return o.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},m=o.forwardRef((function(e,n){var t=e.components,a=e.mdxType,r=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),m=d(t),c=a,h=m["".concat(s,".").concat(c)]||m[c]||u[c]||r;return t?o.createElement(h,i(i({ref:n},p),{},{components:t})):o.createElement(h,i({ref:n},p))}));function c(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var r=t.length,i=new Array(r);i[0]=m;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var d=2;d{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>i,default:()=>u,frontMatter:()=>r,metadata:()=>l,toc:()=>d});var o=t(87462),a=(t(67294),t(3905));const r={},i="Platform Engineer Develop Guide",l={unversionedId:"concepts/kusion-module/develop-guide",id:"version-v0.11/concepts/kusion-module/develop-guide",title:"Platform Engineer Develop Guide",description:"Prerequisites",source:"@site/docs_versioned_docs/version-v0.11/3-concepts/3-kusion-module/2-develop-guide.md",sourceDirName:"3-concepts/3-kusion-module",slug:"/concepts/kusion-module/develop-guide",permalink:"/docs/concepts/kusion-module/develop-guide",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/3-concepts/3-kusion-module/2-develop-guide.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{},sidebar:"kusion",previous:{title:"Overview",permalink:"/docs/concepts/kusion-module/overview"},next:{title:"Application Developer User Guide",permalink:"/docs/concepts/kusion-module/app-dev-guide"}},s={},d=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Workflow",id:"workflow",level:2},{value:"Set up a developing environment",id:"set-up-a-developing-environment",level:2},{value:"Developing",id:"developing",level:2},{value:"Publish",id:"publish",level:2},{value:"Initialize the workspace",id:"initialize-the-workspace",level:2}],p={toc:d};function u(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,o.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"platform-engineer-develop-guide"},"Platform Engineer Develop Guide"),(0,a.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,a.kt)("p",null,"To follow this guide, you will need:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"Go 1.22 or higher installed and configured"),(0,a.kt)("li",{parentName:"ul"},"Kusion v0.11.0 or higher installed locally")),(0,a.kt)("h2",{id:"workflow"},"Workflow"),(0,a.kt)("p",null,"As a platform engineer, the workflow of developing a Kusion module looks like this:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Communicate with app developers and identify the fields that should exposed to them in the dev-orient schema"),(0,a.kt)("li",{parentName:"ol"},"Identify module input parameters that should be configured by platform engineers in the ",(0,a.kt)("a",{parentName:"li",href:"../workspace"},"workspace")),(0,a.kt)("li",{parentName:"ol"},"Define the app dev-orient schema"),(0,a.kt)("li",{parentName:"ol"},"Develop the module by implementing gRPC interfaces")),(0,a.kt)("p",null,"The first two steps primarily involve communication with the application development team, and the specific details are not included in this tutorial. This tutorial begins with the subsequent two steps."),(0,a.kt)("h2",{id:"set-up-a-developing-environment"},"Set up a developing environment"),(0,a.kt)("p",null,"Developing a Kusion module includes defining a KCL schema and developing a module binary in golang. We will provide a scaffold repository and a new command ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion mod init")," to help developers set up the developing environment easily."),(0,a.kt)("p",null,"After executing the command"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"kusion mod init \n")),(0,a.kt)("p",null,"Kusion will download a ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion-module-scaffolding"},"scaffold repository")," and rename this project with your module name. The scaffold contains code templates and all files needed for developing a Kusion module."),(0,a.kt)("h2",{id:"developing"},"Developing"),(0,a.kt)("p",null,"The scaffold repository directory structure is shown below:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"$ tree kawesome/\n.\n\u251c\u2500\u2500 example\n\u2502\xa0\xa0 \u251c\u2500\u2500 dev\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 example_workspace.yaml\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 kcl.mod\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u251c\u2500\u2500 main.k\n\u2502\xa0\xa0 \u2502\xa0\xa0 \u2514\u2500\u2500 stack.yaml\n\u2502\xa0\xa0 \u2514\u2500\u2500 project.yaml\n\u251c\u2500\u2500 kawesome.k\n\u251c\u2500\u2500 kcl.mod\n\u2514\u2500\u2500 src\n \u251c\u2500\u2500 Makefile\n \u251c\u2500\u2500 go.mod\n \u251c\u2500\u2500 go.sum\n \u251c\u2500\u2500 kawesome_generator.go\n \u2514\u2500\u2500 kawesome_generator_test.go\n")),(0,a.kt)("p",null,"When developing a Kusion module with the scaffold repository, you could follow the steps below:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("strong",{parentName:"li"},"Define module name.")," Rename ",(0,a.kt)("inlineCode",{parentName:"li"},"go.mod")," module and related files to your Kusion module name. We assume the module named is ",(0,a.kt)("inlineCode",{parentName:"li"},"kawesome")," in this guide."),(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("strong",{parentName:"li"},"Define the dev-orient schemas"),". They would be initialized by app developers. In this scaffold repository, we've defined a schema named Kawesome in ",(0,a.kt)("inlineCode",{parentName:"li"},"kawesome.k")," that consists of two resources ",(0,a.kt)("inlineCode",{parentName:"li"},"Service")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"RandomPassword")," and they will be generated into a Kubernetes Service and a Terraform RandomPassword later.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'schema Kawesome: \n""" Kawesome is a sample module schema consisting of Service\nand RandomPassword\n\nAttributes\n----------\nservice: Service, default is Undefined, required. \n The exposed port of Workload, which will be generated into Kubernetes Service. \nrandomPassword: RandomPassword, default is Undefined, required. \n The sensitive random string, which will be generated into Terraform random_password. \n\nExamples\n--------\nimport kawesome as ks\n\naccessories: {\n "kusionstack/kawesome@v0.1.0": ks.Kawesome {\n service: ks.Service {\n port: 8080\n }\n randomPassword: ks.RandomPassword {\n length: 20\n }\n }\n}\n"""\n\n# The exposed port of Workload, which will be generated into Kubernetes Service. \nservice: Service\n\n# The sensitive random string, which will be generated into Terraform random_password. \nrandomPassword: RandomPassword\n')),(0,a.kt)("ol",{start:3},(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("strong",{parentName:"li"},"Implement the gRPC generate interface.")," The ",(0,a.kt)("inlineCode",{parentName:"li"},"generate")," interface consumes the application developer's config described in the ",(0,a.kt)("a",{parentName:"li",href:"../app-configuration"},(0,a.kt)("inlineCode",{parentName:"a"},"AppConfiguration"))," and the platform engineer's config described in the ",(0,a.kt)("a",{parentName:"li",href:"../workspace"},(0,a.kt)("inlineCode",{parentName:"a"},"workspace"))," to generate all infrastructure resources represented by this module.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-go"},'func (k *Kawesome) Generate(_ context.Context, request *module.GeneratorRequest) (*module.GeneratorResponse, error){\n // generate your infrastructure resoruces\n}\n\n// Patcher contains fields should be patched into the workload corresponding fields\ntype Patcher struct {\n // Environments represent the environment variables patched to all containers in the workload.\n Environments []v1.EnvVar `json:"environments" yaml:"environments"`\n // Labels represent the labels patched to both the workload and pod.\n Labels map[string]string `json:"labels" yaml:"labels"`\n // Annotations represent the annotations patched to both the workload and pod.\n Annotations map[string]string `json:"annotations" yaml:"annotations"`\n}\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"GeneratorRequest")," contains the application developer's config, platform engineer's config, workload config and related metadata a module could need to generate infrastructure resources.\nIn the ",(0,a.kt)("inlineCode",{parentName:"p"},"GeneratorResponse"),", there are two fields, ",(0,a.kt)("inlineCode",{parentName:"p"},"Resources")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"Patchers"),". The ",(0,a.kt)("inlineCode",{parentName:"p"},"Resource")," represents resources that should operated by Kusion and they will be appended into the ",(0,a.kt)("a",{parentName:"p",href:"../spec"},"Spec"),". The ",(0,a.kt)("inlineCode",{parentName:"p"},"Patchers")," are used to patch other resources. In this version, Kusion will parse them and patch workload corresponding fields."),(0,a.kt)("h2",{id:"publish"},"Publish"),(0,a.kt)("p",null,"Publish the Kusion module to an OCI registry with the command ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion mod push"),"."),(0,a.kt)("p",null,"Publish a stable version"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"kusion mod push /path/to/your-module oci://ghcr.io/kusionstack/kawesome --version=1.0.0 --latest=true --creds \n")),(0,a.kt)("p",null,"Publish a pre-release version"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"kusion mod push /path/to/your-module oci://ghcr.io/kusionstack/kawesome --version=1.0.0-rc.1 --latest=false --creds \n")),(0,a.kt)("admonition",{type:"info"},(0,a.kt)("p",{parentName:"admonition"},"Please ensure that your token has the appropriate permissions to write to the registry.")),(0,a.kt)("p",null,"More details can be found in the ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion mod push")," reference doc."),(0,a.kt)("h2",{id:"initialize-the-workspace"},"Initialize the workspace"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},"modules: \n kusionstack/kawesome@0.1.0: \n default: \n service: \n labels: \n kusionstack.io/module-name: kawesome\n")),(0,a.kt)("p",null,"Initialize module platform configuration in the ",(0,a.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," to standardize the module's behavior. Please notice the key of this module should match this format: ",(0,a.kt)("inlineCode",{parentName:"p"},"namespace/moduleName@version")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/cd9e621c.c5f6b1df.js b/assets/js/cd9e621c.8bb18043.js similarity index 54% rename from assets/js/cd9e621c.c5f6b1df.js rename to assets/js/cd9e621c.8bb18043.js index 8a9faecc6ef..91b0220b7b8 100644 --- a/assets/js/cd9e621c.c5f6b1df.js +++ b/assets/js/cd9e621c.8bb18043.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7744],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},l=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=c(n),m=o,k=d["".concat(p,".").concat(m)]||d[m]||u[m]||a;return n?r.createElement(k,s(s({ref:t},l),{},{components:n})):r.createElement(k,s({ref:t},l))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=d;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>c});var r=n(87462),o=(n(67294),n(3905));const a={},s="kusion workspace list",i={unversionedId:"reference/commands/kusion-workspace-list",id:"reference/commands/kusion-workspace-list",title:"kusion workspace list",description:"List all workspace names",source:"@site/docs/kusion/6-reference/1-commands/kusion-workspace-list.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-list",permalink:"/docs/next/reference/commands/kusion-workspace-list",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-workspace-list.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace delete",permalink:"/docs/next/reference/commands/kusion-workspace-delete"},next:{title:"kusion workspace show",permalink:"/docs/next/reference/commands/kusion-workspace-show"}},p={},c=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:c};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-list"},"kusion workspace list"),(0,o.kt)("p",null,"List all workspace names"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command list the names of all workspaces."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace list\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # List all workspace names\n kusion workspace list\n \n # List all workspace names in a specified backend\n kusion workspace list --backend oss-prod\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string the backend name\n -h, --help help for list\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7744],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},l=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,p=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=c(n),m=o,k=d["".concat(p,".").concat(m)]||d[m]||u[m]||a;return n?r.createElement(k,s(s({ref:t},l),{},{components:n})):r.createElement(k,s({ref:t},l))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,s=new Array(a);s[0]=d;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>c});var r=n(87462),o=(n(67294),n(3905));const a={},s="kusion workspace list",i={unversionedId:"reference/commands/kusion-workspace-list",id:"reference/commands/kusion-workspace-list",title:"kusion workspace list",description:"List all workspace names",source:"@site/docs/kusion/6-reference/1-commands/kusion-workspace-list.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-list",permalink:"/docs/next/reference/commands/kusion-workspace-list",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-workspace-list.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace delete",permalink:"/docs/next/reference/commands/kusion-workspace-delete"},next:{title:"kusion workspace show",permalink:"/docs/next/reference/commands/kusion-workspace-show"}},p={},c=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:c};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-list"},"kusion workspace list"),(0,o.kt)("p",null,"List all workspace names"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command list the names of all workspaces."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace list\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # List all workspace names\n kusion workspace list\n \n # List all workspace names in a specified backend\n kusion workspace list --backend oss-prod\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string the backend name\n -h, --help help for list\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ce316b05.01be9a2c.js b/assets/js/ce316b05.01be9a2c.js new file mode 100644 index 00000000000..30dc938e234 --- /dev/null +++ b/assets/js/ce316b05.01be9a2c.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3280],{3905:(e,n,r)=>{r.d(n,{Zo:()=>p,kt:()=>f});var t=r(67294);function o(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function i(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,t)}return r}function a(e){for(var n=1;n=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=t.createContext({}),l=function(e){var n=t.useContext(c),r=n;return e&&(r="function"==typeof e?e(n):a(a({},n),e)),r},p=function(e){var n=l(e.components);return t.createElement(c.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},u=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=l(r),f=o,m=u["".concat(c,".").concat(f)]||u[f]||d[f]||i;return r?t.createElement(m,a(a({ref:n},p),{},{components:r})):t.createElement(m,a({ref:n},p))}));function f(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=u;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var l=2;l{r.r(n),r.d(n,{assets:()=>c,contentTitle:()=>a,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var t=r(87462),o=(r(67294),r(3905));const i={id:"overview",sidebar_label:"Overview"},a="Overview",s={unversionedId:"reference/model/overview",id:"version-v0.9/reference/model/overview",title:"Overview",description:"KusionStack presets application configuration models described by KCL, where the model is called Kusion Model. The GitHub repository KusionStack/catalog is used to store these models, which is known as Kusion Model Library.",source:"@site/docs_versioned_docs/version-v0.9/reference/model/1-overview.md",sourceDirName:"reference/model",slug:"/reference/model/overview",permalink:"/docs/v0.9/reference/model/overview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/1-overview.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"overview",sidebar_label:"Overview"},sidebar:"kusion",previous:{title:"Kusion Model Library",permalink:"/docs/v0.9/reference/model/"},next:{title:"App Configuration",permalink:"/docs/v0.9/reference/model/catalog_models/doc_app_configuration"}},c={},l=[],p={toc:l};function d(e){let{components:n,...r}=e;return(0,o.kt)("wrapper",(0,t.Z)({},p,r,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"overview"},"Overview"),(0,o.kt)("p",null,"KusionStack presets application configuration models described by KCL, where the model is called ",(0,o.kt)("strong",{parentName:"p"},"Kusion Model"),". The GitHub repository ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"KusionStack/catalog")," is used to store these models, which is known as ",(0,o.kt)("strong",{parentName:"p"},"Kusion Model Library"),"."),(0,o.kt)("p",null,"The original intention of designing Kusion Model is to enhance the efficiency and improve the experience of YAML users. Through the unified application model defined by code, abstract and encapsulate complex configuration items, omit repetitive and derivable configurations, and supplement with necessary verification logic. Only the necessary attributes get exposed, users get an out-of-the-box, easy-to-understand configuration interface, which reduces the difficulty and improves the reliability of the configuration work."),(0,o.kt)("p",null,"Kusion Model Library currently provides the Kusion Model ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),". The design of ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," is developer-centric, based on Ant Group's decades of practice in building and managing hyperscale IDP (Internal Developer Platform), and the best practice of community. ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," describes the full lifecycle of an application."),(0,o.kt)("p",null,"A simple example of using ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," to describe an application is as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},'wordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "wordpress": c.Container {\n image: "wordpress:latest"\n env: {\n "WORDPRESS_DB_HOST": "secret://wordpress-db/hostAddress"\n "WORDPRESS_DB_PASSWORD": "secret://wordpress-db/password"\n }\n resources: {\n "cpu": "1"\n "memory": "2Gi"\n }\n }\n }\n replicas: 2\n ports: [\n n.Port {\n port: 80\n public: True\n }\n ]\n }\n \n database: db.Database {\n type: "alicloud"\n engine: "MySQL"\n version: "5.7"\n size: 20\n instanceType: "mysql.n2.serverless.1c"\n category: "serverless_basic"\n }\n}\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ce316b05.1e3c7ad4.js b/assets/js/ce316b05.1e3c7ad4.js deleted file mode 100644 index ba04d056695..00000000000 --- a/assets/js/ce316b05.1e3c7ad4.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3280],{3905:(e,n,r)=>{r.d(n,{Zo:()=>p,kt:()=>f});var t=r(67294);function o(e,n,r){return n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function i(e,n){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);n&&(t=t.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),r.push.apply(r,t)}return r}function a(e){for(var n=1;n=0||(o[r]=e[r]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(t=0;t=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=t.createContext({}),l=function(e){var n=t.useContext(c),r=n;return e&&(r="function"==typeof e?e(n):a(a({},n),e)),r},p=function(e){var n=l(e.components);return t.createElement(c.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return t.createElement(t.Fragment,{},n)}},u=t.forwardRef((function(e,n){var r=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=l(r),f=o,m=u["".concat(c,".").concat(f)]||u[f]||d[f]||i;return r?t.createElement(m,a(a({ref:n},p),{},{components:r})):t.createElement(m,a({ref:n},p))}));function f(e,n){var r=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=u;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var l=2;l{r.r(n),r.d(n,{assets:()=>c,contentTitle:()=>a,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var t=r(87462),o=(r(67294),r(3905));const i={id:"overview",sidebar_label:"Overview"},a="Overview",s={unversionedId:"reference/model/overview",id:"version-v0.9/reference/model/overview",title:"Overview",description:"KusionStack presets application configuration models described by KCL, where the model is called Kusion Model. The GitHub repository KusionStack/catalog is used to store these models, which is known as Kusion Model Library.",source:"@site/docs_versioned_docs/version-v0.9/reference/model/1-overview.md",sourceDirName:"reference/model",slug:"/reference/model/overview",permalink:"/docs/v0.9/reference/model/overview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/reference/model/1-overview.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"overview",sidebar_label:"Overview"},sidebar:"kusion",previous:{title:"Kusion Model Library",permalink:"/docs/v0.9/reference/model/"},next:{title:"App Configuration",permalink:"/docs/v0.9/reference/model/catalog_models/doc_app_configuration"}},c={},l=[],p={toc:l};function d(e){let{components:n,...r}=e;return(0,o.kt)("wrapper",(0,t.Z)({},p,r,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"overview"},"Overview"),(0,o.kt)("p",null,"KusionStack presets application configuration models described by KCL, where the model is called ",(0,o.kt)("strong",{parentName:"p"},"Kusion Model"),". The GitHub repository ",(0,o.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"KusionStack/catalog")," is used to store these models, which is known as ",(0,o.kt)("strong",{parentName:"p"},"Kusion Model Library"),"."),(0,o.kt)("p",null,"The original intention of designing Kusion Model is to enhance the efficiency and improve the experience of YAML users. Through the unified application model defined by code, abstract and encapsulate complex configuration items, omit repetitive and derivable configurations, and supplement with necessary verification logic. Only the necessary attributes get exposed, users get an out-of-the-box, easy-to-understand configuration interface, which reduces the difficulty and improves the reliability of the configuration work."),(0,o.kt)("p",null,"Kusion Model Library currently provides the Kusion Model ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration"),". The design of ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," is developer-centric, based on Ant Group's decades of practice in building and managing hyperscale IDP (Internal Developer Platform), and the best practice of community. ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," describes the full lifecycle of an application."),(0,o.kt)("p",null,"A simple example of using ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," to describe an application is as follows:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},'wordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "wordpress": c.Container {\n image: "wordpress:latest"\n env: {\n "WORDPRESS_DB_HOST": "secret://wordpress-db/hostAddress"\n "WORDPRESS_DB_PASSWORD": "secret://wordpress-db/password"\n }\n resources: {\n "cpu": "1"\n "memory": "2Gi"\n }\n }\n }\n replicas: 2\n ports: [\n n.Port {\n port: 80\n public: True\n }\n ]\n }\n \n database: db.Database {\n type: "alicloud"\n engine: "MySQL"\n version: "5.7"\n size: 20\n instanceType: "mysql.n2.serverless.1c"\n category: "serverless_basic"\n }\n}\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d037b23d.189944c3.js b/assets/js/d037b23d.189944c3.js new file mode 100644 index 00000000000..da1523c2ec3 --- /dev/null +++ b/assets/js/d037b23d.189944c3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7631],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(n),m=i,k=u["".concat(s,".").concat(m)]||u[m]||c[m]||o;return n?a.createElement(k,r(r({ref:t},d),{},{components:n})):a.createElement(k,r({ref:t},d))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,r=new Array(o);r[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>r,default:()=>c,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var a=n(87462),i=(n(67294),n(3905));const o={id:"kcl-basics"},r="KCL Basics",l={unversionedId:"configuration-walkthrough/kcl-basics",id:"version-v0.10/configuration-walkthrough/kcl-basics",title:"KCL Basics",description:"Table of Content",source:"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/2-kcl-basics.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/kcl-basics",permalink:"/docs/v0.10/configuration-walkthrough/kcl-basics",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/2-kcl-basics.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"kcl-basics"},sidebar:"kusion",previous:{title:"Configuration File Overview",permalink:"/docs/v0.10/configuration-walkthrough/overview"},next:{title:"Base and Override",permalink:"/docs/v0.10/configuration-walkthrough/base-override"}},s={},p=[{value:"Table of Content",id:"table-of-content",level:2},{value:"Variable assignments",id:"variable-assignments",level:2},{value:"Common built-in types",id:"common-built-in-types",level:2},{value:"Lists and maps",id:"lists-and-maps",level:2},{value:"Conditional statements",id:"conditional-statements",level:2},{value:"The : and = operator",id:"the--and--operator",level:2},{value:"Advanced KCL capabilities",id:"advanced-kcl-capabilities",level:2}],d={toc:p};function c(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"kcl-basics"},"KCL Basics"),(0,i.kt)("h2",{id:"table-of-content"},"Table of Content"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#variable-assignments"},"Variable assignments")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#common-built-in-types"},"Common built-in types")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#lists-and-maps"},"Lists and maps")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#conditional-statements"},"Conditional statements")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#the--and--operator"},"The : and = operator")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#advanced-kcl-capabilities"},"Advanced KCL capabilities"))),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/"},"KCL")," is the choice of configuration language consumed by Kusion. KCL is an open source constraint-based record and functional language. KCL works well with a large number of complex configurations via modern programming language technology and practice, and is committed to provide better modularity, scalability, stability and extensibility."),(0,i.kt)("h2",{id:"variable-assignments"},"Variable assignments"),(0,i.kt)("p",null,"There are two ways to initialize a variable in KCL. You can either use the ",(0,i.kt)("inlineCode",{parentName:"p"},":")," operator or the ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operator. We will discuss the difference between them in ",(0,i.kt)("a",{parentName:"p",href:"#the--and--operator"},"this section later"),"."),(0,i.kt)("p",null,"Here are the two ways to create a variable and initialize it:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'foo = "Foo" # Declare a variable named `foo` and its value is a string literal "Foo"\nbar: "Bar" # Declare a variable named `bar` and its value is a string literal "Bar"\n')),(0,i.kt)("p",null,"You will be able to override a variable assignment via the ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operator. We will discuss this in depth in the ",(0,i.kt)("a",{parentName:"p",href:"#the--and--operator"},(0,i.kt)("inlineCode",{parentName:"a"},":")," and ",(0,i.kt)("inlineCode",{parentName:"a"},"=")," operator section"),"."),(0,i.kt)("h2",{id:"common-built-in-types"},"Common built-in types"),(0,i.kt)("p",null,"KCL supports ",(0,i.kt)("inlineCode",{parentName:"p"},"int"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"float"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"bool")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"string")," as the built-in types."),(0,i.kt)("p",null,"Other types are defined in the packages that are imported into the application configuration files. One such example would be the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," object (or ",(0,i.kt)("inlineCode",{parentName:"p"},"Container"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Probe"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Port")," object, etc) that are defined in the ",(0,i.kt)("inlineCode",{parentName:"p"},"catalog")," repository."),(0,i.kt)("h2",{id:"lists-and-maps"},"Lists and maps"),(0,i.kt)("p",null,"Lists are represented using the ",(0,i.kt)("inlineCode",{parentName:"p"},"[]")," notation.\nAn example of lists:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"list0 = [1, 2, 3]\nlist1 = [4, 5, 6]\njoined_list = list0 + list1 # [1, 2, 3, 4, 5, 6]\n")),(0,i.kt)("p",null,"Maps are represented using the ",(0,i.kt)("inlineCode",{parentName:"p"},"{}")," notation.\nAn example of maps:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"a = {\"one\" = 1, \"two\" = 2, \"three\" = 3}\nb = {'one' = 1, 'two' = 2, 'three' = 3}\nassert a == b # True\nassert len(a) == 3 # True\n")),(0,i.kt)("h2",{id:"conditional-statements"},"Conditional statements"),(0,i.kt)("p",null,"You can also use basic control flow statements when writing the configuration file."),(0,i.kt)("p",null,"An example that sets the value of ",(0,i.kt)("inlineCode",{parentName:"p"},"replicas")," conditionally based on the value of ",(0,i.kt)("inlineCode",{parentName:"p"},"containers.myapp.resources.cpu"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\n\nmyapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: ""\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1 if containers.myapp.resources.cpu == "500m" else 2\n }\n}\n')),(0,i.kt)("p",null,"For more details on KCL's control flow statements, please refer to the ",(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/reference/lang/tour#control-flow-statements"},"KCL documentation"),"."),(0,i.kt)("h2",{id:"the--and--operator"},"The ",(0,i.kt)("inlineCode",{parentName:"h2"},":")," and ",(0,i.kt)("inlineCode",{parentName:"h2"},"=")," operator"),(0,i.kt)("p",null,"You might have noticed there is a mixed usage of the ",(0,i.kt)("inlineCode",{parentName:"p"},":")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," in the samples above."),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("strong",{parentName:"p"},"TLDR: The recommendation is to use ",(0,i.kt)("inlineCode",{parentName:"strong"},":")," in the common configurations, and ",(0,i.kt)("inlineCode",{parentName:"strong"},"=")," for override in the environment-specific configurations."))),(0,i.kt)("p",null,"In KCL:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},":")," represents a union-ed value assignment. In the pattern ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier: E")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier: T E"),", the value of the expression ",(0,i.kt)("inlineCode",{parentName:"li"},"E")," with optional type annotation ",(0,i.kt)("inlineCode",{parentName:"li"},"T")," will be merged and union-ed into the element value."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"=")," represents a value override. In the pattern ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier = E")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier = T E"),", The value of the expression ",(0,i.kt)("inlineCode",{parentName:"li"},"E")," with optional type annotation ",(0,i.kt)("inlineCode",{parentName:"li"},"T")," will override the ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier")," attribute value.")),(0,i.kt)("p",null,"Let's take a look at an example:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"# This is one configuration that will be merged.\nconfig: Config {\n data.d1 = 1\n}\n# This is another configuration that will be merged.\nconfig: Config {\n data.d2 = 2\n}\n")),(0,i.kt)("p",null,"The above is equivalent to the snippet below since the two expressions for ",(0,i.kt)("inlineCode",{parentName:"p"},"config")," get merged/union-ed into one:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"config: Config {\n data.d1 = 1\n data.d2 = 1\n}\n")),(0,i.kt)("p",null,"whereas using the ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operators will result in a different outcome:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"# This is first configuration.\nconfig = Config {\n data.d1 = 1\n}\n# This is second configuration that will override the prior one.\nconfig = Config {\n data.d2 = 2\n}\n")),(0,i.kt)("p",null,"The config above results in:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"config: Config {\n data.d2 = 2\n}\n")),(0,i.kt)("p",null,"Please note that the ",(0,i.kt)("inlineCode",{parentName:"p"},":")," attribute operator represents an idempotent merge operation, and an error will be thrown when the values that need to be merged conflict with each other."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"data0 = {id: 1} | {id: 2} # Error\uff1aconflicting values between {'id': 2} and {'id': 1}\ndata1 = {id: 1} | {id = 2} # Ok, the value of `data` is {\"id\": 2}\n")),(0,i.kt)("p",null,"More about ",(0,i.kt)("inlineCode",{parentName:"p"},":")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operator can be found in the ",(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/reference/lang/tour#config-operations"},"KCL documentation"),"."),(0,i.kt)("h2",{id:"advanced-kcl-capabilities"},"Advanced KCL capabilities"),(0,i.kt)("p",null,"For more advanced KCL capabilities, please visit the ",(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/user_docs/support/faq-kcl"},"KCL website"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d037b23d.a66e20ea.js b/assets/js/d037b23d.a66e20ea.js deleted file mode 100644 index 3ba968c7092..00000000000 --- a/assets/js/d037b23d.a66e20ea.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7631],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=p(n),m=i,k=u["".concat(s,".").concat(m)]||u[m]||c[m]||o;return n?a.createElement(k,r(r({ref:t},d),{},{components:n})):a.createElement(k,r({ref:t},d))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,r=new Array(o);r[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:i,r[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>r,default:()=>c,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var a=n(87462),i=(n(67294),n(3905));const o={id:"kcl-basics"},r="KCL Basics",l={unversionedId:"configuration-walkthrough/kcl-basics",id:"version-v0.10/configuration-walkthrough/kcl-basics",title:"KCL Basics",description:"Table of Content",source:"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/2-kcl-basics.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/kcl-basics",permalink:"/docs/v0.10/configuration-walkthrough/kcl-basics",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/2-kcl-basics.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{id:"kcl-basics"},sidebar:"kusion",previous:{title:"Configuration File Overview",permalink:"/docs/v0.10/configuration-walkthrough/overview"},next:{title:"Base and Override",permalink:"/docs/v0.10/configuration-walkthrough/base-override"}},s={},p=[{value:"Table of Content",id:"table-of-content",level:2},{value:"Variable assignments",id:"variable-assignments",level:2},{value:"Common built-in types",id:"common-built-in-types",level:2},{value:"Lists and maps",id:"lists-and-maps",level:2},{value:"Conditional statements",id:"conditional-statements",level:2},{value:"The : and = operator",id:"the--and--operator",level:2},{value:"Advanced KCL capabilities",id:"advanced-kcl-capabilities",level:2}],d={toc:p};function c(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"kcl-basics"},"KCL Basics"),(0,i.kt)("h2",{id:"table-of-content"},"Table of Content"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#variable-assignments"},"Variable assignments")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#common-built-in-types"},"Common built-in types")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#lists-and-maps"},"Lists and maps")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#conditional-statements"},"Conditional statements")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#the--and--operator"},"The : and = operator")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"#advanced-kcl-capabilities"},"Advanced KCL capabilities"))),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/"},"KCL")," is the choice of configuration language consumed by Kusion. KCL is an open source constraint-based record and functional language. KCL works well with a large number of complex configurations via modern programming language technology and practice, and is committed to provide better modularity, scalability, stability and extensibility."),(0,i.kt)("h2",{id:"variable-assignments"},"Variable assignments"),(0,i.kt)("p",null,"There are two ways to initialize a variable in KCL. You can either use the ",(0,i.kt)("inlineCode",{parentName:"p"},":")," operator or the ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operator. We will discuss the difference between them in ",(0,i.kt)("a",{parentName:"p",href:"#the--and--operator"},"this section later"),"."),(0,i.kt)("p",null,"Here are the two ways to create a variable and initialize it:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'foo = "Foo" # Declare a variable named `foo` and its value is a string literal "Foo"\nbar: "Bar" # Declare a variable named `bar` and its value is a string literal "Bar"\n')),(0,i.kt)("p",null,"You will be able to override a variable assignment via the ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operator. We will discuss this in depth in the ",(0,i.kt)("a",{parentName:"p",href:"#the--and--operator"},(0,i.kt)("inlineCode",{parentName:"a"},":")," and ",(0,i.kt)("inlineCode",{parentName:"a"},"=")," operator section"),"."),(0,i.kt)("h2",{id:"common-built-in-types"},"Common built-in types"),(0,i.kt)("p",null,"KCL supports ",(0,i.kt)("inlineCode",{parentName:"p"},"int"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"float"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"bool")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"string")," as the built-in types."),(0,i.kt)("p",null,"Other types are defined in the packages that are imported into the application configuration files. One such example would be the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," object (or ",(0,i.kt)("inlineCode",{parentName:"p"},"Container"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Probe"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Port")," object, etc) that are defined in the ",(0,i.kt)("inlineCode",{parentName:"p"},"catalog")," repository."),(0,i.kt)("h2",{id:"lists-and-maps"},"Lists and maps"),(0,i.kt)("p",null,"Lists are represented using the ",(0,i.kt)("inlineCode",{parentName:"p"},"[]")," notation.\nAn example of lists:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"list0 = [1, 2, 3]\nlist1 = [4, 5, 6]\njoined_list = list0 + list1 # [1, 2, 3, 4, 5, 6]\n")),(0,i.kt)("p",null,"Maps are represented using the ",(0,i.kt)("inlineCode",{parentName:"p"},"{}")," notation.\nAn example of maps:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"a = {\"one\" = 1, \"two\" = 2, \"three\" = 3}\nb = {'one' = 1, 'two' = 2, 'three' = 3}\nassert a == b # True\nassert len(a) == 3 # True\n")),(0,i.kt)("h2",{id:"conditional-statements"},"Conditional statements"),(0,i.kt)("p",null,"You can also use basic control flow statements when writing the configuration file."),(0,i.kt)("p",null,"An example that sets the value of ",(0,i.kt)("inlineCode",{parentName:"p"},"replicas")," conditionally based on the value of ",(0,i.kt)("inlineCode",{parentName:"p"},"containers.myapp.resources.cpu"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\n\nmyapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: ""\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1 if containers.myapp.resources.cpu == "500m" else 2\n }\n}\n')),(0,i.kt)("p",null,"For more details on KCL's control flow statements, please refer to the ",(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/reference/lang/tour#control-flow-statements"},"KCL documentation"),"."),(0,i.kt)("h2",{id:"the--and--operator"},"The ",(0,i.kt)("inlineCode",{parentName:"h2"},":")," and ",(0,i.kt)("inlineCode",{parentName:"h2"},"=")," operator"),(0,i.kt)("p",null,"You might have noticed there is a mixed usage of the ",(0,i.kt)("inlineCode",{parentName:"p"},":")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," in the samples above."),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},(0,i.kt)("strong",{parentName:"p"},"TLDR: The recommendation is to use ",(0,i.kt)("inlineCode",{parentName:"strong"},":")," in the common configurations, and ",(0,i.kt)("inlineCode",{parentName:"strong"},"=")," for override in the environment-specific configurations."))),(0,i.kt)("p",null,"In KCL:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},":")," represents a union-ed value assignment. In the pattern ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier: E")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier: T E"),", the value of the expression ",(0,i.kt)("inlineCode",{parentName:"li"},"E")," with optional type annotation ",(0,i.kt)("inlineCode",{parentName:"li"},"T")," will be merged and union-ed into the element value."),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("inlineCode",{parentName:"li"},"=")," represents a value override. In the pattern ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier = E")," or ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier = T E"),", The value of the expression ",(0,i.kt)("inlineCode",{parentName:"li"},"E")," with optional type annotation ",(0,i.kt)("inlineCode",{parentName:"li"},"T")," will override the ",(0,i.kt)("inlineCode",{parentName:"li"},"identifier")," attribute value.")),(0,i.kt)("p",null,"Let's take a look at an example:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"# This is one configuration that will be merged.\nconfig: Config {\n data.d1 = 1\n}\n# This is another configuration that will be merged.\nconfig: Config {\n data.d2 = 2\n}\n")),(0,i.kt)("p",null,"The above is equivalent to the snippet below since the two expressions for ",(0,i.kt)("inlineCode",{parentName:"p"},"config")," get merged/union-ed into one:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"config: Config {\n data.d1 = 1\n data.d2 = 1\n}\n")),(0,i.kt)("p",null,"whereas using the ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operators will result in a different outcome:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"# This is first configuration.\nconfig = Config {\n data.d1 = 1\n}\n# This is second configuration that will override the prior one.\nconfig = Config {\n data.d2 = 2\n}\n")),(0,i.kt)("p",null,"The config above results in:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"config: Config {\n data.d2 = 2\n}\n")),(0,i.kt)("p",null,"Please note that the ",(0,i.kt)("inlineCode",{parentName:"p"},":")," attribute operator represents an idempotent merge operation, and an error will be thrown when the values that need to be merged conflict with each other."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"data0 = {id: 1} | {id: 2} # Error\uff1aconflicting values between {'id': 2} and {'id': 1}\ndata1 = {id: 1} | {id = 2} # Ok, the value of `data` is {\"id\": 2}\n")),(0,i.kt)("p",null,"More about ",(0,i.kt)("inlineCode",{parentName:"p"},":")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"=")," operator can be found in the ",(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/reference/lang/tour#config-operations"},"KCL documentation"),"."),(0,i.kt)("h2",{id:"advanced-kcl-capabilities"},"Advanced KCL capabilities"),(0,i.kt)("p",null,"For more advanced KCL capabilities, please visit the ",(0,i.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/user_docs/support/faq-kcl"},"KCL website"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d08bdbd3.10a63872.js b/assets/js/d08bdbd3.10a63872.js deleted file mode 100644 index 946e152b071..00000000000 --- a/assets/js/d08bdbd3.10a63872.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5665],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},c=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),c=p(n),d=o,g=c["".concat(s,".").concat(d)]||c[d]||m[d]||a;return n?r.createElement(g,i(i({ref:t},u),{},{components:n})):r.createElement(g,i({ref:t},u))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=c;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>m,frontMatter:()=>a,metadata:()=>l,toc:()=>p});var r=n(87462),o=(n(67294),n(3905));const a={},i="monitoring",l={unversionedId:"reference/modules/workspace-configs/monitoring/prometheus",id:"reference/modules/workspace-configs/monitoring/prometheus",title:"monitoring",description:"monitoring can be used to define workspace-level monitoring configurations.",source:"@site/docs/kusion/6-reference/2-modules/2-workspace-configs/monitoring/prometheus.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/monitoring",slug:"/reference/modules/workspace-configs/monitoring/prometheus",permalink:"/docs/next/reference/modules/workspace-configs/monitoring/prometheus",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/2-workspace-configs/monitoring/prometheus.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"postgres",permalink:"/docs/next/reference/modules/workspace-configs/database/postgres"},next:{title:"network",permalink:"/docs/next/reference/modules/workspace-configs/networking/network"}},s={},p=[{value:"Attributes",id:"attributes",level:2},{value:"Examples",id:"examples",level:3}],u={toc:p};function m(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"monitoring"},"monitoring"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"monitoring")," can be used to define workspace-level monitoring configurations."),(0,o.kt)("h2",{id:"attributes"},"Attributes"),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,o.kt)("th",{parentName:"tr",align:null},"Type"),(0,o.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,o.kt)("th",{parentName:"tr",align:null},"Required"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"operatorMode"),(0,o.kt)("br",null),"Whether the Prometheus instance installed in the cluster runs as a Kubernetes operator or not. This determines the different kinds of resources Kusion manages."),(0,o.kt)("td",{parentName:"tr",align:null},"true ","|"," false"),(0,o.kt)("td",{parentName:"tr",align:null},"false"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"monitorType"),(0,o.kt)("br",null),"The kind of monitor to create. It only applies when operatorMode is set to True."),(0,o.kt)("td",{parentName:"tr",align:null},'"Service" ',"|",' "Pod"'),(0,o.kt)("td",{parentName:"tr",align:null},'"Service"'),(0,o.kt)("td",{parentName:"tr",align:null},"optional")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"interval"),(0,o.kt)("br",null),"The time interval which Prometheus scrapes metrics data. Only applicable when operator mode is set to true.",(0,o.kt)("br",null),"When operator mode is set to false, the scraping interval can only be set in the scraping job configuration, which kusion does not have permission to manage directly."),(0,o.kt)("td",{parentName:"tr",align:null},"str"),(0,o.kt)("td",{parentName:"tr",align:null},"30s"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"timeout"),(0,o.kt)("br",null),"The timeout when Prometheus scrapes metrics data. Only applicable when operator mode is set to true.",(0,o.kt)("br",null),"When operator mode is set to false, the scraping timeout can only be set in the scraping job configuration, which kusion does not have permission to manage directly."),(0,o.kt)("td",{parentName:"tr",align:null},"str"),(0,o.kt)("td",{parentName:"tr",align:null},"15s"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"scheme"),(0,o.kt)("br",null),"The scheme to scrape metrics from. Possible values are http and https."),(0,o.kt)("td",{parentName:"tr",align:null},'"http" ',"|",' "https"'),(0,o.kt)("td",{parentName:"tr",align:null},"http"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")))),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n kusionstack/monitoring@0.1.0:\n default:\n operatorMode: True\n monitorType: Pod\n scheme: http\n interval: 30s\n timeout: 15s\n low_frequency:\n operatorMode: False\n interval: 2m\n timeout: 1m\n projectSelector:\n - foo\n - bar\n high_frequency:\n monitorType: Service\n interval: 10s\n timeout: 5s\n projectSelector:\n - helloworld\n - wordpress\n - prometheus-sample-app\n")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d08bdbd3.669c653a.js b/assets/js/d08bdbd3.669c653a.js new file mode 100644 index 00000000000..54e99583055 --- /dev/null +++ b/assets/js/d08bdbd3.669c653a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5665],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),m=p(n),d=o,g=m["".concat(s,".").concat(d)]||m[d]||c[d]||a;return n?r.createElement(g,i(i({ref:t},u),{},{components:n})):r.createElement(g,i({ref:t},u))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>c,frontMatter:()=>a,metadata:()=>l,toc:()=>p});var r=n(87462),o=(n(67294),n(3905));const a={},i="monitoring",l={unversionedId:"reference/modules/workspace-configs/monitoring/prometheus",id:"reference/modules/workspace-configs/monitoring/prometheus",title:"monitoring",description:"monitoring can be used to define workspace-level monitoring configurations.",source:"@site/docs/kusion/6-reference/2-modules/2-workspace-configs/monitoring/prometheus.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/monitoring",slug:"/reference/modules/workspace-configs/monitoring/prometheus",permalink:"/docs/next/reference/modules/workspace-configs/monitoring/prometheus",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/2-workspace-configs/monitoring/prometheus.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"postgres",permalink:"/docs/next/reference/modules/workspace-configs/database/postgres"},next:{title:"network",permalink:"/docs/next/reference/modules/workspace-configs/networking/network"}},s={},p=[{value:"Attributes",id:"attributes",level:2},{value:"Examples",id:"examples",level:3}],u={toc:p};function c(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"monitoring"},"monitoring"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"monitoring")," can be used to define workspace-level monitoring configurations."),(0,o.kt)("h2",{id:"attributes"},"Attributes"),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,o.kt)("th",{parentName:"tr",align:null},"Type"),(0,o.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,o.kt)("th",{parentName:"tr",align:null},"Required"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"operatorMode"),(0,o.kt)("br",null),"Whether the Prometheus instance installed in the cluster runs as a Kubernetes operator or not. This determines the different kinds of resources Kusion manages."),(0,o.kt)("td",{parentName:"tr",align:null},"true ","|"," false"),(0,o.kt)("td",{parentName:"tr",align:null},"false"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"monitorType"),(0,o.kt)("br",null),"The kind of monitor to create. It only applies when operatorMode is set to True."),(0,o.kt)("td",{parentName:"tr",align:null},'"Service" ',"|",' "Pod"'),(0,o.kt)("td",{parentName:"tr",align:null},'"Service"'),(0,o.kt)("td",{parentName:"tr",align:null},"optional")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"interval"),(0,o.kt)("br",null),"The time interval which Prometheus scrapes metrics data. Only applicable when operator mode is set to true.",(0,o.kt)("br",null),"When operator mode is set to false, the scraping interval can only be set in the scraping job configuration, which kusion does not have permission to manage directly."),(0,o.kt)("td",{parentName:"tr",align:null},"str"),(0,o.kt)("td",{parentName:"tr",align:null},"30s"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"timeout"),(0,o.kt)("br",null),"The timeout when Prometheus scrapes metrics data. Only applicable when operator mode is set to true.",(0,o.kt)("br",null),"When operator mode is set to false, the scraping timeout can only be set in the scraping job configuration, which kusion does not have permission to manage directly."),(0,o.kt)("td",{parentName:"tr",align:null},"str"),(0,o.kt)("td",{parentName:"tr",align:null},"15s"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")),(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:null},(0,o.kt)("strong",{parentName:"td"},"scheme"),(0,o.kt)("br",null),"The scheme to scrape metrics from. Possible values are http and https."),(0,o.kt)("td",{parentName:"tr",align:null},'"http" ',"|",' "https"'),(0,o.kt)("td",{parentName:"tr",align:null},"http"),(0,o.kt)("td",{parentName:"tr",align:null},"optional")))),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n kusionstack/monitoring@0.1.0:\n default:\n operatorMode: True\n monitorType: Pod\n scheme: http\n interval: 30s\n timeout: 15s\n low_frequency:\n operatorMode: False\n interval: 2m\n timeout: 1m\n projectSelector:\n - foo\n - bar\n high_frequency:\n monitorType: Service\n interval: 10s\n timeout: 5s\n projectSelector:\n - helloworld\n - wordpress\n - prometheus-sample-app\n")))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d268f61a.63f2b8af.js b/assets/js/d268f61a.63f2b8af.js new file mode 100644 index 00000000000..9813aabdc7d --- /dev/null +++ b/assets/js/d268f61a.63f2b8af.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7672],{3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var o=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function i(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var l=o.createContext({}),p=function(e){var n=o.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},u=function(e){var n=p(e.components);return o.createElement(l.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},d=o.forwardRef((function(e,n){var t=e.components,a=e.mdxType,r=e.originalType,l=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=p(t),m=a,f=d["".concat(l,".").concat(m)]||d[m]||c[m]||r;return t?o.createElement(f,i(i({ref:n},u),{},{components:t})):o.createElement(f,i({ref:n},u))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var r=t.length,i=new Array(r);i[0]=d;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var p=2;p{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>i,default:()=>c,frontMatter:()=>r,metadata:()=>s,toc:()=>p});var o=t(87462),a=(t(67294),t(3905));const r={id:"how-kusion-works",sidebar_label:"How Kusion Works?"},i="How Kusion Works?",s={unversionedId:"concepts/how-kusion-works",id:"version-v0.10/concepts/how-kusion-works",title:"How Kusion Works?",description:"Kusion is the platform engineering engine of KusionStack. It delivers intentions described with Kusion Modules defined in Catalog to Kubernetes, Clouds and On-Prem infrastructures.",source:"@site/docs_versioned_docs/version-v0.10/3-concepts/8-how-kusion-works.md",sourceDirName:"3-concepts",slug:"/concepts/how-kusion-works",permalink:"/docs/v0.10/concepts/how-kusion-works",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/3-concepts/8-how-kusion-works.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:8,frontMatter:{id:"how-kusion-works",sidebar_label:"How Kusion Works?"},sidebar:"kusion",previous:{title:"Backend Configuration",permalink:"/docs/v0.10/concepts/backend-configuration"},next:{title:"Configuration File Overview",permalink:"/docs/v0.10/configuration-walkthrough/overview"}},l={},p=[{value:"Overview",id:"overview",level:2},{value:"Platform Developer\u2019s Workflow",id:"platform-developers-workflow",level:2},{value:"Design Kusion Modules",id:"design-kusion-modules",level:3},{value:"Instantiate and Set Up Workspaces",id:"instantiate-and-set-up-workspaces",level:3},{value:"Application Developer\u2019s Workflow",id:"application-developers-workflow",level:2},{value:"Instantiate AppConfiguration and Apply",id:"instantiate-appconfiguration-and-apply",level:3}],u={toc:p};function c(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,o.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"how-kusion-works"},"How Kusion Works?"),(0,a.kt)("p",null,"Kusion is the platform engineering engine of ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack"},"KusionStack"),". It delivers intentions described with Kusion Modules defined in ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"Catalog")," to Kubernetes, Clouds and On-Prem infrastructures."),(0,a.kt)("p",null,(0,a.kt)("img",{parentName:"p",src:"https://raw.githubusercontent.com/KusionStack/kusion/main/docs/workflow.png",alt:"arch"})),(0,a.kt)("h2",{id:"overview"},"Overview"),(0,a.kt)("p",null,"The workflow of KusionStack is illustrated in the diagram above, and it consists of three steps. The first step is ",(0,a.kt)("inlineCode",{parentName:"p"},"Write"),", where platform engineers provide Kusion Modules and application developers write AppConfigurations based on the Kusion Modules to describe their operational intent."),(0,a.kt)("p",null,"The second step is the ",(0,a.kt)("inlineCode",{parentName:"p"},"Build")," process, which results in the creation of the SSoT (Single Source of Truth), also known as the ",(0,a.kt)("a",{parentName:"p",href:"intent"},"Intent")," of the current operational task. If you need version management of the SSoT, we recommend you manage the Intent with a VCS (Version Control System) tool like git."),(0,a.kt)("p",null,"The third step is ",(0,a.kt)("inlineCode",{parentName:"p"},"Apply")," which makes the Intent effective. Kusion parses the operational intent based on the Intent produced in the previous step. Before applying the intent, Kusion will execute the Preview command (you can also execute this command manually) which will use a three-way diff algorithm to preview changes and prompt users to make sure all changes meet expectations; the Apply command will then actualize the operational intent onto various infrastructure platforms. Currently, it supports three runtimes: Terraform, Kubernetes, and on-prem infrastructures."),(0,a.kt)("p",null,"As a user of Kusion, if you prefer not to be conscious of so many steps, you can simply use ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion apply"),", and Kusion will automatically execute all the aforementioned steps for you."),(0,a.kt)("h2",{id:"platform-developers-workflow"},"Platform Developer\u2019s Workflow"),(0,a.kt)("h3",{id:"design-kusion-modules"},"Design Kusion Modules"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"kusion-module"},"Kusion Module")," is a reusable building block designed by platform engineers and contains two components: an application developer-oriented schema and a Kusion module generator. When platform engineers have developed a Kusion module, they can push it to a ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"catalog")," repository to make it into a KCL package."),(0,a.kt)("p",null,"Given a database Kusion module as an example, the schema definition is shown below and the generator logic can be found ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/pkg/modules/generators/accessories/database_generator.go"},"here"),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'schema MySQL: \n """ MySQL describes the attributes to locally deploy or create a cloud provider\n managed mysql database instance for the workload. \n\n Attributes\n ----------\n type: "local" | "cloud", defaults to Undefined, required. \n Type defines whether the mysql database is deployed locally or provided by \n cloud vendor. \n version: str, defaults to Undefined, required. \n Version defines the mysql version to use. \n\n Examples\n --------\n Instantiate a local mysql database with version of 5.7. \n\n import models.schema.v1.accessories.mysql\n\n mysql: mysql.MySQL {\n type: "local"\n version: "5.7"\n }\n """\n\n # The deployment mode of the mysql database. \n type: "local" | "cloud"\n\n # The mysql database version to use. \n version: str\n')),(0,a.kt)("h3",{id:"instantiate-and-set-up-workspaces"},"Instantiate and Set Up Workspaces"),(0,a.kt)("p",null,"Each ",(0,a.kt)("a",{parentName:"p",href:"workspace"},"workspace")," includes a corresponding Platform config file maintained by platform engineers.\nPlatform engineers should instantiate all workspaces and fulfill all fields with platform default values. Kusion will merge the workspace configuration with AppConfiguration in the Stack of the same name. An example is as follows."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n # your kubeconfig file path\n kubernetes:\n kubeConfig: /etc/kubeconfig.yaml\n # metadat of used terraform providers\n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n aws: \n version: 5.0.1\n source: hashicorp/aws\n region: us-east-1\n\nmodules: \n # platform configuration of AWS RDS MySQL\n mysql: \n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n privateRouting: false\n suffix: "-mysql"\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"mysql")," block represents a Kusion module. The fields inside are parts of the inputs for the Kusion module generator. For more details about the workspace, please refer to the ",(0,a.kt)("a",{parentName:"p",href:"workspace"},"workspace")," section."),(0,a.kt)("h2",{id:"application-developers-workflow"},"Application Developer\u2019s Workflow"),(0,a.kt)("h3",{id:"instantiate-appconfiguration-and-apply"},"Instantiate AppConfiguration and Apply"),(0,a.kt)("p",null,"Application developers choose Kusion modules they need and instantiate them in the AppConfiguration to describe their operation intentions. We have built some built-in Kusion modules in the repository ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"Catalog")," and we warmly welcome you to join us in building this ecosystem together."),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"main.k")," is the ",(0,a.kt)("strong",{parentName:"p"},"only")," configuration maintained by application developers and schemas in this file are defined from the application developer's perspective to reduce their cognitive load. An example is as follows."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-pthyon"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.network as n\nimport catalog.models.schema.v1.accessories.mysql\n\n# main.k declares customized configurations for dev stacks.\nwordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n wordpress: c.Container {\n image: "wordpress:6.3"\n env: {\n "WORDPRESS_DB_HOST": "$(KUSION_DB_HOST_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_NAME": "mysql"\n }\n ......\n }\n }\n ......\n }\n database: {\n wordpress: mysql.MySQL {\n type: "cloud"\n version: "8.0"\n }\n }\n}\n')),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"workload")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"database")," are both Kusion modules provided by platform engineers and Kusion will convert them into actual infrastructure API calls eventually."),(0,a.kt)("p",null,"Finally, application developers can deliver their operational intent to infrastructures with one command ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion apply"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d268f61a.c7364271.js b/assets/js/d268f61a.c7364271.js deleted file mode 100644 index 0ffae69fe7b..00000000000 --- a/assets/js/d268f61a.c7364271.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7672],{3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var o=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function i(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var l=o.createContext({}),p=function(e){var n=o.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},u=function(e){var n=p(e.components);return o.createElement(l.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},d=o.forwardRef((function(e,n){var t=e.components,a=e.mdxType,r=e.originalType,l=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=p(t),m=a,f=d["".concat(l,".").concat(m)]||d[m]||c[m]||r;return t?o.createElement(f,i(i({ref:n},u),{},{components:t})):o.createElement(f,i({ref:n},u))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var r=t.length,i=new Array(r);i[0]=d;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var p=2;p{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>i,default:()=>c,frontMatter:()=>r,metadata:()=>s,toc:()=>p});var o=t(87462),a=(t(67294),t(3905));const r={id:"how-kusion-works",sidebar_label:"How Kusion Works?"},i="How Kusion Works?",s={unversionedId:"concepts/how-kusion-works",id:"version-v0.10/concepts/how-kusion-works",title:"How Kusion Works?",description:"Kusion is the platform engineering engine of KusionStack. It delivers intentions described with Kusion Modules defined in Catalog to Kubernetes, Clouds and On-Prem infrastructures.",source:"@site/docs_versioned_docs/version-v0.10/3-concepts/8-how-kusion-works.md",sourceDirName:"3-concepts",slug:"/concepts/how-kusion-works",permalink:"/docs/v0.10/concepts/how-kusion-works",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/3-concepts/8-how-kusion-works.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:8,frontMatter:{id:"how-kusion-works",sidebar_label:"How Kusion Works?"},sidebar:"kusion",previous:{title:"Backend Configuration",permalink:"/docs/v0.10/concepts/backend-configuration"},next:{title:"Configuration File Overview",permalink:"/docs/v0.10/configuration-walkthrough/overview"}},l={},p=[{value:"Overview",id:"overview",level:2},{value:"Platform Developer\u2019s Workflow",id:"platform-developers-workflow",level:2},{value:"Design Kusion Modules",id:"design-kusion-modules",level:3},{value:"Instantiate and Set Up Workspaces",id:"instantiate-and-set-up-workspaces",level:3},{value:"Application Developer\u2019s Workflow",id:"application-developers-workflow",level:2},{value:"Instantiate AppConfiguration and Apply",id:"instantiate-appconfiguration-and-apply",level:3}],u={toc:p};function c(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,o.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"how-kusion-works"},"How Kusion Works?"),(0,a.kt)("p",null,"Kusion is the platform engineering engine of ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack"},"KusionStack"),". It delivers intentions described with Kusion Modules defined in ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"Catalog")," to Kubernetes, Clouds and On-Prem infrastructures."),(0,a.kt)("p",null,(0,a.kt)("img",{parentName:"p",src:"https://raw.githubusercontent.com/KusionStack/kusion/main/docs/workflow.png",alt:"arch"})),(0,a.kt)("h2",{id:"overview"},"Overview"),(0,a.kt)("p",null,"The workflow of KusionStack is illustrated in the diagram above, and it consists of three steps. The first step is ",(0,a.kt)("inlineCode",{parentName:"p"},"Write"),", where platform engineers provide Kusion Modules and application developers write AppConfigurations based on the Kusion Modules to describe their operational intent."),(0,a.kt)("p",null,"The second step is the ",(0,a.kt)("inlineCode",{parentName:"p"},"Build")," process, which results in the creation of the SSoT (Single Source of Truth), also known as the ",(0,a.kt)("a",{parentName:"p",href:"intent"},"Intent")," of the current operational task. If you need version management of the SSoT, we recommend you manage the Intent with a VCS (Version Control System) tool like git."),(0,a.kt)("p",null,"The third step is ",(0,a.kt)("inlineCode",{parentName:"p"},"Apply")," which makes the Intent effective. Kusion parses the operational intent based on the Intent produced in the previous step. Before applying the intent, Kusion will execute the Preview command (you can also execute this command manually) which will use a three-way diff algorithm to preview changes and prompt users to make sure all changes meet expectations; the Apply command will then actualize the operational intent onto various infrastructure platforms. Currently, it supports three runtimes: Terraform, Kubernetes, and on-prem infrastructures."),(0,a.kt)("p",null,"As a user of Kusion, if you prefer not to be conscious of so many steps, you can simply use ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion apply"),", and Kusion will automatically execute all the aforementioned steps for you."),(0,a.kt)("h2",{id:"platform-developers-workflow"},"Platform Developer\u2019s Workflow"),(0,a.kt)("h3",{id:"design-kusion-modules"},"Design Kusion Modules"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"kusion-module"},"Kusion Module")," is a reusable building block designed by platform engineers and contains two components: an application developer-oriented schema and a Kusion module generator. When platform engineers have developed a Kusion module, they can push it to a ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"catalog")," repository to make it into a KCL package."),(0,a.kt)("p",null,"Given a database Kusion module as an example, the schema definition is shown below and the generator logic can be found ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/pkg/modules/generators/accessories/database_generator.go"},"here"),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'schema MySQL: \n """ MySQL describes the attributes to locally deploy or create a cloud provider\n managed mysql database instance for the workload. \n\n Attributes\n ----------\n type: "local" | "cloud", defaults to Undefined, required. \n Type defines whether the mysql database is deployed locally or provided by \n cloud vendor. \n version: str, defaults to Undefined, required. \n Version defines the mysql version to use. \n\n Examples\n --------\n Instantiate a local mysql database with version of 5.7. \n\n import models.schema.v1.accessories.mysql\n\n mysql: mysql.MySQL {\n type: "local"\n version: "5.7"\n }\n """\n\n # The deployment mode of the mysql database. \n type: "local" | "cloud"\n\n # The mysql database version to use. \n version: str\n')),(0,a.kt)("h3",{id:"instantiate-and-set-up-workspaces"},"Instantiate and Set Up Workspaces"),(0,a.kt)("p",null,"Each ",(0,a.kt)("a",{parentName:"p",href:"workspace"},"workspace")," includes a corresponding Platform config file maintained by platform engineers.\nPlatform engineers should instantiate all workspaces and fulfill all fields with platform default values. Kusion will merge the workspace configuration with AppConfiguration in the Stack of the same name. An example is as follows."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n # your kubeconfig file path\n kubernetes:\n kubeConfig: /etc/kubeconfig.yaml\n # metadat of used terraform providers\n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n aws: \n version: 5.0.1\n source: hashicorp/aws\n region: us-east-1\n\nmodules: \n # platform configuration of AWS RDS MySQL\n mysql: \n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n privateRouting: false\n suffix: "-mysql"\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"mysql")," block represents a Kusion module. The fields inside are parts of the inputs for the Kusion module generator. For more details about the workspace, please refer to the ",(0,a.kt)("a",{parentName:"p",href:"workspace"},"workspace")," section."),(0,a.kt)("h2",{id:"application-developers-workflow"},"Application Developer\u2019s Workflow"),(0,a.kt)("h3",{id:"instantiate-appconfiguration-and-apply"},"Instantiate AppConfiguration and Apply"),(0,a.kt)("p",null,"Application developers choose Kusion modules they need and instantiate them in the AppConfiguration to describe their operation intentions. We have built some built-in Kusion modules in the repository ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"Catalog")," and we warmly welcome you to join us in building this ecosystem together."),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"main.k")," is the ",(0,a.kt)("strong",{parentName:"p"},"only")," configuration maintained by application developers and schemas in this file are defined from the application developer's perspective to reduce their cognitive load. An example is as follows."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-pthyon"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.network as n\nimport catalog.models.schema.v1.accessories.mysql\n\n# main.k declares customized configurations for dev stacks.\nwordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n wordpress: c.Container {\n image: "wordpress:6.3"\n env: {\n "WORDPRESS_DB_HOST": "$(KUSION_DB_HOST_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_NAME": "mysql"\n }\n ......\n }\n }\n ......\n }\n database: {\n wordpress: mysql.MySQL {\n type: "cloud"\n version: "8.0"\n }\n }\n}\n')),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"workload")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"database")," are both Kusion modules provided by platform engineers and Kusion will convert them into actual infrastructure API calls eventually."),(0,a.kt)("p",null,"Finally, application developers can deliver their operational intent to infrastructures with one command ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion apply"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d33f5cb2.3b3f47c1.js b/assets/js/d33f5cb2.3b3f47c1.js new file mode 100644 index 00000000000..8554f822178 --- /dev/null +++ b/assets/js/d33f5cb2.3b3f47c1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1137],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),m=l(n),d=o,f=m["".concat(c,".").concat(d)]||m[d]||u[d]||a;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=m;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={},i="Kusion Commands",s={unversionedId:"reference/commands/index",id:"reference/commands/index",title:"Kusion Commands",description:"Kusion is the Platform Orchestrator of KusionStack",source:"@site/docs/kusion/6-reference/1-commands/index.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/",permalink:"/docs/next/reference/commands/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/index.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Using Cloud Secrets Manager",permalink:"/docs/next/user-guides/secrets-management/using-cloud-secrets"},next:{title:"kusion apply",permalink:"/docs/next/reference/commands/kusion-apply"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-commands"},"Kusion Commands"),(0,o.kt)("p",null,"Kusion is the Platform Orchestrator of KusionStack"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"As a Platform Orchestrator, Kusion delivers user intentions to Kubernetes, Clouds and On-Premise resources. Also enables asynchronous cooperation between the development and the platform team and drives the separation of concerns."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion [flags]\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' -h, --help help for kusion\n --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-apply"},"kusion apply"),"\t - Apply the operational intent of various resources to multiple runtimes"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-config"},"kusion config"),"\t - Interact with the Kusion config"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-destroy"},"kusion destroy"),"\t - Destroy resources within the stack."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-generate"},"kusion generate"),"\t - Generate and print the resulting Spec resources of target Stack"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-init"},"kusion init"),"\t - Initialize the scaffolding for a demo project"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-mod"},"kusion mod"),"\t - Manage Kusion modules"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-options"},"kusion options"),"\t - Print the list of flags inherited by all commands"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-preview"},"kusion preview"),"\t - Preview a series of resource changes within the stack"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-project"},"kusion project"),"\t - Project is a folder that contains a project.yaml file and is linked to a Git repository"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-stack"},"kusion stack"),"\t - Stack is a folder that contains a stack.yaml file within the corresponding project directory"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-version"},"kusion version"),"\t - Print the Kusion version information for the current context"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d33f5cb2.624ddb03.js b/assets/js/d33f5cb2.624ddb03.js deleted file mode 100644 index ea32db75fb0..00000000000 --- a/assets/js/d33f5cb2.624ddb03.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1137],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),m=l(n),d=o,f=m["".concat(c,".").concat(d)]||m[d]||u[d]||a;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=m;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={},i="Kusion Commands",s={unversionedId:"reference/commands/index",id:"reference/commands/index",title:"Kusion Commands",description:"Kusion is the Platform Orchestrator of KusionStack",source:"@site/docs/kusion/6-reference/1-commands/index.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/",permalink:"/docs/next/reference/commands/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/index.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Using Cloud Secrets Manager",permalink:"/docs/next/user-guides/secrets-management/using-cloud-secrets"},next:{title:"kusion apply",permalink:"/docs/next/reference/commands/kusion-apply"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-commands"},"Kusion Commands"),(0,o.kt)("p",null,"Kusion is the Platform Orchestrator of KusionStack"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"As a Platform Orchestrator, Kusion delivers user intentions to Kubernetes, Clouds and On-Premise resources. Also enables asynchronous cooperation between the development and the platform team and drives the separation of concerns."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion [flags]\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' -h, --help help for kusion\n --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-apply"},"kusion apply"),"\t - Apply the operational intent of various resources to multiple runtimes"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-config"},"kusion config"),"\t - Interact with the Kusion config"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-destroy"},"kusion destroy"),"\t - Destroy resources within the stack."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-generate"},"kusion generate"),"\t - Generate and print the resulting Spec resources of target Stack"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-init"},"kusion init"),"\t - Initialize the scaffolding for a demo project"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-mod"},"kusion mod"),"\t - Manage Kusion modules"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-options"},"kusion options"),"\t - Print the list of flags inherited by all commands"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-preview"},"kusion preview"),"\t - Preview a series of resource changes within the stack"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-project"},"kusion project"),"\t - Project is a folder that contains a project.yaml file and is linked to a Git repository"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-stack"},"kusion stack"),"\t - Stack is a folder that contains a stack.yaml file within the corresponding project directory"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-version"},"kusion version"),"\t - Print the Kusion version information for the current context"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d3d0d205.6dafa386.js b/assets/js/d3d0d205.d80208a3.js similarity index 51% rename from assets/js/d3d0d205.6dafa386.js rename to assets/js/d3d0d205.d80208a3.js index 69fa0b16cca..fbd374c6fde 100644 --- a/assets/js/d3d0d205.6dafa386.js +++ b/assets/js/d3d0d205.d80208a3.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5246],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=r.createContext({}),l=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},p=function(e){var n=l(e.components);return r.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,s=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),f=l(t),m=o,d=f["".concat(s,".").concat(m)]||f[m]||u[m]||i;return t?r.createElement(d,a(a({ref:n},p),{},{components:t})):r.createElement(d,a({ref:n},p))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=f;var c={};for(var s in n)hasOwnProperty.call(n,s)&&(c[s]=n[s]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var l=2;l{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>c,toc:()=>l});var r=t(87462),o=(t(67294),t(3905));const i={},a="kusion config",c={unversionedId:"reference/commands/kusion-config",id:"reference/commands/kusion-config",title:"kusion config",description:"Interact with the Kusion config",source:"@site/docs/kusion/6-reference/1-commands/kusion-config.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-config",permalink:"/docs/next/reference/commands/kusion-config",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-config.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion config unset",permalink:"/docs/next/reference/commands/kusion-config-unset"},next:{title:"kusion destroy",permalink:"/docs/next/reference/commands/kusion-destroy"}},s={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:l};function u(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-config"},"kusion config"),(0,o.kt)("p",null,"Interact with the Kusion config"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Config contains the operation of Kusion configurations."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion config [flags]\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for config\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-config-get"},"kusion config get"),"\t - Get a config item"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-config-list"},"kusion config list"),"\t - List all config items"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-config-set"},"kusion config set"),"\t - Set a config item"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-config-unset"},"kusion config unset"),"\t - Unset a config item")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5246],{3905:(e,n,t)=>{t.d(n,{Zo:()=>p,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var s=r.createContext({}),l=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},p=function(e){var n=l(e.components);return r.createElement(s.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,s=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),f=l(t),m=o,d=f["".concat(s,".").concat(m)]||f[m]||u[m]||i;return t?r.createElement(d,a(a({ref:n},p),{},{components:t})):r.createElement(d,a({ref:n},p))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=f;var c={};for(var s in n)hasOwnProperty.call(n,s)&&(c[s]=n[s]);c.originalType=e,c.mdxType="string"==typeof e?e:o,a[1]=c;for(var l=2;l{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>c,toc:()=>l});var r=t(87462),o=(t(67294),t(3905));const i={},a="kusion config",c={unversionedId:"reference/commands/kusion-config",id:"reference/commands/kusion-config",title:"kusion config",description:"Interact with the Kusion config",source:"@site/docs/kusion/6-reference/1-commands/kusion-config.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-config",permalink:"/docs/next/reference/commands/kusion-config",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-config.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion config unset",permalink:"/docs/next/reference/commands/kusion-config-unset"},next:{title:"kusion destroy",permalink:"/docs/next/reference/commands/kusion-destroy"}},s={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:l};function u(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-config"},"kusion config"),(0,o.kt)("p",null,"Interact with the Kusion config"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Config contains the operation of Kusion configurations."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion config [flags]\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for config\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-config-get"},"kusion config get"),"\t - Get a config item"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-config-list"},"kusion config list"),"\t - List all config items"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-config-set"},"kusion config set"),"\t - Set a config item"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-config-unset"},"kusion config unset"),"\t - Unset a config item")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d4850a38.039adaf2.js b/assets/js/d4850a38.039adaf2.js new file mode 100644 index 00000000000..c17d523a8ad --- /dev/null +++ b/assets/js/d4850a38.039adaf2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[511],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var i=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function a(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=i.createContext({}),p=function(e){var t=i.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},c=function(e){var t=p(e.components);return i.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},d=i.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(n),m=r,f=d["".concat(l,".").concat(m)]||d[m]||u[m]||o;return n?i.createElement(f,a(a({ref:t},c),{},{components:n})):i.createElement(f,a({ref:t},c))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,a=new Array(o);a[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,a[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var i=n(87462),r=(n(67294),n(3905));const o={sidebar_position:3},a="How Kusion Works",s={unversionedId:"concepts/kusion",id:"version-v0.9/concepts/kusion",title:"How Kusion Works",description:"Kusion is the platform engineering engine of KusionStack. It delivers intentions described with Kusion Models defined in Catalog to Kubernetes, Clouds and On-Prem infrastructures.",source:"@site/docs_versioned_docs/version-v0.9/concepts/kusion.md",sourceDirName:"concepts",slug:"/concepts/kusion",permalink:"/docs/v0.9/concepts/kusion",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/concepts/kusion.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"kusion",previous:{title:"Glossary",permalink:"/docs/v0.9/concepts/glossary"},next:{title:"AppConfiguration",permalink:"/docs/v0.9/concepts/appconfiguration"}},l={},p=[{value:"Operation Engine",id:"operation-engine",level:2},{value:"Runtimes",id:"runtimes",level:2},{value:"State",id:"state",level:2},{value:"How Kusion works",id:"how-kusion-works-1",level:2}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,i.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"how-kusion-works"},"How Kusion Works"),(0,r.kt)("p",null,"Kusion is the platform engineering engine of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack"},"KusionStack"),". It delivers intentions described with Kusion Models defined in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"Catalog")," to Kubernetes, Clouds and On-Prem infrastructures."),(0,r.kt)("p",{align:"center"},(0,r.kt)("img",{src:"https://raw.githubusercontent.com/KusionStack/kusion/main/docs/arch.png",width:"50%",height:"50%"})),(0,r.kt)("p",null," It consists of 3 parts: ",(0,r.kt)("inlineCode",{parentName:"p"},"Operation Engine"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Runtimes")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"State"),", we will describe each of these components below."),(0,r.kt)("h2",{id:"operation-engine"},"Operation Engine"),(0,r.kt)("p",null,"Operation Engine is the entry point of the Kusion Engine and is responsible for Kusion basic operations like ",(0,r.kt)("inlineCode",{parentName:"p"},"preview"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"apply"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"destroy"),", etc. The main workflow of this part is to parse resources described in the operation intention (Spec), figure out which resource should be modified according to the specified operation, and execute this operation to the real infra resources. During this workflow, Runtimes and State will be involved."),(0,r.kt)("h2",{id:"runtimes"},"Runtimes"),(0,r.kt)("p",null,"Runtime is an interface between the actual infrastructure and Kusion. All operations attempting to manipulate an infra resource should be delegated to one Runtime to make this operation affect the actual infrastructure. On the other hand, any infrastructure that implements the Runtime interfaces can be managed by Kusion."),(0,r.kt)("h2",{id:"state"},"State"),(0,r.kt)("p",null,"State is a record of an operation's result. It is a mapping between resources managed by Kusion and the actual infra resources. State is often used as a data source for 3-way merge/diff in operations like ",(0,r.kt)("inlineCode",{parentName:"p"},"apply")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"preview"),"."),(0,r.kt)("p",null,"State can be stored in many storage mediums like filesystems, OSS, databases, HTTP servers, etc."),(0,r.kt)("h2",{id:"how-kusion-works-1"},"How Kusion works"),(0,r.kt)("p",null,"Let's get operation ",(0,r.kt)("inlineCode",{parentName:"p"},"Preview")," as an example to demonstrate how the three parts cooperate in an actual operation."),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"Operation Engine")," parses resources in operation intentions(Spec) and converts them into a DAG"),(0,r.kt)("li",{parentName:"ol"},"Walk this DAG:",(0,r.kt)("ol",{parentName:"li"},(0,r.kt)("li",{parentName:"ol"},"Get the latest ",(0,r.kt)("inlineCode",{parentName:"li"},"State")," from the actual infra by the ",(0,r.kt)("inlineCode",{parentName:"li"},"Runtime")),(0,r.kt)("li",{parentName:"ol"},"Get the last operation ",(0,r.kt)("inlineCode",{parentName:"li"},"State")," from the ",(0,r.kt)("inlineCode",{parentName:"li"},"State")," storage medium"))),(0,r.kt)("li",{parentName:"ol"},"Merge/Diff three states: desired state described in Spec, live state from ",(0,r.kt)("inlineCode",{parentName:"li"},"Runtime")," and prior state from ",(0,r.kt)("inlineCode",{parentName:"li"},"State")," storage medium, and return the diff result to the console.")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d4850a38.117e9e2e.js b/assets/js/d4850a38.117e9e2e.js deleted file mode 100644 index 23d93f02b24..00000000000 --- a/assets/js/d4850a38.117e9e2e.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[511],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var i=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function a(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=i.createContext({}),p=function(e){var t=i.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},c=function(e){var t=p(e.components);return i.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},d=i.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),d=p(n),m=r,f=d["".concat(l,".").concat(m)]||d[m]||u[m]||o;return n?i.createElement(f,a(a({ref:t},c),{},{components:n})):i.createElement(f,a({ref:t},c))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,a=new Array(o);a[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,a[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var i=n(87462),r=(n(67294),n(3905));const o={sidebar_position:3},a="How Kusion Works",s={unversionedId:"concepts/kusion",id:"version-v0.9/concepts/kusion",title:"How Kusion Works",description:"Kusion is the platform engineering engine of KusionStack. It delivers intentions described with Kusion Models defined in Catalog to Kubernetes, Clouds and On-Prem infrastructures.",source:"@site/docs_versioned_docs/version-v0.9/concepts/kusion.md",sourceDirName:"concepts",slug:"/concepts/kusion",permalink:"/docs/v0.9/concepts/kusion",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/concepts/kusion.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{sidebar_position:3},sidebar:"kusion",previous:{title:"Glossary",permalink:"/docs/v0.9/concepts/glossary"},next:{title:"AppConfiguration",permalink:"/docs/v0.9/concepts/appconfiguration"}},l={},p=[{value:"Operation Engine",id:"operation-engine",level:2},{value:"Runtimes",id:"runtimes",level:2},{value:"State",id:"state",level:2},{value:"How Kusion works",id:"how-kusion-works-1",level:2}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,i.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"how-kusion-works"},"How Kusion Works"),(0,r.kt)("p",null,"Kusion is the platform engineering engine of ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack"},"KusionStack"),". It delivers intentions described with Kusion Models defined in ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"Catalog")," to Kubernetes, Clouds and On-Prem infrastructures."),(0,r.kt)("p",{align:"center"},(0,r.kt)("img",{src:"https://raw.githubusercontent.com/KusionStack/kusion/main/docs/arch.png",width:"50%",height:"50%"})),(0,r.kt)("p",null," It consists of 3 parts: ",(0,r.kt)("inlineCode",{parentName:"p"},"Operation Engine"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Runtimes")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"State"),", we will describe each of these components below."),(0,r.kt)("h2",{id:"operation-engine"},"Operation Engine"),(0,r.kt)("p",null,"Operation Engine is the entry point of the Kusion Engine and is responsible for Kusion basic operations like ",(0,r.kt)("inlineCode",{parentName:"p"},"preview"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"apply"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"destroy"),", etc. The main workflow of this part is to parse resources described in the operation intention (Spec), figure out which resource should be modified according to the specified operation, and execute this operation to the real infra resources. During this workflow, Runtimes and State will be involved."),(0,r.kt)("h2",{id:"runtimes"},"Runtimes"),(0,r.kt)("p",null,"Runtime is an interface between the actual infrastructure and Kusion. All operations attempting to manipulate an infra resource should be delegated to one Runtime to make this operation affect the actual infrastructure. On the other hand, any infrastructure that implements the Runtime interfaces can be managed by Kusion."),(0,r.kt)("h2",{id:"state"},"State"),(0,r.kt)("p",null,"State is a record of an operation's result. It is a mapping between resources managed by Kusion and the actual infra resources. State is often used as a data source for 3-way merge/diff in operations like ",(0,r.kt)("inlineCode",{parentName:"p"},"apply")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"preview"),"."),(0,r.kt)("p",null,"State can be stored in many storage mediums like filesystems, OSS, databases, HTTP servers, etc."),(0,r.kt)("h2",{id:"how-kusion-works-1"},"How Kusion works"),(0,r.kt)("p",null,"Let's get operation ",(0,r.kt)("inlineCode",{parentName:"p"},"Preview")," as an example to demonstrate how the three parts cooperate in an actual operation."),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},(0,r.kt)("inlineCode",{parentName:"li"},"Operation Engine")," parses resources in operation intentions(Spec) and converts them into a DAG"),(0,r.kt)("li",{parentName:"ol"},"Walk this DAG:",(0,r.kt)("ol",{parentName:"li"},(0,r.kt)("li",{parentName:"ol"},"Get the latest ",(0,r.kt)("inlineCode",{parentName:"li"},"State")," from the actual infra by the ",(0,r.kt)("inlineCode",{parentName:"li"},"Runtime")),(0,r.kt)("li",{parentName:"ol"},"Get the last operation ",(0,r.kt)("inlineCode",{parentName:"li"},"State")," from the ",(0,r.kt)("inlineCode",{parentName:"li"},"State")," storage medium"))),(0,r.kt)("li",{parentName:"ol"},"Merge/Diff three states: desired state described in Spec, live state from ",(0,r.kt)("inlineCode",{parentName:"li"},"Runtime")," and prior state from ",(0,r.kt)("inlineCode",{parentName:"li"},"State")," storage medium, and return the diff result to the console.")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d5099334.aabe751f.js b/assets/js/d5099334.aabe751f.js new file mode 100644 index 00000000000..9a7d49731e4 --- /dev/null +++ b/assets/js/d5099334.aabe751f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[171],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=s(n),m=r,f=d["".concat(p,".").concat(m)]||d[m]||c[m]||o;return n?a.createElement(f,i(i({ref:t},u),{},{components:n})):a.createElement(f,i({ref:t},u))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>c,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var a=n(87462),r=(n(67294),n(3905));const o={id:"operational-rules"},i="Operational Rules",l={unversionedId:"configuration-walkthrough/operational-rules",id:"version-v0.11/configuration-walkthrough/operational-rules",title:"Operational Rules",description:"You could also specify the collection of operational rule requirements for the application. That can be achieved via a opsrule module (or bring-your-own-module) in the accessories field in AppConfiguration to achieve that. Operational rules are used as a preemptive measure to police and stop any unwanted changes.",source:"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/9-operational-rules.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/operational-rules",permalink:"/docs/configuration-walkthrough/operational-rules",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/9-operational-rules.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:9,frontMatter:{id:"operational-rules"},sidebar:"kusion",previous:{title:"Application Monitoring",permalink:"/docs/configuration-walkthrough/monitoring"},next:{title:"Deliver the WordPress Application with Cloud RDS",permalink:"/docs/user-guides/cloud-resources/database"}},p={},s=[{value:"Import",id:"import",level:2},{value:"Max Unavailable Replicas",id:"max-unavailable-replicas",level:2}],u={toc:s};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"operational-rules"},"Operational Rules"),(0,r.kt)("p",null,"You could also specify the collection of operational rule requirements for the application. That can be achieved via a ",(0,r.kt)("inlineCode",{parentName:"p"},"opsrule")," module (or bring-your-own-module) in the ",(0,r.kt)("inlineCode",{parentName:"p"},"accessories")," field in ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," to achieve that. Operational rules are used as a preemptive measure to police and stop any unwanted changes."),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"kam")," package and the ",(0,r.kt)("inlineCode",{parentName:"p"},"opsrule")," Kusion Module. For more details on KCL package and module import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport opsrule as o\n")),(0,r.kt)("h2",{id:"max-unavailable-replicas"},"Max Unavailable Replicas"),(0,r.kt)("p",null,"Currently, the ",(0,r.kt)("inlineCode",{parentName:"p"},"opsrule")," module supports setting a ",(0,r.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," parameter, which specifies the maximum number of pods that can be rendered unavailable at any time. It can be either a fraction of the total pods for the current application or a fixed number. This operational rule is particularly helpful against unexpected changes or deletes to the workloads. It can also prevent too many workloads from going down during an application upgrade."),(0,r.kt)("p",null,"More rules will be available in future versions of Kusion."),(0,r.kt)("p",null,"To set ",(0,r.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," to a percentage of pods:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n # ...\n }\n }\n accessories: {\n "opsRule": o.OpsRule {\n maxUnavailable: "30%"\n }\n }\n}\n')),(0,r.kt)("p",null,"To set ",(0,r.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," to a fixed number of pods:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n accessories: {\n "opsRule": o.OpsRule {\n maxUnavailable: 2\n }\n }\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d5099334.ac38b340.js b/assets/js/d5099334.ac38b340.js deleted file mode 100644 index 5ebecd395ac..00000000000 --- a/assets/js/d5099334.ac38b340.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[171],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=s(n),m=r,f=d["".concat(p,".").concat(m)]||d[m]||c[m]||o;return n?a.createElement(f,i(i({ref:t},u),{},{components:n})):a.createElement(f,i({ref:t},u))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>c,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var a=n(87462),r=(n(67294),n(3905));const o={id:"operational-rules"},i="Operational Rules",l={unversionedId:"configuration-walkthrough/operational-rules",id:"version-v0.11/configuration-walkthrough/operational-rules",title:"Operational Rules",description:"You could also specify the collection of operational rule requirements for the application. That can be achieved via a opsrule module (or bring-your-own-module) in the accessories field in AppConfiguration to achieve that. Operational rules are used as a preemptive measure to police and stop any unwanted changes.",source:"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/9-operational-rules.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/operational-rules",permalink:"/docs/configuration-walkthrough/operational-rules",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/9-operational-rules.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:9,frontMatter:{id:"operational-rules"},sidebar:"kusion",previous:{title:"Application Monitoring",permalink:"/docs/configuration-walkthrough/monitoring"},next:{title:"Deliver the WordPress Application with Cloud RDS",permalink:"/docs/user-guides/cloud-resources/database"}},p={},s=[{value:"Import",id:"import",level:2},{value:"Max Unavailable Replicas",id:"max-unavailable-replicas",level:2}],u={toc:s};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"operational-rules"},"Operational Rules"),(0,r.kt)("p",null,"You could also specify the collection of operational rule requirements for the application. That can be achieved via a ",(0,r.kt)("inlineCode",{parentName:"p"},"opsrule")," module (or bring-your-own-module) in the ",(0,r.kt)("inlineCode",{parentName:"p"},"accessories")," field in ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," to achieve that. Operational rules are used as a preemptive measure to police and stop any unwanted changes."),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"kam")," package and the ",(0,r.kt)("inlineCode",{parentName:"p"},"opsrule")," Kusion Module. For more details on KCL package and module import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport opsrule as o\n")),(0,r.kt)("h2",{id:"max-unavailable-replicas"},"Max Unavailable Replicas"),(0,r.kt)("p",null,"Currently, the ",(0,r.kt)("inlineCode",{parentName:"p"},"opsrule")," module supports setting a ",(0,r.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," parameter, which specifies the maximum number of pods that can be rendered unavailable at any time. It can be either a fraction of the total pods for the current application or a fixed number. This operational rule is particularly helpful against unexpected changes or deletes to the workloads. It can also prevent too many workloads from going down during an application upgrade."),(0,r.kt)("p",null,"More rules will be available in future versions of Kusion."),(0,r.kt)("p",null,"To set ",(0,r.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," to a percentage of pods:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n # ...\n }\n }\n accessories: {\n "opsRule": o.OpsRule {\n maxUnavailable: "30%"\n }\n }\n}\n')),(0,r.kt)("p",null,"To set ",(0,r.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," to a fixed number of pods:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n accessories: {\n "opsRule": o.OpsRule {\n maxUnavailable: 2\n }\n }\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d5b05897.41fb008f.js b/assets/js/d5b05897.41fb008f.js deleted file mode 100644 index d7f5f487c50..00000000000 --- a/assets/js/d5b05897.41fb008f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2789],{3905:(e,n,t)=>{t.d(n,{Zo:()=>l,kt:()=>f});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),p=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},l=function(e){var n=p(e.components);return r.createElement(c.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=p(t),f=o,m=u["".concat(c,".").concat(f)]||u[f]||d[f]||a;return t?r.createElement(m,i(i({ref:n},l),{},{components:t})):r.createElement(m,i({ref:n},l))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=u;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var p=2;p{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var r=t(87462),o=(t(67294),t(3905));const a={id:"base-override"},i="Base and Override",s={unversionedId:"configuration-walkthrough/base-override",id:"configuration-walkthrough/base-override",title:"Base and Override",description:"In practice, what we have observed for production-grade applications is that they usually need to be deployed to a wide range of different targets, be it different environments in the SDLC, or different clouds, regions or runtimes for cost/regulation/performance or disaster recovery related reasons.",source:"@site/docs/kusion/4-configuration-walkthrough/3-base-override.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/base-override",permalink:"/docs/next/configuration-walkthrough/base-override",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/4-configuration-walkthrough/3-base-override.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{id:"base-override"},sidebar:"kusion",previous:{title:"KCL Basics",permalink:"/docs/next/configuration-walkthrough/kcl-basics"},next:{title:"Workload",permalink:"/docs/next/configuration-walkthrough/workload"}},c={},p=[],l={toc:p};function d(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},l,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"base-and-override"},"Base and Override"),(0,o.kt)("p",null,"In practice, what we have observed for production-grade applications is that they usually need to be deployed to a wide range of different targets, be it different environments in the SDLC, or different clouds, regions or runtimes for cost/regulation/performance or disaster recovery related reasons."),(0,o.kt)("p",null,"In that context, we advocate for a pattern where you can leverage some Kusion and KCL features to minimize the amount of duplicate configurations, by separating the common base application configuration and environment-specific ones."),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"The file names in the below examples don't matter as long as they are called out and appear in the correct order in the ",(0,o.kt)("inlineCode",{parentName:"p"},"entries")," field (the field is a list) in ",(0,o.kt)("inlineCode",{parentName:"p"},"kcl.mod"),". The files with common configurations should appear first in the list and stack-specific ones last. The latter one takes precedence."),(0,o.kt)("p",{parentName:"admonition"},"The configurations also don't have be placed into a single ",(0,o.kt)("inlineCode",{parentName:"p"},".k")," file. For complex projects, they can be broken down into smaller organized ",(0,o.kt)("inlineCode",{parentName:"p"},".k")," files for better readability. ")),(0,o.kt)("p",null,"Base configuration defined in ",(0,o.kt)("inlineCode",{parentName:"p"},"base/base.k"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network.network as n\n\nmyapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: ""\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n public: True\n }\n ]\n }\n }\n}\n')),(0,o.kt)("p",null,"Environment-specific configuration defined in ",(0,o.kt)("inlineCode",{parentName:"p"},"dev/main.k"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\n\n# main.k declares customized configurations for dev stack.\nmyapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n # dev stack has different app configuration from the base\n image = "gcr.io/google-samples/gb-frontend:v5"\n resources = {\n "cpu": "250m"\n "memory": "256Mi"\n }\n }\n }\n replicas = 2\n }\n}\n')),(0,o.kt)("p",null,"Alternatively, you could locate a specific property (in this case below, the ",(0,o.kt)("inlineCode",{parentName:"p"},"Container")," object) in the ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," object using the dot selector shorthand(such as ",(0,o.kt)("inlineCode",{parentName:"p"},"workload.containers.myapp")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"workload.replicas")," below):"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\n\n# main.k declares customized configurations for dev stack.\nmyapp: ac.AppConfiguration {\n workload.replicas = 2\n workload.containers.myapp: {\n # dev stack has different app configuration\n image = "gcr.io/google-samples/gb-frontend:v5"\n resources = {\n "cpu": "250m"\n "memory": "256Mi"\n }\n }\n}\n')),(0,o.kt)("p",null,"This is especially useful when the application configuration is complex but the override is relatively straightforward."),(0,o.kt)("p",null,"The two examples above are equivalent when overriding the base."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d5b05897.b930149e.js b/assets/js/d5b05897.b930149e.js new file mode 100644 index 00000000000..2a64ca3588f --- /dev/null +++ b/assets/js/d5b05897.b930149e.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2789],{3905:(e,n,t)=>{t.d(n,{Zo:()=>l,kt:()=>f});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function i(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),p=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},l=function(e){var n=p(e.components);return r.createElement(c.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),u=p(t),f=o,m=u["".concat(c,".").concat(f)]||u[f]||d[f]||a;return t?r.createElement(m,i(i({ref:n},l),{},{components:t})):r.createElement(m,i({ref:n},l))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=u;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var p=2;p{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var r=t(87462),o=(t(67294),t(3905));const a={id:"base-override"},i="Base and Override",s={unversionedId:"configuration-walkthrough/base-override",id:"configuration-walkthrough/base-override",title:"Base and Override",description:"In practice, what we have observed for production-grade applications is that they usually need to be deployed to a wide range of different targets, be it different environments in the SDLC, or different clouds, regions or runtimes for cost/regulation/performance or disaster recovery related reasons.",source:"@site/docs/kusion/4-configuration-walkthrough/3-base-override.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/base-override",permalink:"/docs/next/configuration-walkthrough/base-override",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/4-configuration-walkthrough/3-base-override.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{id:"base-override"},sidebar:"kusion",previous:{title:"KCL Basics",permalink:"/docs/next/configuration-walkthrough/kcl-basics"},next:{title:"Workload",permalink:"/docs/next/configuration-walkthrough/workload"}},c={},p=[],l={toc:p};function d(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},l,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"base-and-override"},"Base and Override"),(0,o.kt)("p",null,"In practice, what we have observed for production-grade applications is that they usually need to be deployed to a wide range of different targets, be it different environments in the SDLC, or different clouds, regions or runtimes for cost/regulation/performance or disaster recovery related reasons."),(0,o.kt)("p",null,"In that context, we advocate for a pattern where you can leverage some Kusion and KCL features to minimize the amount of duplicate configurations, by separating the common base application configuration and environment-specific ones."),(0,o.kt)("admonition",{type:"info"},(0,o.kt)("p",{parentName:"admonition"},"The file names in the below examples don't matter as long as they are called out and appear in the correct order in the ",(0,o.kt)("inlineCode",{parentName:"p"},"entries")," field (the field is a list) in ",(0,o.kt)("inlineCode",{parentName:"p"},"kcl.mod"),". The files with common configurations should appear first in the list and stack-specific ones last. The latter one takes precedence."),(0,o.kt)("p",{parentName:"admonition"},"The configurations also don't have be placed into a single ",(0,o.kt)("inlineCode",{parentName:"p"},".k")," file. For complex projects, they can be broken down into smaller organized ",(0,o.kt)("inlineCode",{parentName:"p"},".k")," files for better readability. ")),(0,o.kt)("p",null,"Base configuration defined in ",(0,o.kt)("inlineCode",{parentName:"p"},"base/base.k"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network.network as n\n\nmyapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n image: ""\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n }\n }\n replicas: 1\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 80\n public: True\n }\n ]\n }\n }\n}\n')),(0,o.kt)("p",null,"Environment-specific configuration defined in ",(0,o.kt)("inlineCode",{parentName:"p"},"dev/main.k"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\n\n# main.k declares customized configurations for dev stack.\nmyapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "myapp": c.Container {\n # dev stack has different app configuration from the base\n image = "gcr.io/google-samples/gb-frontend:v5"\n resources = {\n "cpu": "250m"\n "memory": "256Mi"\n }\n }\n }\n replicas = 2\n }\n}\n')),(0,o.kt)("p",null,"Alternatively, you could locate a specific property (in this case below, the ",(0,o.kt)("inlineCode",{parentName:"p"},"Container")," object) in the ",(0,o.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," object using the dot selector shorthand(such as ",(0,o.kt)("inlineCode",{parentName:"p"},"workload.containers.myapp")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"workload.replicas")," below):"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\n\n# main.k declares customized configurations for dev stack.\nmyapp: ac.AppConfiguration {\n workload.replicas = 2\n workload.containers.myapp: {\n # dev stack has different app configuration\n image = "gcr.io/google-samples/gb-frontend:v5"\n resources = {\n "cpu": "250m"\n "memory": "256Mi"\n }\n }\n}\n')),(0,o.kt)("p",null,"This is especially useful when the application configuration is complex but the override is relatively straightforward."),(0,o.kt)("p",null,"The two examples above are equivalent when overriding the base."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d622cb4f.06b809a3.js b/assets/js/d622cb4f.06b809a3.js new file mode 100644 index 00000000000..998d973d93f --- /dev/null +++ b/assets/js/d622cb4f.06b809a3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[556],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},d=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),c=p(r),m=a,g=c["".concat(i,".").concat(m)]||c[m]||u[m]||l;return r?n.createElement(g,o(o({ref:t},d),{},{components:r})):n.createElement(g,o({ref:t},d))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=c;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var p=2;p{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>u,frontMatter:()=>l,metadata:()=>s,toc:()=>p});var n=r(87462),a=(r(67294),r(3905));const l={},o="postgres",s={unversionedId:"reference/modules/workspace-configs/database/postgres",id:"version-v0.11/reference/modules/workspace-configs/database/postgres",title:"postgres",description:"Module PostgreSQL",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/database/postgres.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/database",slug:"/reference/modules/workspace-configs/database/postgres",permalink:"/docs/reference/modules/workspace-configs/database/postgres",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/database/postgres.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"mysql",permalink:"/docs/reference/modules/workspace-configs/database/mysql"},next:{title:"monitoring",permalink:"/docs/reference/modules/workspace-configs/monitoring/prometheus"}},i={},p=[{value:"Module PostgreSQL",id:"module-postgresql",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],d={toc:p};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"postgres"},"postgres"),(0,a.kt)("h2",{id:"module-postgresql"},"Module PostgreSQL"),(0,a.kt)("p",null,"PostgreSQL describes the attributes to locally deploy or create a cloud provider managed postgres database instance for the workload. "),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"cloud"),(0,a.kt)("br",null),"Cloud specifies the type of the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},'"aws" ',"|",' "alicloud"'),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"username"),(0,a.kt)("br",null),"Username specifies the operation account for the postgres database."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},'"root"'),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"category"),(0,a.kt)("br",null),"Category specifies the edition of the postgres instance provided by the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},'"Basic"'),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"securityIPs"),(0,a.kt)("br",null),"SecurityIPs specifies the list of IP addresses allowed to access the postgres instance provided by the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},"[str]"),(0,a.kt)("td",{parentName:"tr",align:null},'["0.0.0.0/0"]'),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"privateRouting"),(0,a.kt)("br",null),"PrivateRouting specifies whether the host address of the cloud postgres instance for the workload to connect with is via public network or private network of the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},"bool"),(0,a.kt)("td",{parentName:"tr",align:null},"true"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"size"),(0,a.kt)("br",null),"Size specifies the allocated storage size of the postgres instance."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"10"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"subnetID"),(0,a.kt)("br",null),"SubnetID specifies the virtual subnet ID associated with the VPC that the cloud postgres instance will be created in."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"databaseName"),(0,a.kt)("br",null),"databaseName specifies the database name."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'# PostgreSQL workspace configs for AWS RDS\nmodules: \n kusionstack@postgres@0.1.0: \n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n securityIPs: \n - 0.0.0.0/0\n databaseName: "my-postgres"\n')),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'# PostgreSQL workspace configs for Alicloud RDS\nmodules: \n kusionstack@postgres@0.1.0:\n default:\n cloud: alicloud\n size: 20\n instanceType: pg.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n securityIPs: \n - 0.0.0.0/0\n databaseName: "my-postgres"\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d622cb4f.fcbc5b14.js b/assets/js/d622cb4f.fcbc5b14.js deleted file mode 100644 index c67a34b497b..00000000000 --- a/assets/js/d622cb4f.fcbc5b14.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[556],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},d=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),c=p(r),m=a,g=c["".concat(i,".").concat(m)]||c[m]||u[m]||l;return r?n.createElement(g,o(o({ref:t},d),{},{components:r})):n.createElement(g,o({ref:t},d))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=c;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var p=2;p{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>u,frontMatter:()=>l,metadata:()=>s,toc:()=>p});var n=r(87462),a=(r(67294),r(3905));const l={},o="postgres",s={unversionedId:"reference/modules/workspace-configs/database/postgres",id:"version-v0.11/reference/modules/workspace-configs/database/postgres",title:"postgres",description:"Module PostgreSQL",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/database/postgres.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/database",slug:"/reference/modules/workspace-configs/database/postgres",permalink:"/docs/reference/modules/workspace-configs/database/postgres",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/database/postgres.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"mysql",permalink:"/docs/reference/modules/workspace-configs/database/mysql"},next:{title:"monitoring",permalink:"/docs/reference/modules/workspace-configs/monitoring/prometheus"}},i={},p=[{value:"Module PostgreSQL",id:"module-postgresql",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],d={toc:p};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"postgres"},"postgres"),(0,a.kt)("h2",{id:"module-postgresql"},"Module PostgreSQL"),(0,a.kt)("p",null,"PostgreSQL describes the attributes to locally deploy or create a cloud provider managed postgres database instance for the workload. "),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"cloud"),(0,a.kt)("br",null),"Cloud specifies the type of the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},'"aws" ',"|",' "alicloud"'),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"username"),(0,a.kt)("br",null),"Username specifies the operation account for the postgres database."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},'"root"'),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"category"),(0,a.kt)("br",null),"Category specifies the edition of the postgres instance provided by the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},'"Basic"'),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"securityIPs"),(0,a.kt)("br",null),"SecurityIPs specifies the list of IP addresses allowed to access the postgres instance provided by the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},"[str]"),(0,a.kt)("td",{parentName:"tr",align:null},'["0.0.0.0/0"]'),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"privateRouting"),(0,a.kt)("br",null),"PrivateRouting specifies whether the host address of the cloud postgres instance for the workload to connect with is via public network or private network of the cloud vendor."),(0,a.kt)("td",{parentName:"tr",align:null},"bool"),(0,a.kt)("td",{parentName:"tr",align:null},"true"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"size"),(0,a.kt)("br",null),"Size specifies the allocated storage size of the postgres instance."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"10"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"subnetID"),(0,a.kt)("br",null),"SubnetID specifies the virtual subnet ID associated with the VPC that the cloud postgres instance will be created in."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"databaseName"),(0,a.kt)("br",null),"databaseName specifies the database name."),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'# PostgreSQL workspace configs for AWS RDS\nmodules: \n kusionstack@postgres@0.1.0: \n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n securityIPs: \n - 0.0.0.0/0\n databaseName: "my-postgres"\n')),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'# PostgreSQL workspace configs for Alicloud RDS\nmodules: \n kusionstack@postgres@0.1.0:\n default:\n cloud: alicloud\n size: 20\n instanceType: pg.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n securityIPs: \n - 0.0.0.0/0\n databaseName: "my-postgres"\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d64f1887.84b17165.js b/assets/js/d64f1887.8de6e388.js similarity index 83% rename from assets/js/d64f1887.84b17165.js rename to assets/js/d64f1887.8de6e388.js index b555d461b0d..a542eb46108 100644 --- a/assets/js/d64f1887.84b17165.js +++ b/assets/js/d64f1887.8de6e388.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7541],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),u=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},l=function(e){var t=u(e.components);return n.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),d=u(r),f=o,m=d["".concat(c,".").concat(f)]||d[f]||p[f]||i;return r?n.createElement(m,a(a({ref:t},l),{},{components:r})):n.createElement(m,a({ref:t},l))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var u=2;u{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>p,frontMatter:()=>i,metadata:()=>s,toc:()=>u});var n=r(87462),o=(r(67294),r(3905));const i={},a="User Guide",s={unversionedId:"guides/guides",id:"version-v0.9/guides/guides",title:"User Guide",description:"",source:"@site/docs_versioned_docs/version-v0.9/guides/guides.md",sourceDirName:"guides",slug:"/guides/",permalink:"/docs/v0.9/guides/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/guides/guides.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Operational Rules",permalink:"/docs/v0.9/config-walkthrough/operational_rules"},next:{title:"Deliver the WordPress Application with Cloud RDS",permalink:"/docs/v0.9/guides/cloud-resources/database"}},c={},u=[],l={toc:u};function p(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"user-guide"},"User Guide"))}p.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7541],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),u=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},l=function(e){var t=u(e.components);return n.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),d=u(r),f=o,m=d["".concat(c,".").concat(f)]||d[f]||p[f]||i;return r?n.createElement(m,a(a({ref:t},l),{},{components:r})):n.createElement(m,a({ref:t},l))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var u=2;u{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>p,frontMatter:()=>i,metadata:()=>s,toc:()=>u});var n=r(87462),o=(r(67294),r(3905));const i={},a="User Guide",s={unversionedId:"guides/guides",id:"version-v0.9/guides/guides",title:"User Guide",description:"",source:"@site/docs_versioned_docs/version-v0.9/guides/guides.md",sourceDirName:"guides",slug:"/guides/",permalink:"/docs/v0.9/guides/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/guides/guides.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Operational Rules",permalink:"/docs/v0.9/config-walkthrough/operational_rules"},next:{title:"Deliver the WordPress Application with Cloud RDS",permalink:"/docs/v0.9/guides/cloud-resources/database"}},c={},u=[],l={toc:u};function p(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"user-guide"},"User Guide"))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d76a14be.6a141c62.js b/assets/js/d76a14be.6a141c62.js deleted file mode 100644 index fddf44d7d6a..00000000000 --- a/assets/js/d76a14be.6a141c62.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8555],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=o.createContext({}),l=function(e){var t=o.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},p=function(e){var t=l(e.components);return o.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=l(n),f=r,h=d["".concat(c,".").concat(f)]||d[f]||u[f]||i;return n?o.createElement(h,a(a({ref:t},p),{},{components:n})):o.createElement(h,a({ref:t},p))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,a=new Array(i);a[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,a[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var o=n(87462),r=(n(67294),n(3905));const i={id:"spec",sidebar_label:"Spec"},a="Spec",s={unversionedId:"concepts/spec",id:"concepts/spec",title:"Spec",description:"The Spec represents the operational intentions that you aim to deliver using Kusion. These intentions are expected to contain all components throughout the DevOps lifecycle, including resources (workload, database, load balancer, etc.), dependencies, and policies. The Kusion module generators are responsible for converting all AppConfigurations and environment configurations into the Spec. Once the Spec is generated, the Kusion Engine takes charge of updating the actual infrastructures to match the Spec.",source:"@site/docs/kusion/3-concepts/6-spec.md",sourceDirName:"3-concepts",slug:"/concepts/spec",permalink:"/docs/next/concepts/spec",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/3-concepts/6-spec.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:6,frontMatter:{id:"spec",sidebar_label:"Spec"},sidebar:"kusion",previous:{title:"AppConfiguration",permalink:"/docs/next/concepts/app-configuration"},next:{title:"Backend",permalink:"/docs/next/concepts/backend"}},c={},l=[{value:"Purpose",id:"purpose",level:2},{value:"Single Source of Truth",id:"single-source-of-truth",level:3},{value:"Consistency",id:"consistency",level:3},{value:"Rollback and Disaster Recovery",id:"rollback-and-disaster-recovery",level:3}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,o.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"spec"},"Spec"),(0,r.kt)("p",null,"The Spec represents the operational intentions that you aim to deliver using Kusion. These intentions are expected to contain all components throughout the DevOps lifecycle, including resources (workload, database, load balancer, etc.), dependencies, and policies. The Kusion module generators are responsible for converting all AppConfigurations and environment configurations into the Spec. Once the Spec is generated, the Kusion Engine takes charge of updating the actual infrastructures to match the Spec."),(0,r.kt)("h2",{id:"purpose"},"Purpose"),(0,r.kt)("h3",{id:"single-source-of-truth"},"Single Source of Truth"),(0,r.kt)("p",null,"In Kusion's workflow, the platform engineer builds Kusion modules and provides environment configurations, application developers choose Kusion modules they need and deploy operational intentions to an environment with related environment configurations. They can also input dynamic parameters like the container image when executing the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion generate")," command. So the final operational intentions include configurations written by application developers, environment configurations and dynamic inputs. Due to this reason, we introduce ",(0,r.kt)("strong",{parentName:"p"},"Spec")," to represent the SSoT(Single Source of Truth) of Kusion. It is the result of ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion generate")," which contains all operational intentions from different sources."),(0,r.kt)("h3",{id:"consistency"},"Consistency"),(0,r.kt)("p",null,"Delivering an application to different environments with identical configurations is a common practice, especially for applications that require scalable distribution. In such cases, an immutable configuration package is helpful. By utilizing the Spec, all configurations and changes are stored in a single file. As the Spec is the input of Kusion, it ensures consistency across different environments whenever you execute Kusion with the same Spec file."),(0,r.kt)("h3",{id:"rollback-and-disaster-recovery"},"Rollback and Disaster Recovery"),(0,r.kt)("p",null,"The ability to roll back is crucial in reducing incident duration. Rolling back the system to a previously validated version is much faster compared to attempting to fix it during an outage. We regard a validated Spec as a snapshot of the system and recommend storing the Spec in a version control system like Git. This enables better change management practices and makes it simpler to roll back to previous versions if needed. In case of a failure or outage, having a validated Spec simplifies the rollback process, ensuring that the system can be quickly recovered."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d76a14be.8e1306fd.js b/assets/js/d76a14be.8e1306fd.js new file mode 100644 index 00000000000..ce2b11aade7 --- /dev/null +++ b/assets/js/d76a14be.8e1306fd.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8555],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var c=o.createContext({}),l=function(e){var t=o.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},p=function(e){var t=l(e.components);return o.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=l(n),f=r,h=d["".concat(c,".").concat(f)]||d[f]||u[f]||i;return n?o.createElement(h,a(a({ref:t},p),{},{components:n})):o.createElement(h,a({ref:t},p))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,a=new Array(i);a[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:r,a[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var o=n(87462),r=(n(67294),n(3905));const i={id:"spec",sidebar_label:"Spec"},a="Spec",s={unversionedId:"concepts/spec",id:"concepts/spec",title:"Spec",description:"The Spec represents the operational intentions that you aim to deliver using Kusion. These intentions are expected to contain all components throughout the DevOps lifecycle, including resources (workload, database, load balancer, etc.), dependencies, and policies. The Kusion module generators are responsible for converting all AppConfigurations and environment configurations into the Spec. Once the Spec is generated, the Kusion Engine takes charge of updating the actual infrastructures to match the Spec.",source:"@site/docs/kusion/3-concepts/6-spec.md",sourceDirName:"3-concepts",slug:"/concepts/spec",permalink:"/docs/next/concepts/spec",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/3-concepts/6-spec.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:6,frontMatter:{id:"spec",sidebar_label:"Spec"},sidebar:"kusion",previous:{title:"AppConfiguration",permalink:"/docs/next/concepts/app-configuration"},next:{title:"Backend",permalink:"/docs/next/concepts/backend"}},c={},l=[{value:"Purpose",id:"purpose",level:2},{value:"Single Source of Truth",id:"single-source-of-truth",level:3},{value:"Consistency",id:"consistency",level:3},{value:"Rollback and Disaster Recovery",id:"rollback-and-disaster-recovery",level:3}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,o.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"spec"},"Spec"),(0,r.kt)("p",null,"The Spec represents the operational intentions that you aim to deliver using Kusion. These intentions are expected to contain all components throughout the DevOps lifecycle, including resources (workload, database, load balancer, etc.), dependencies, and policies. The Kusion module generators are responsible for converting all AppConfigurations and environment configurations into the Spec. Once the Spec is generated, the Kusion Engine takes charge of updating the actual infrastructures to match the Spec."),(0,r.kt)("h2",{id:"purpose"},"Purpose"),(0,r.kt)("h3",{id:"single-source-of-truth"},"Single Source of Truth"),(0,r.kt)("p",null,"In Kusion's workflow, the platform engineer builds Kusion modules and provides environment configurations, application developers choose Kusion modules they need and deploy operational intentions to an environment with related environment configurations. They can also input dynamic parameters like the container image when executing the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion generate")," command. So the final operational intentions include configurations written by application developers, environment configurations and dynamic inputs. Due to this reason, we introduce ",(0,r.kt)("strong",{parentName:"p"},"Spec")," to represent the SSoT(Single Source of Truth) of Kusion. It is the result of ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion generate")," which contains all operational intentions from different sources."),(0,r.kt)("h3",{id:"consistency"},"Consistency"),(0,r.kt)("p",null,"Delivering an application to different environments with identical configurations is a common practice, especially for applications that require scalable distribution. In such cases, an immutable configuration package is helpful. By utilizing the Spec, all configurations and changes are stored in a single file. As the Spec is the input of Kusion, it ensures consistency across different environments whenever you execute Kusion with the same Spec file."),(0,r.kt)("h3",{id:"rollback-and-disaster-recovery"},"Rollback and Disaster Recovery"),(0,r.kt)("p",null,"The ability to roll back is crucial in reducing incident duration. Rolling back the system to a previously validated version is much faster compared to attempting to fix it during an outage. We regard a validated Spec as a snapshot of the system and recommend storing the Spec in a version control system like Git. This enables better change management practices and makes it simpler to roll back to previous versions if needed. In case of a failure or outage, having a validated Spec simplifies the rollback process, ensuring that the system can be quickly recovered."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d82a2a7b.82200028.js b/assets/js/d82a2a7b.bb6e1f92.js similarity index 82% rename from assets/js/d82a2a7b.82200028.js rename to assets/js/d82a2a7b.bb6e1f92.js index de5d355853e..029ae6eb17f 100644 --- a/assets/js/d82a2a7b.82200028.js +++ b/assets/js/d82a2a7b.bb6e1f92.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6949],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>d});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),f=p(r),d=o,m=f["".concat(s,".").concat(d)]||f[d]||u[d]||a;return r?n.createElement(m,c(c({ref:t},l),{},{components:r})):n.createElement(m,c({ref:t},l))}));function d(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,c=new Array(a);c[0]=f;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,c[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},c="KCL",i={unversionedId:"support/kcl",id:"version-v0.9/support/kcl",title:"KCL",description:"Visit the KCL website for more documents.",source:"@site/docs_versioned_docs/version-v0.9/support/kcl.md",sourceDirName:"support",slug:"/support/kcl",permalink:"/docs/v0.9/support/kcl",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/support/kcl.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Installation",permalink:"/docs/v0.9/support/install-error"}},s={},p=[],l={toc:p};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kcl"},"KCL"),(0,o.kt)("p",null,"Visit the ",(0,o.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/user_docs/support/faq-kcl"},"KCL website")," for more documents."))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6949],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>d});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function c(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):c(c({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),f=p(r),d=o,m=f["".concat(s,".").concat(d)]||f[d]||u[d]||a;return r?n.createElement(m,c(c({ref:t},l),{},{components:r})):n.createElement(m,c({ref:t},l))}));function d(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,c=new Array(a);c[0]=f;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:o,c[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>c,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},c="KCL",i={unversionedId:"support/kcl",id:"version-v0.9/support/kcl",title:"KCL",description:"Visit the KCL website for more documents.",source:"@site/docs_versioned_docs/version-v0.9/support/kcl.md",sourceDirName:"support",slug:"/support/kcl",permalink:"/docs/v0.9/support/kcl",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/support/kcl.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Installation",permalink:"/docs/v0.9/support/install-error"}},s={},p=[],l={toc:p};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kcl"},"KCL"),(0,o.kt)("p",null,"Visit the ",(0,o.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/user_docs/support/faq-kcl"},"KCL website")," for more documents."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d889ad2d.1171bb5a.js b/assets/js/d889ad2d.1171bb5a.js deleted file mode 100644 index a925f72621f..00000000000 --- a/assets/js/d889ad2d.1171bb5a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[438],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>u});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function o(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),d=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},p=function(e){var t=d(e.components);return n.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),m=d(a),u=r,y=m["".concat(s,".").concat(u)]||m[u]||c[u]||l;return a?n.createElement(y,o(o({ref:t},p),{},{components:a})):n.createElement(y,o({ref:t},p))}));function u(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,o=new Array(l);o[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,o[1]=i;for(var d=2;d{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>c,frontMatter:()=>l,metadata:()=>i,toc:()=>d});var n=a(87462),r=(a(67294),a(3905));const l={},o="mysql",i={unversionedId:"reference/modules/developer-schemas/database/mysql",id:"version-v0.11/reference/modules/developer-schemas/database/mysql",title:"mysql",description:"Schema MySQL",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/database/mysql.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/database",slug:"/reference/modules/developer-schemas/database/mysql",permalink:"/docs/reference/modules/developer-schemas/database/mysql",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/database/mysql.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"appconfiguration",permalink:"/docs/reference/modules/developer-schemas/app-configuration"},next:{title:"postgres",permalink:"/docs/reference/modules/developer-schemas/database/postgres"}},s={},d=[{value:"Schema MySQL",id:"schema-mysql",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Credentials and Connectivity",id:"credentials-and-connectivity",level:3}],p={toc:d};function c(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"mysql"},"mysql"),(0,r.kt)("h2",{id:"schema-mysql"},"Schema MySQL"),(0,r.kt)("p",null,"MySQL describes the attributes to locally deploy or create a cloud provider",(0,r.kt)("br",null),"managed mysql database instance for the workload. "),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},'"local"'),(0,r.kt)("td",{parentName:"tr",align:null},'"cloud"'),(0,r.kt)("td",{parentName:"tr",align:null},"Type defines whether the mysql database is deployed locally or provided by",(0,r.kt)("br",null),"cloud vendor.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"version")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Version defines the mysql version to use."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'# Instantiate a local mysql database with version of 5.7. \n\nimport mysql\n\naccessories: {\n "mysql": mysql.MySQL {\n type: "local"\n version: "8.0"\n }\n}\n')),(0,r.kt)("h3",{id:"credentials-and-connectivity"},"Credentials and Connectivity"),(0,r.kt)("p",null,"For sensitive information such as the ",(0,r.kt)("strong",{parentName:"p"},"host"),", ",(0,r.kt)("strong",{parentName:"p"},"username")," and ",(0,r.kt)("strong",{parentName:"p"},"password")," for the database instance, Kusion will automatically inject them into the application container for users through environment variables. The relevant environment variables are listed in the table below. "),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Explanation"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","HOST","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Host address for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","USERNAME","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Account username for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","PASSWORD","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Account password for accessing the database instance")))),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"databaseName")," can be declared in ",(0,r.kt)("a",{parentName:"p",href:"/docs/reference/modules/workspace-configs/database/mysql"},"workspace configs of mysql"),", and Kusion will automatically concatenate the ",(0,r.kt)("inlineCode",{parentName:"p"},""),", ",(0,r.kt)("inlineCode",{parentName:"p"},""),", ",(0,r.kt)("inlineCode",{parentName:"p"},"")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"-")," if not specified. When injecting the credentials into containers' environment variables, Kusion will convert the ",(0,r.kt)("inlineCode",{parentName:"p"},"databaseName")," to uppercase, and replace ",(0,r.kt)("inlineCode",{parentName:"p"},"-")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"_"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d889ad2d.1f7d09b5.js b/assets/js/d889ad2d.1f7d09b5.js new file mode 100644 index 00000000000..e08a5bf5fc7 --- /dev/null +++ b/assets/js/d889ad2d.1f7d09b5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[438],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>u});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function o(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var s=n.createContext({}),d=function(e){var t=n.useContext(s),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},p=function(e){var t=d(e.components);return n.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),m=d(a),u=r,y=m["".concat(s,".").concat(u)]||m[u]||c[u]||l;return a?n.createElement(y,o(o({ref:t},p),{},{components:a})):n.createElement(y,o({ref:t},p))}));function u(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,o=new Array(l);o[0]=m;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:r,o[1]=i;for(var d=2;d{a.r(t),a.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>c,frontMatter:()=>l,metadata:()=>i,toc:()=>d});var n=a(87462),r=(a(67294),a(3905));const l={},o="mysql",i={unversionedId:"reference/modules/developer-schemas/database/mysql",id:"version-v0.11/reference/modules/developer-schemas/database/mysql",title:"mysql",description:"Schema MySQL",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/database/mysql.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/database",slug:"/reference/modules/developer-schemas/database/mysql",permalink:"/docs/reference/modules/developer-schemas/database/mysql",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/database/mysql.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"appconfiguration",permalink:"/docs/reference/modules/developer-schemas/app-configuration"},next:{title:"postgres",permalink:"/docs/reference/modules/developer-schemas/database/postgres"}},s={},d=[{value:"Schema MySQL",id:"schema-mysql",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Credentials and Connectivity",id:"credentials-and-connectivity",level:3}],p={toc:d};function c(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"mysql"},"mysql"),(0,r.kt)("h2",{id:"schema-mysql"},"Schema MySQL"),(0,r.kt)("p",null,"MySQL describes the attributes to locally deploy or create a cloud provider",(0,r.kt)("br",null),"managed mysql database instance for the workload. "),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},'"local"'),(0,r.kt)("td",{parentName:"tr",align:null},'"cloud"'),(0,r.kt)("td",{parentName:"tr",align:null},"Type defines whether the mysql database is deployed locally or provided by",(0,r.kt)("br",null),"cloud vendor.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"version")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Version defines the mysql version to use."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'# Instantiate a local mysql database with version of 5.7. \n\nimport mysql\n\naccessories: {\n "mysql": mysql.MySQL {\n type: "local"\n version: "8.0"\n }\n}\n')),(0,r.kt)("h3",{id:"credentials-and-connectivity"},"Credentials and Connectivity"),(0,r.kt)("p",null,"For sensitive information such as the ",(0,r.kt)("strong",{parentName:"p"},"host"),", ",(0,r.kt)("strong",{parentName:"p"},"username")," and ",(0,r.kt)("strong",{parentName:"p"},"password")," for the database instance, Kusion will automatically inject them into the application container for users through environment variables. The relevant environment variables are listed in the table below. "),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name"),(0,r.kt)("th",{parentName:"tr",align:null},"Explanation"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","HOST","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Host address for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","USERNAME","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Account username for accessing the database instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"KUSION_DB","_","PASSWORD","_",(0,r.kt)("inlineCode",{parentName:"td"},"")),(0,r.kt)("td",{parentName:"tr",align:null},"Account password for accessing the database instance")))),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"databaseName")," can be declared in ",(0,r.kt)("a",{parentName:"p",href:"/docs/reference/modules/workspace-configs/database/mysql"},"workspace configs of mysql"),", and Kusion will automatically concatenate the ",(0,r.kt)("inlineCode",{parentName:"p"},""),", ",(0,r.kt)("inlineCode",{parentName:"p"},""),", ",(0,r.kt)("inlineCode",{parentName:"p"},"")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"mysql")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"-")," if not specified. When injecting the credentials into containers' environment variables, Kusion will convert the ",(0,r.kt)("inlineCode",{parentName:"p"},"databaseName")," to uppercase, and replace ",(0,r.kt)("inlineCode",{parentName:"p"},"-")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"_"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d8f7b805.ca96f4f9.js b/assets/js/d8f7b805.37f5ed3d.js similarity index 57% rename from assets/js/d8f7b805.ca96f4f9.js rename to assets/js/d8f7b805.37f5ed3d.js index 8908e518209..0d066082087 100644 --- a/assets/js/d8f7b805.ca96f4f9.js +++ b/assets/js/d8f7b805.37f5ed3d.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4847],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),u=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=u(e.components);return a.createElement(i.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=u(n),m=r,k=d["".concat(i,".").concat(m)]||d[m]||p[m]||s;return n?a.createElement(k,o(o({ref:t},c),{},{components:n})):a.createElement(k,o({ref:t},c))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=d;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var u=2;u{n.d(t,{Z:()=>o});var a=n(67294),r=n(86010);const s="tabItem_Ymn6";function o(e){let{children:t,hidden:n,className:o}=e;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(s,o),hidden:n},t)}},74866:(e,t,n)=>{n.d(t,{Z:()=>N});var a=n(87462),r=n(67294),s=n(86010),o=n(12466),l=n(76775),i=n(91980),u=n(67392),c=n(50012);function p(e){return function(e){var t;return(null==(t=r.Children.map(e,(e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})))?void 0:t.filter(Boolean))??[]}(e).map((e=>{let{props:{value:t,label:n,attributes:a,default:r}}=e;return{value:t,label:n,attributes:a,default:r}}))}function d(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??p(n);return function(e){const t=(0,u.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function k(e){let{queryString:t=!1,groupId:n}=e;const a=(0,l.k6)(),s=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i._X)(s),(0,r.useCallback)((e=>{if(!s)return;const t=new URLSearchParams(a.location.search);t.set(s,e),a.replace({...a.location,search:t.toString()})}),[s,a])]}function h(e){const{defaultValue:t,queryString:n=!1,groupId:a}=e,s=d(e),[o,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const a=n.find((e=>e.default))??n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:t,tabValues:s}))),[i,u]=k({queryString:n,groupId:a}),[p,h]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[a,s]=(0,c.Nk)(n);return[a,(0,r.useCallback)((e=>{n&&s.set(e)}),[n,s])]}({groupId:a}),f=(()=>{const e=i??p;return m({value:e,tabValues:s})?e:null})();(0,r.useLayoutEffect)((()=>{f&&l(f)}),[f]);return{selectedValue:o,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:s}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),h(e)}),[u,h,s]),tabValues:s}}var f=n(72389);const b="tabList__CuJ",g="tabItem_LNqP";function v(e){let{className:t,block:n,selectedValue:l,selectValue:i,tabValues:u}=e;const c=[],{blockElementScrollPositionUntilNextRender:p}=(0,o.o5)(),d=e=>{const t=e.currentTarget,n=c.indexOf(t),a=u[n].value;a!==l&&(p(t),i(a))},m=e=>{var t;let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=c.indexOf(e.currentTarget)+1;n=c[t]??c[0];break}case"ArrowLeft":{const t=c.indexOf(e.currentTarget)-1;n=c[t]??c[c.length-1];break}}null==(t=n)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.Z)("tabs",{"tabs--block":n},t)},u.map((e=>{let{value:t,label:n,attributes:o}=e;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:l===t?0:-1,"aria-selected":l===t,key:t,ref:e=>c.push(e),onKeyDown:m,onClick:d},o,{className:(0,s.Z)("tabs__item",g,null==o?void 0:o.className,{"tabs__item--active":l===t})}),n??t)})))}function w(e){let{lazy:t,children:n,selectedValue:a}=e;const s=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=s.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},s.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a}))))}function y(e){const t=h(e);return r.createElement("div",{className:(0,s.Z)("tabs-container",b)},r.createElement(v,(0,a.Z)({},e,t)),r.createElement(w,(0,a.Z)({},e,t)))}function N(e){const t=(0,f.Z)();return r.createElement(y,(0,a.Z)({key:String(t)},e))}},90008:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>u,toc:()=>p});var a=n(87462),r=(n(67294),n(3905)),s=n(74866),o=n(85162);const l={},i="Install Kusion",u={unversionedId:"getting-started/install-kusion",id:"version-v0.11/getting-started/install-kusion",title:"Install Kusion",description:"You can install the latest Kusion CLI on MacOS, Linux and Windows.",source:"@site/docs_versioned_docs/version-v0.11/2-getting-started/1-install-kusion.md",sourceDirName:"2-getting-started",slug:"/getting-started/install-kusion",permalink:"/docs/getting-started/install-kusion",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/2-getting-started/1-install-kusion.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{},sidebar:"kusion",previous:{title:"Kusion vs Other Software",permalink:"/docs/what-is-kusion/kusion-vs-x"},next:{title:"Run Your First App on Kubernetes with Kusion",permalink:"/docs/getting-started/deliver-quickstart"}},c={},p=[{value:"MacOs/Linux",id:"macoslinux",level:2},{value:"Windows",id:"windows",level:2}],d={toc:p};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"install-kusion"},"Install Kusion"),(0,r.kt)("p",null,"You can install the latest Kusion CLI on MacOS, Linux and Windows."),(0,r.kt)("h2",{id:"macoslinux"},"MacOs/Linux"),(0,r.kt)("p",null,"For the MacOs and Linux, Homebrew and sh script are supported. Choose the one you prefer from the methods below."),(0,r.kt)(s.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"Homebrew",mdxType:"TabItem"},(0,r.kt)("p",null,"The recommended method for installing on MacOS and Linux is to use the brew package manager."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Install Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# tap formula repository Kusionstack/tap\nbrew tap KusionStack/tap\n\n# install Kusion \nbrew install KusionStack/tap/kusion\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Update Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# update formulae from remote\nbrew update\n\n# update Kusion\nbrew upgrade KusionStack/tap/kusion\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Uninstall Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# uninstall Kusion\nbrew uninstall KusionStack/tap/kusion\n"))),(0,r.kt)(o.Z,{value:"curl | sh",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Install Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# install Kusion, default latest version\ncurl https://www.kusionstack.io/scripts/install.sh | sh\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Install the Specified Version of Kusion")),(0,r.kt)("p",null,"You can also install the specified version of Kusion by appointing the version as shell script parameter, where the version is the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/tags"},"available tag"),' trimming prefix "v", such as 0.11.0, 0.10.0, etc. In general, you don\'t need to specify Kusion version, just use the command above to install the latest version.'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# install Kusion of specified version 0.11.0\ncurl https://www.kusionstack.io/scripts/install.sh | sh -s 0.11.0\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Uninstall Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# uninstall Kusion\ncurl https://www.kusionstack.io/scripts/uninstall.sh | sh\n")))),(0,r.kt)("h2",{id:"windows"},"Windows"),(0,r.kt)("p",null,"For the Windows, Scoop and Powershell script are supported. Choose the one you prefer from the methods below."),(0,r.kt)(s.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"Scoop",mdxType:"TabItem"},(0,r.kt)("p",null,"The recommended method for installing on Windows is to use the scoop package manager."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Install Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# add scoop bucket KusionStack\nscoop bucket add KusionStack https://github.com/KusionStack/scoop-bucket.git\n\n# install kusion\nscoop install KusionStack/kusion\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Update Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# update manifest from remote\nscoop update\n\n# update Kusion\nscoop install KusionStack/kusion\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Uninstall Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# uninstall Kusion\nbrew uninstall KusionStack/kusion\n"))),(0,r.kt)(o.Z,{value:"Powershell",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Install Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'# install Kusion, default latest version\npowershell -Command "iwr -useb https://www.kusionstack.io/scripts/install.ps1 | iex"\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Install the Specified Version of Kusion")),(0,r.kt)("p",null,"You can also install the specified version of Kusion by appointing the version as shell script parameter, where the version is the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/tags"},"available tag"),' trimming prefix "v", such as 0.11.0, etc. In general, you don\'t need to specify Kusion version, just use the command above to install the latest version.'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'# install Kusion of specified version 0.10.0\npowershell {"& { $(irm https://www.kusionstack.io/scripts/install.ps1) } -Version 0.11.0" | iex}\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Uninstall Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'# uninstall Kusion\npowershell -Command "iwr -useb https://www.kusionstack.io/scripts/uninstall.ps1 | iex"\n')))))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4847],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),u=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=u(e.components);return a.createElement(i.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,i=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=u(n),m=r,k=d["".concat(i,".").concat(m)]||d[m]||p[m]||s;return n?a.createElement(k,o(o({ref:t},c),{},{components:n})):a.createElement(k,o({ref:t},c))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,o=new Array(s);o[0]=d;var l={};for(var i in t)hasOwnProperty.call(t,i)&&(l[i]=t[i]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var u=2;u{n.d(t,{Z:()=>o});var a=n(67294),r=n(86010);const s="tabItem_Ymn6";function o(e){let{children:t,hidden:n,className:o}=e;return a.createElement("div",{role:"tabpanel",className:(0,r.Z)(s,o),hidden:n},t)}},74866:(e,t,n)=>{n.d(t,{Z:()=>N});var a=n(87462),r=n(67294),s=n(86010),o=n(12466),l=n(76775),i=n(91980),u=n(67392),c=n(50012);function p(e){return function(e){var t;return(null==(t=r.Children.map(e,(e=>{if(!e||(0,r.isValidElement)(e)&&function(e){const{props:t}=e;return!!t&&"object"==typeof t&&"value"in t}(e))return e;throw new Error(`Docusaurus error: Bad child <${"string"==typeof e.type?e.type:e.type.name}>: all children of the component should be , and every should have a unique "value" prop.`)})))?void 0:t.filter(Boolean))??[]}(e).map((e=>{let{props:{value:t,label:n,attributes:a,default:r}}=e;return{value:t,label:n,attributes:a,default:r}}))}function d(e){const{values:t,children:n}=e;return(0,r.useMemo)((()=>{const e=t??p(n);return function(e){const t=(0,u.l)(e,((e,t)=>e.value===t.value));if(t.length>0)throw new Error(`Docusaurus error: Duplicate values "${t.map((e=>e.value)).join(", ")}" found in . Every value needs to be unique.`)}(e),e}),[t,n])}function m(e){let{value:t,tabValues:n}=e;return n.some((e=>e.value===t))}function k(e){let{queryString:t=!1,groupId:n}=e;const a=(0,l.k6)(),s=function(e){let{queryString:t=!1,groupId:n}=e;if("string"==typeof t)return t;if(!1===t)return null;if(!0===t&&!n)throw new Error('Docusaurus error: The component groupId prop is required if queryString=true, because this value is used as the search param name. You can also provide an explicit value such as queryString="my-search-param".');return n??null}({queryString:t,groupId:n});return[(0,i._X)(s),(0,r.useCallback)((e=>{if(!s)return;const t=new URLSearchParams(a.location.search);t.set(s,e),a.replace({...a.location,search:t.toString()})}),[s,a])]}function h(e){const{defaultValue:t,queryString:n=!1,groupId:a}=e,s=d(e),[o,l]=(0,r.useState)((()=>function(e){let{defaultValue:t,tabValues:n}=e;if(0===n.length)throw new Error("Docusaurus error: the component requires at least one children component");if(t){if(!m({value:t,tabValues:n}))throw new Error(`Docusaurus error: The has a defaultValue "${t}" but none of its children has the corresponding value. Available values are: ${n.map((e=>e.value)).join(", ")}. If you intend to show no default tab, use defaultValue={null} instead.`);return t}const a=n.find((e=>e.default))??n[0];if(!a)throw new Error("Unexpected error: 0 tabValues");return a.value}({defaultValue:t,tabValues:s}))),[i,u]=k({queryString:n,groupId:a}),[p,h]=function(e){let{groupId:t}=e;const n=function(e){return e?`docusaurus.tab.${e}`:null}(t),[a,s]=(0,c.Nk)(n);return[a,(0,r.useCallback)((e=>{n&&s.set(e)}),[n,s])]}({groupId:a}),f=(()=>{const e=i??p;return m({value:e,tabValues:s})?e:null})();(0,r.useLayoutEffect)((()=>{f&&l(f)}),[f]);return{selectedValue:o,selectValue:(0,r.useCallback)((e=>{if(!m({value:e,tabValues:s}))throw new Error(`Can't select invalid tab value=${e}`);l(e),u(e),h(e)}),[u,h,s]),tabValues:s}}var f=n(72389);const b="tabList__CuJ",g="tabItem_LNqP";function v(e){let{className:t,block:n,selectedValue:l,selectValue:i,tabValues:u}=e;const c=[],{blockElementScrollPositionUntilNextRender:p}=(0,o.o5)(),d=e=>{const t=e.currentTarget,n=c.indexOf(t),a=u[n].value;a!==l&&(p(t),i(a))},m=e=>{var t;let n=null;switch(e.key){case"Enter":d(e);break;case"ArrowRight":{const t=c.indexOf(e.currentTarget)+1;n=c[t]??c[0];break}case"ArrowLeft":{const t=c.indexOf(e.currentTarget)-1;n=c[t]??c[c.length-1];break}}null==(t=n)||t.focus()};return r.createElement("ul",{role:"tablist","aria-orientation":"horizontal",className:(0,s.Z)("tabs",{"tabs--block":n},t)},u.map((e=>{let{value:t,label:n,attributes:o}=e;return r.createElement("li",(0,a.Z)({role:"tab",tabIndex:l===t?0:-1,"aria-selected":l===t,key:t,ref:e=>c.push(e),onKeyDown:m,onClick:d},o,{className:(0,s.Z)("tabs__item",g,null==o?void 0:o.className,{"tabs__item--active":l===t})}),n??t)})))}function w(e){let{lazy:t,children:n,selectedValue:a}=e;const s=(Array.isArray(n)?n:[n]).filter(Boolean);if(t){const e=s.find((e=>e.props.value===a));return e?(0,r.cloneElement)(e,{className:"margin-top--md"}):null}return r.createElement("div",{className:"margin-top--md"},s.map(((e,t)=>(0,r.cloneElement)(e,{key:t,hidden:e.props.value!==a}))))}function y(e){const t=h(e);return r.createElement("div",{className:(0,s.Z)("tabs-container",b)},r.createElement(v,(0,a.Z)({},e,t)),r.createElement(w,(0,a.Z)({},e,t)))}function N(e){const t=(0,f.Z)();return r.createElement(y,(0,a.Z)({key:String(t)},e))}},90008:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>u,toc:()=>p});var a=n(87462),r=(n(67294),n(3905)),s=n(74866),o=n(85162);const l={},i="Install Kusion",u={unversionedId:"getting-started/install-kusion",id:"version-v0.11/getting-started/install-kusion",title:"Install Kusion",description:"You can install the latest Kusion CLI on MacOS, Linux and Windows.",source:"@site/docs_versioned_docs/version-v0.11/2-getting-started/1-install-kusion.md",sourceDirName:"2-getting-started",slug:"/getting-started/install-kusion",permalink:"/docs/getting-started/install-kusion",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/2-getting-started/1-install-kusion.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{},sidebar:"kusion",previous:{title:"Kusion vs Other Software",permalink:"/docs/what-is-kusion/kusion-vs-x"},next:{title:"Run Your First App on Kubernetes with Kusion",permalink:"/docs/getting-started/deliver-quickstart"}},c={},p=[{value:"MacOs/Linux",id:"macoslinux",level:2},{value:"Windows",id:"windows",level:2}],d={toc:p};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"install-kusion"},"Install Kusion"),(0,r.kt)("p",null,"You can install the latest Kusion CLI on MacOS, Linux and Windows."),(0,r.kt)("h2",{id:"macoslinux"},"MacOs/Linux"),(0,r.kt)("p",null,"For the MacOs and Linux, Homebrew and sh script are supported. Choose the one you prefer from the methods below."),(0,r.kt)(s.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"Homebrew",mdxType:"TabItem"},(0,r.kt)("p",null,"The recommended method for installing on MacOS and Linux is to use the brew package manager."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Install Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# tap formula repository Kusionstack/tap\nbrew tap KusionStack/tap\n\n# install Kusion \nbrew install KusionStack/tap/kusion\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Update Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# update formulae from remote\nbrew update\n\n# update Kusion\nbrew upgrade KusionStack/tap/kusion\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Uninstall Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# uninstall Kusion\nbrew uninstall KusionStack/tap/kusion\n"))),(0,r.kt)(o.Z,{value:"curl | sh",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Install Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# install Kusion, default latest version\ncurl https://www.kusionstack.io/scripts/install.sh | sh\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Install the Specified Version of Kusion")),(0,r.kt)("p",null,"You can also install the specified version of Kusion by appointing the version as shell script parameter, where the version is the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/tags"},"available tag"),' trimming prefix "v", such as 0.11.0, 0.10.0, etc. In general, you don\'t need to specify Kusion version, just use the command above to install the latest version.'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# install Kusion of specified version 0.11.0\ncurl https://www.kusionstack.io/scripts/install.sh | sh -s 0.11.0\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Uninstall Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# uninstall Kusion\ncurl https://www.kusionstack.io/scripts/uninstall.sh | sh\n")))),(0,r.kt)("h2",{id:"windows"},"Windows"),(0,r.kt)("p",null,"For the Windows, Scoop and Powershell script are supported. Choose the one you prefer from the methods below."),(0,r.kt)(s.Z,{mdxType:"Tabs"},(0,r.kt)(o.Z,{value:"Scoop",mdxType:"TabItem"},(0,r.kt)("p",null,"The recommended method for installing on Windows is to use the scoop package manager."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Install Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# add scoop bucket KusionStack\nscoop bucket add KusionStack https://github.com/KusionStack/scoop-bucket.git\n\n# install kusion\nscoop install KusionStack/kusion\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Update Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# update manifest from remote\nscoop update\n\n# update Kusion\nscoop install KusionStack/kusion\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Uninstall Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"# uninstall Kusion\nbrew uninstall KusionStack/kusion\n"))),(0,r.kt)(o.Z,{value:"Powershell",mdxType:"TabItem"},(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Install Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'# install Kusion, default latest version\npowershell -Command "iwr -useb https://www.kusionstack.io/scripts/install.ps1 | iex"\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Install the Specified Version of Kusion")),(0,r.kt)("p",null,"You can also install the specified version of Kusion by appointing the version as shell script parameter, where the version is the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/tags"},"available tag"),' trimming prefix "v", such as 0.11.0, etc. In general, you don\'t need to specify Kusion version, just use the command above to install the latest version.'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'# install Kusion of specified version 0.10.0\npowershell {"& { $(irm https://www.kusionstack.io/scripts/install.ps1) } -Version 0.11.0" | iex}\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"Uninstall Kusion")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'# uninstall Kusion\npowershell -Command "iwr -useb https://www.kusionstack.io/scripts/uninstall.ps1 | iex"\n')))))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d9d9f449.854e9d59.js b/assets/js/d9d9f449.854e9d59.js new file mode 100644 index 00000000000..00260cfec78 --- /dev/null +++ b/assets/js/d9d9f449.854e9d59.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[102],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>u});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),m=c(r),u=o,b=m["".concat(s,".").concat(u)]||m[u]||d[u]||a;return r?n.createElement(b,i(i({ref:t},p),{},{components:r})):n.createElement(b,i({ref:t},p))}));function u(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var c=2;c{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>l,toc:()=>c});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:1},i="Installation",l={unversionedId:"faq/install-error",id:"version-v0.10/faq/install-error",title:"Installation",description:"1. Could not find libintl.dylib",source:"@site/docs_versioned_docs/version-v0.10/7-faq/1-install-error.md",sourceDirName:"7-faq",slug:"/faq/install-error",permalink:"/docs/v0.10/faq/install-error",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/7-faq/1-install-error.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"kusion",previous:{title:"Roadmap",permalink:"/docs/v0.10/reference/roadmap"},next:{title:"KCL",permalink:"/docs/v0.10/faq/kcl"}},s={},c=[{value:"1. Could not find libintl.dylib",id:"1-could-not-find-libintldylib",level:2},{value:"2. macOS system SSL related errors",id:"2-macos-system-ssl-related-errors",level:2}],p={toc:c};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"installation"},"Installation"),(0,o.kt)("h2",{id:"1-could-not-find-libintldylib"},"1. Could not find ",(0,o.kt)("inlineCode",{parentName:"h2"},"libintl.dylib")),(0,o.kt)("p",null,"This problem is that some tools depends on the ",(0,o.kt)("inlineCode",{parentName:"p"},"Gettext")," library, but macOS does not have this library by default. You can try to solve it in the following ways:"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"(Skip this step for non-macOS m1) For macOS m1 operating system, make sure you have a homebrew arm64e-version installed in /opt/homebrew, otherwise install the arm version of brew with the following command")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"\n# add to path\nexport PATH=/opt/homebrew/bin:$PATH\n')),(0,o.kt)("ol",{start:2},(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"brew install gettext")),(0,o.kt)("li",{parentName:"ol"},"Make sure ",(0,o.kt)("inlineCode",{parentName:"li"},"libintl.8.dylib")," exists in ",(0,o.kt)("inlineCode",{parentName:"li"},"/usr/local/opt/gettext/lib")," directory"),(0,o.kt)("li",{parentName:"ol"},"If brew is installed in another directory, the library can be created by copying it to the corresponding directory")),(0,o.kt)("h2",{id:"2-macos-system-ssl-related-errors"},"2. macOS system SSL related errors"),(0,o.kt)("p",null,"Openssl dylib library not found or SSL module is not available problem"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"(Skip this step for non-macOS m1) For macOS m1 operating system, make sure you have a homebrew arm64e-version installed in /opt/homebrew, otherwise install the arm version of brew with the following command")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"\n# add to path\nexport PATH=/opt/homebrew/bin:$PATH\n')),(0,o.kt)("ol",{start:2},(0,o.kt)("li",{parentName:"ol"},"Install openssl (version 1.1) via brew")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"brew install openssl@1.1\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/d9d9f449.db80164e.js b/assets/js/d9d9f449.db80164e.js deleted file mode 100644 index 79474411612..00000000000 --- a/assets/js/d9d9f449.db80164e.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[102],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>u});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),m=c(r),u=o,b=m["".concat(s,".").concat(u)]||m[u]||d[u]||a;return r?n.createElement(b,i(i({ref:t},p),{},{components:r})):n.createElement(b,i({ref:t},p))}));function u(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=m;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var c=2;c{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>l,toc:()=>c});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:1},i="Installation",l={unversionedId:"faq/install-error",id:"version-v0.10/faq/install-error",title:"Installation",description:"1. Could not find libintl.dylib",source:"@site/docs_versioned_docs/version-v0.10/7-faq/1-install-error.md",sourceDirName:"7-faq",slug:"/faq/install-error",permalink:"/docs/v0.10/faq/install-error",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/7-faq/1-install-error.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_position:1},sidebar:"kusion",previous:{title:"Roadmap",permalink:"/docs/v0.10/reference/roadmap"},next:{title:"KCL",permalink:"/docs/v0.10/faq/kcl"}},s={},c=[{value:"1. Could not find libintl.dylib",id:"1-could-not-find-libintldylib",level:2},{value:"2. macOS system SSL related errors",id:"2-macos-system-ssl-related-errors",level:2}],p={toc:c};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"installation"},"Installation"),(0,o.kt)("h2",{id:"1-could-not-find-libintldylib"},"1. Could not find ",(0,o.kt)("inlineCode",{parentName:"h2"},"libintl.dylib")),(0,o.kt)("p",null,"This problem is that some tools depends on the ",(0,o.kt)("inlineCode",{parentName:"p"},"Gettext")," library, but macOS does not have this library by default. You can try to solve it in the following ways:"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"(Skip this step for non-macOS m1) For macOS m1 operating system, make sure you have a homebrew arm64e-version installed in /opt/homebrew, otherwise install the arm version of brew with the following command")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"\n# add to path\nexport PATH=/opt/homebrew/bin:$PATH\n')),(0,o.kt)("ol",{start:2},(0,o.kt)("li",{parentName:"ol"},(0,o.kt)("inlineCode",{parentName:"li"},"brew install gettext")),(0,o.kt)("li",{parentName:"ol"},"Make sure ",(0,o.kt)("inlineCode",{parentName:"li"},"libintl.8.dylib")," exists in ",(0,o.kt)("inlineCode",{parentName:"li"},"/usr/local/opt/gettext/lib")," directory"),(0,o.kt)("li",{parentName:"ol"},"If brew is installed in another directory, the library can be created by copying it to the corresponding directory")),(0,o.kt)("h2",{id:"2-macos-system-ssl-related-errors"},"2. macOS system SSL related errors"),(0,o.kt)("p",null,"Openssl dylib library not found or SSL module is not available problem"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"(Skip this step for non-macOS m1) For macOS m1 operating system, make sure you have a homebrew arm64e-version installed in /opt/homebrew, otherwise install the arm version of brew with the following command")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},'/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"\n# add to path\nexport PATH=/opt/homebrew/bin:$PATH\n')),(0,o.kt)("ol",{start:2},(0,o.kt)("li",{parentName:"ol"},"Install openssl (version 1.1) via brew")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"brew install openssl@1.1\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/daa78d60.ba90eba3.js b/assets/js/daa78d60.2b50f61c.js similarity index 61% rename from assets/js/daa78d60.ba90eba3.js rename to assets/js/daa78d60.2b50f61c.js index f3af27626b7..a099aa1c57e 100644 --- a/assets/js/daa78d60.ba90eba3.js +++ b/assets/js/daa78d60.2b50f61c.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[223],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=a.createContext({}),s=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},d=function(e){var t=s(e.components);return a.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=s(n),m=o,f=u["".concat(c,".").concat(m)]||u[m]||p[m]||i;return n?a.createElement(f,r(r({ref:t},d),{},{components:n})):a.createElement(f,r({ref:t},d))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,r=new Array(i);r[0]=u;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:o,r[1]=l;for(var s=2;s{n.d(t,{Z:()=>f});var a=n(87462),o=n(67294),i=n(86668);function r(e){const t=e.map((e=>({...e,parentIndex:-1,children:[]}))),n=Array(7).fill(-1);t.forEach(((e,t)=>{const a=n.slice(2,e.level);e.parentIndex=Math.max(...a),n[e.level]=t}));const a=[];return t.forEach((e=>{const{parentIndex:n,...o}=e;n>=0?t[n].children.push(o):a.push(o)})),a}function l(e){let{toc:t,minHeadingLevel:n,maxHeadingLevel:a}=e;return t.flatMap((e=>{const t=l({toc:e.children,minHeadingLevel:n,maxHeadingLevel:a});return function(e){return e.level>=n&&e.level<=a}(e)?[{...e,children:t}]:t}))}function c(e){const t=e.getBoundingClientRect();return t.top===t.bottom?c(e.parentNode):t}function s(e,t){let{anchorTopOffset:n}=t;const a=e.find((e=>c(e).top>=n));if(a){return function(e){return e.top>0&&e.bottom{e.current=t?0:document.querySelector(".navbar").clientHeight}),[t]),e}function p(e){const t=(0,o.useRef)(void 0),n=d();(0,o.useEffect)((()=>{if(!e)return()=>{};const{linkClassName:a,linkActiveClassName:o,minHeadingLevel:i,maxHeadingLevel:r}=e;function l(){const e=function(e){return Array.from(document.getElementsByClassName(e))}(a),l=function(e){let{minHeadingLevel:t,maxHeadingLevel:n}=e;const a=[];for(let o=t;o<=n;o+=1)a.push(`h${o}.anchor`);return Array.from(document.querySelectorAll(a.join()))}({minHeadingLevel:i,maxHeadingLevel:r}),c=s(l,{anchorTopOffset:n.current}),d=e.find((e=>c&&c.id===function(e){return decodeURIComponent(e.href.substring(e.href.indexOf("#")+1))}(e)));e.forEach((e=>{!function(e,n){n?(t.current&&t.current!==e&&t.current.classList.remove(o),e.classList.add(o),t.current=e):e.classList.remove(o)}(e,e===d)}))}return document.addEventListener("scroll",l),document.addEventListener("resize",l),l(),()=>{document.removeEventListener("scroll",l),document.removeEventListener("resize",l)}}),[e,n])}function u(e){let{toc:t,className:n,linkClassName:a,isChild:i}=e;return t.length?o.createElement("ul",{className:i?void 0:n},t.map((e=>o.createElement("li",{key:e.id},o.createElement("a",{href:`#${e.id}`,className:a??void 0,dangerouslySetInnerHTML:{__html:e.value}}),o.createElement(u,{isChild:!0,toc:e.children,className:n,linkClassName:a}))))):null}const m=o.memo(u);function f(e){let{toc:t,className:n="table-of-contents table-of-contents__left-border",linkClassName:c="table-of-contents__link",linkActiveClassName:s,minHeadingLevel:d,maxHeadingLevel:u,...f}=e;const h=(0,i.L)(),v=d??h.tableOfContents.minHeadingLevel,g=u??h.tableOfContents.maxHeadingLevel,y=function(e){let{toc:t,minHeadingLevel:n,maxHeadingLevel:a}=e;return(0,o.useMemo)((()=>l({toc:r(t),minHeadingLevel:n,maxHeadingLevel:a})),[t,n,a])}({toc:t,minHeadingLevel:v,maxHeadingLevel:g});return p((0,o.useMemo)((()=>{if(c&&s)return{linkClassName:c,linkActiveClassName:s,minHeadingLevel:v,maxHeadingLevel:g}}),[c,s,v,g])),o.createElement(m,(0,a.Z)({toc:y,className:n,linkClassName:c},f))}},44261:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>d,default:()=>h,frontMatter:()=>s,metadata:()=>p,toc:()=>m});var a=n(87462),o=n(67294),i=n(3905),r=n(93743);const l="tableOfContentsInline_prmo";function c(e){let{toc:t,minHeadingLevel:n,maxHeadingLevel:a}=e;return o.createElement("div",{className:l},o.createElement(r.Z,{toc:t,minHeadingLevel:n,maxHeadingLevel:a,className:"table-of-contents",linkClassName:null}))}const s={sidebar_position:2},d="Glossary",p={unversionedId:"concepts/glossary",id:"version-v0.9/concepts/glossary",title:"Glossary",description:"This page lists and defines technical terms that are widely used across KusionStack. Words such as Project, Stack, etc. can be overloaded in the technical community, so this page attempts to clarify their meaning in the context of KusionStack.",source:"@site/docs_versioned_docs/version-v0.9/concepts/glossary.md",sourceDirName:"concepts",slug:"/concepts/glossary",permalink:"/docs/v0.9/concepts/glossary",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/concepts/glossary.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"kusion",previous:{title:"Architecture",permalink:"/docs/v0.9/concepts/arch"},next:{title:"How Kusion Works",permalink:"/docs/v0.9/concepts/kusion"}},u={},m=[{value:"Project",id:"project",level:2},{value:"Stack",id:"stack",level:2},{value:"Application",id:"application",level:2},{value:"High Level Schema",id:"high-level-schema",level:2}],f={toc:m};function h(e){let{components:t,...o}=e;return(0,i.kt)("wrapper",(0,a.Z)({},f,o,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"glossary"},"Glossary"),(0,i.kt)("p",null,"This page lists and defines technical terms that are widely used across KusionStack. Words such as ",(0,i.kt)("inlineCode",{parentName:"p"},"Project"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Stack"),", etc. can be overloaded in the technical community, so this page attempts to clarify their meaning in the context of KusionStack."),(0,i.kt)(c,{toc:m.filter((e=>2===e.level||4===e.level)),minHeadingLevel:2,maxHeadingLevel:4,mdxType:"TOCInline"}),(0,i.kt)("h2",{id:"project"},"Project"),(0,i.kt)("p",null,"A project in Kusion is any folder which contains a ",(0,i.kt)("inlineCode",{parentName:"p"},"project.yaml")," file and is linked to a Git repository. Usually the mapping between project and repository is 1:1, also you can have multiple projects connected to a single repository (for example, a monorepo). And a project is composed of one or more applications."),(0,i.kt)("p",null,'The purpose of the "project" is to bundle application configurations and a refer to Git repository. Specifically, it includes logical configurations for internal pieces to orchestrate the application, and it bundles these configurations in a way to fit different roles, e.g. developer, SRE, to cover the whole life-cycle of application development.'),(0,i.kt)("p",null,"From the perspective of the application development life cycle, the configuration described by the project is decoupled from the application code, takes the immutable image as input, and users could conduct the operation, and maintenance of the application in an independent configuration code base."),(0,i.kt)("h2",{id:"stack"},"Stack"),(0,i.kt)("p",null,"A stack in Kusion is any folder which contains a ",(0,i.kt)("inlineCode",{parentName:"p"},"stack.yaml")," file under belonging project directory. Stack provides a mechanism to isolate multiple deploys of same application, it's the target workspace that an application will be deployed to, also the the smallest operation unit that can be configured and deployed independently. Stacks are commonly used to denote different phases of software development lifecycle e.g. development, staging, and production."),(0,i.kt)("p",null,"A project can have as many stacks as you need. By default, Kusion creates a default stack for you when you start a new project using the kusion init command."),(0,i.kt)("p",null,"Stacks let's you chose on which cluster your applications will be deployed to."),(0,i.kt)("h2",{id:"application"},"Application"),(0,i.kt)("p",null,"An application in Kusion is declared using the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," schema and represents a basic unit that is deployed. "),(0,i.kt)("p",null,"You can create multiple applications within a single project so they can share common configurations. This can be useful if you have several applications that are closely related, such as a backend system for content management and a frontend system for content delivery and display."),(0,i.kt)("h2",{id:"high-level-schema"},"High Level Schema"),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"High_Level_Schema",src:n(4994).Z,width:"2390",height:"1487"})))}h.isMDXComponent=!0},4994:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/high-level-schema-ba34668ea6879003a582f15496c3ab6e.png"}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[223],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>m});var a=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function r(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=a.createContext({}),s=function(e){var t=a.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},d=function(e){var t=s(e.components);return a.createElement(c.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=s(n),m=o,f=u["".concat(c,".").concat(m)]||u[m]||p[m]||i;return n?a.createElement(f,r(r({ref:t},d),{},{components:n})):a.createElement(f,r({ref:t},d))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,r=new Array(i);r[0]=u;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:o,r[1]=l;for(var s=2;s{n.d(t,{Z:()=>f});var a=n(87462),o=n(67294),i=n(86668);function r(e){const t=e.map((e=>({...e,parentIndex:-1,children:[]}))),n=Array(7).fill(-1);t.forEach(((e,t)=>{const a=n.slice(2,e.level);e.parentIndex=Math.max(...a),n[e.level]=t}));const a=[];return t.forEach((e=>{const{parentIndex:n,...o}=e;n>=0?t[n].children.push(o):a.push(o)})),a}function l(e){let{toc:t,minHeadingLevel:n,maxHeadingLevel:a}=e;return t.flatMap((e=>{const t=l({toc:e.children,minHeadingLevel:n,maxHeadingLevel:a});return function(e){return e.level>=n&&e.level<=a}(e)?[{...e,children:t}]:t}))}function c(e){const t=e.getBoundingClientRect();return t.top===t.bottom?c(e.parentNode):t}function s(e,t){let{anchorTopOffset:n}=t;const a=e.find((e=>c(e).top>=n));if(a){return function(e){return e.top>0&&e.bottom{e.current=t?0:document.querySelector(".navbar").clientHeight}),[t]),e}function p(e){const t=(0,o.useRef)(void 0),n=d();(0,o.useEffect)((()=>{if(!e)return()=>{};const{linkClassName:a,linkActiveClassName:o,minHeadingLevel:i,maxHeadingLevel:r}=e;function l(){const e=function(e){return Array.from(document.getElementsByClassName(e))}(a),l=function(e){let{minHeadingLevel:t,maxHeadingLevel:n}=e;const a=[];for(let o=t;o<=n;o+=1)a.push(`h${o}.anchor`);return Array.from(document.querySelectorAll(a.join()))}({minHeadingLevel:i,maxHeadingLevel:r}),c=s(l,{anchorTopOffset:n.current}),d=e.find((e=>c&&c.id===function(e){return decodeURIComponent(e.href.substring(e.href.indexOf("#")+1))}(e)));e.forEach((e=>{!function(e,n){n?(t.current&&t.current!==e&&t.current.classList.remove(o),e.classList.add(o),t.current=e):e.classList.remove(o)}(e,e===d)}))}return document.addEventListener("scroll",l),document.addEventListener("resize",l),l(),()=>{document.removeEventListener("scroll",l),document.removeEventListener("resize",l)}}),[e,n])}function u(e){let{toc:t,className:n,linkClassName:a,isChild:i}=e;return t.length?o.createElement("ul",{className:i?void 0:n},t.map((e=>o.createElement("li",{key:e.id},o.createElement("a",{href:`#${e.id}`,className:a??void 0,dangerouslySetInnerHTML:{__html:e.value}}),o.createElement(u,{isChild:!0,toc:e.children,className:n,linkClassName:a}))))):null}const m=o.memo(u);function f(e){let{toc:t,className:n="table-of-contents table-of-contents__left-border",linkClassName:c="table-of-contents__link",linkActiveClassName:s,minHeadingLevel:d,maxHeadingLevel:u,...f}=e;const h=(0,i.L)(),v=d??h.tableOfContents.minHeadingLevel,g=u??h.tableOfContents.maxHeadingLevel,y=function(e){let{toc:t,minHeadingLevel:n,maxHeadingLevel:a}=e;return(0,o.useMemo)((()=>l({toc:r(t),minHeadingLevel:n,maxHeadingLevel:a})),[t,n,a])}({toc:t,minHeadingLevel:v,maxHeadingLevel:g});return p((0,o.useMemo)((()=>{if(c&&s)return{linkClassName:c,linkActiveClassName:s,minHeadingLevel:v,maxHeadingLevel:g}}),[c,s,v,g])),o.createElement(m,(0,a.Z)({toc:y,className:n,linkClassName:c},f))}},44261:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>d,default:()=>h,frontMatter:()=>s,metadata:()=>p,toc:()=>m});var a=n(87462),o=n(67294),i=n(3905),r=n(93743);const l="tableOfContentsInline_prmo";function c(e){let{toc:t,minHeadingLevel:n,maxHeadingLevel:a}=e;return o.createElement("div",{className:l},o.createElement(r.Z,{toc:t,minHeadingLevel:n,maxHeadingLevel:a,className:"table-of-contents",linkClassName:null}))}const s={sidebar_position:2},d="Glossary",p={unversionedId:"concepts/glossary",id:"version-v0.9/concepts/glossary",title:"Glossary",description:"This page lists and defines technical terms that are widely used across KusionStack. Words such as Project, Stack, etc. can be overloaded in the technical community, so this page attempts to clarify their meaning in the context of KusionStack.",source:"@site/docs_versioned_docs/version-v0.9/concepts/glossary.md",sourceDirName:"concepts",slug:"/concepts/glossary",permalink:"/docs/v0.9/concepts/glossary",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/concepts/glossary.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"kusion",previous:{title:"Architecture",permalink:"/docs/v0.9/concepts/arch"},next:{title:"How Kusion Works",permalink:"/docs/v0.9/concepts/kusion"}},u={},m=[{value:"Project",id:"project",level:2},{value:"Stack",id:"stack",level:2},{value:"Application",id:"application",level:2},{value:"High Level Schema",id:"high-level-schema",level:2}],f={toc:m};function h(e){let{components:t,...o}=e;return(0,i.kt)("wrapper",(0,a.Z)({},f,o,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"glossary"},"Glossary"),(0,i.kt)("p",null,"This page lists and defines technical terms that are widely used across KusionStack. Words such as ",(0,i.kt)("inlineCode",{parentName:"p"},"Project"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Stack"),", etc. can be overloaded in the technical community, so this page attempts to clarify their meaning in the context of KusionStack."),(0,i.kt)(c,{toc:m.filter((e=>2===e.level||4===e.level)),minHeadingLevel:2,maxHeadingLevel:4,mdxType:"TOCInline"}),(0,i.kt)("h2",{id:"project"},"Project"),(0,i.kt)("p",null,"A project in Kusion is any folder which contains a ",(0,i.kt)("inlineCode",{parentName:"p"},"project.yaml")," file and is linked to a Git repository. Usually the mapping between project and repository is 1:1, also you can have multiple projects connected to a single repository (for example, a monorepo). And a project is composed of one or more applications."),(0,i.kt)("p",null,'The purpose of the "project" is to bundle application configurations and a refer to Git repository. Specifically, it includes logical configurations for internal pieces to orchestrate the application, and it bundles these configurations in a way to fit different roles, e.g. developer, SRE, to cover the whole life-cycle of application development.'),(0,i.kt)("p",null,"From the perspective of the application development life cycle, the configuration described by the project is decoupled from the application code, takes the immutable image as input, and users could conduct the operation, and maintenance of the application in an independent configuration code base."),(0,i.kt)("h2",{id:"stack"},"Stack"),(0,i.kt)("p",null,"A stack in Kusion is any folder which contains a ",(0,i.kt)("inlineCode",{parentName:"p"},"stack.yaml")," file under belonging project directory. Stack provides a mechanism to isolate multiple deploys of same application, it's the target workspace that an application will be deployed to, also the the smallest operation unit that can be configured and deployed independently. Stacks are commonly used to denote different phases of software development lifecycle e.g. development, staging, and production."),(0,i.kt)("p",null,"A project can have as many stacks as you need. By default, Kusion creates a default stack for you when you start a new project using the kusion init command."),(0,i.kt)("p",null,"Stacks let's you chose on which cluster your applications will be deployed to."),(0,i.kt)("h2",{id:"application"},"Application"),(0,i.kt)("p",null,"An application in Kusion is declared using the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," schema and represents a basic unit that is deployed. "),(0,i.kt)("p",null,"You can create multiple applications within a single project so they can share common configurations. This can be useful if you have several applications that are closely related, such as a backend system for content management and a frontend system for content delivery and display."),(0,i.kt)("h2",{id:"high-level-schema"},"High Level Schema"),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"High_Level_Schema",src:n(4994).Z,width:"2390",height:"1487"})))}h.isMDXComponent=!0},4994:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/high-level-schema-ba34668ea6879003a582f15496c3ab6e.png"}}]); \ No newline at end of file diff --git a/assets/js/db343463.4fdd00a2.js b/assets/js/db343463.8ca2a907.js similarity index 53% rename from assets/js/db343463.4fdd00a2.js rename to assets/js/db343463.8ca2a907.js index 96687fa22f0..89e3fd0f648 100644 --- a/assets/js/db343463.4fdd00a2.js +++ b/assets/js/db343463.8ca2a907.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8420],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,k=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return n?r.createElement(k,l(l({ref:t},p),{},{components:n})):r.createElement(k,l({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const o={},l="job",i={unversionedId:"reference/modules/workspace-configs/workload/job",id:"reference/modules/workspace-configs/workload/job",title:"job",description:"job can be used to define workspace-level job configuration.",source:"@site/docs/kusion/6-reference/2-modules/2-workspace-configs/workload/job.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/workload",slug:"/reference/modules/workspace-configs/workload/job",permalink:"/docs/next/reference/modules/workspace-configs/workload/job",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/2-workspace-configs/workload/job.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"opsrule",permalink:"/docs/next/reference/modules/workspace-configs/opsrule/"},next:{title:"service",permalink:"/docs/next/reference/modules/workspace-configs/workload/service"}},s={},c=[{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:c};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"job"},"job"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"job")," can be used to define workspace-level job configuration."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"replicas"),(0,a.kt)("br",null),"Number of container replicas based on this configuration that should be ran."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"2"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels"),(0,a.kt)("br",null),"Labels are key/value pairs that are attached to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations"),(0,a.kt)("br",null),"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n job:\n default:\n replicas: 3\n labels:\n label-key: label-value\n annotations:\n annotation-key: annotation-value\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8420],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=c(n),m=a,k=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return n?r.createElement(k,l(l({ref:t},p),{},{components:n})):r.createElement(k,l({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const o={},l="job",i={unversionedId:"reference/modules/workspace-configs/workload/job",id:"reference/modules/workspace-configs/workload/job",title:"job",description:"job can be used to define workspace-level job configuration.",source:"@site/docs/kusion/6-reference/2-modules/2-workspace-configs/workload/job.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/workload",slug:"/reference/modules/workspace-configs/workload/job",permalink:"/docs/next/reference/modules/workspace-configs/workload/job",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/2-modules/2-workspace-configs/workload/job.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"opsrule",permalink:"/docs/next/reference/modules/workspace-configs/opsrule/"},next:{title:"service",permalink:"/docs/next/reference/modules/workspace-configs/workload/service"}},s={},c=[{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:c};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"job"},"job"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"job")," can be used to define workspace-level job configuration."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"replicas"),(0,a.kt)("br",null),"Number of container replicas based on this configuration that should be ran."),(0,a.kt)("td",{parentName:"tr",align:null},"int"),(0,a.kt)("td",{parentName:"tr",align:null},"2"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels"),(0,a.kt)("br",null),"Labels are key/value pairs that are attached to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations"),(0,a.kt)("br",null),"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n job:\n default:\n replicas: 3\n labels:\n label-key: label-value\n annotations:\n annotation-key: annotation-value\n")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/db719915.ea11932d.js b/assets/js/db719915.ea11932d.js new file mode 100644 index 00000000000..d1f7bb106ce --- /dev/null +++ b/assets/js/db719915.ea11932d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2679],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=o.createContext({}),u=function(e){var t=o.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},l=function(e){var t=u(e.components);return o.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,s=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),d=u(n),m=r,h=d["".concat(s,".").concat(m)]||d[m]||c[m]||a;return n?o.createElement(h,i(i({ref:t},l),{},{components:n})):o.createElement(h,i({ref:t},l))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,i=new Array(a);i[0]=d;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p.mdxType="string"==typeof e?e:r,i[1]=p;for(var u=2;u{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>c,frontMatter:()=>a,metadata:()=>p,toc:()=>u});var o=n(87462),r=(n(67294),n(3905));const a={},i="Application Monitoring",p={unversionedId:"configuration-walkthrough/monitoring",id:"version-v0.11/configuration-walkthrough/monitoring",title:"Application Monitoring",description:"You could also specify the collection of monitoring requirements for the application. That can be achieved via a monitoring module (or bring-your-own-module) in the accessories field in AppConfiguration to achieve that.",source:"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/8-monitoring.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/monitoring",permalink:"/docs/configuration-walkthrough/monitoring",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/8-monitoring.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:8,frontMatter:{},sidebar:"kusion",previous:{title:"Secrets",permalink:"/docs/configuration-walkthrough/secret"},next:{title:"Operational Rules",permalink:"/docs/configuration-walkthrough/operational-rules"}},s={},u=[{value:"Import",id:"import",level:2},{value:"Workspace configurations",id:"workspace-configurations",level:2},{value:"Managing Scraping Configuration",id:"managing-scraping-configuration",level:2},{value:"Default values",id:"default-values",level:2}],l={toc:u};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,o.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"application-monitoring"},"Application Monitoring"),(0,r.kt)("p",null,"You could also specify the collection of monitoring requirements for the application. That can be achieved via a ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," module (or bring-your-own-module) in the ",(0,r.kt)("inlineCode",{parentName:"p"},"accessories")," field in ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," to achieve that."),(0,r.kt)("p",null,"As of version 0.11.0, Kusion supports integration with Prometheus by managing scraping behaviors in the configuration file."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"For the monitoring configuration to work (more specifically, consumed by Prometheus), this requires the target cluster to have installed Prometheus correctly, either as a Kubernetes operator or a server/agent."),(0,r.kt)("p",{parentName:"admonition"},"More about how to set up Prometheus can be found in the ",(0,r.kt)("a",{parentName:"p",href:"../user-guides/observability/prometheus"},"Prometheus User Guide for Kusion"))),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"kam")," package and the ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," Kusion Module. For more details on KCL package and module import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport monitoring as m\n")),(0,r.kt)("h2",{id:"workspace-configurations"},"Workspace configurations"),(0,r.kt)("p",null,"In addition to the KCL configuration file, there are also workspace-level configurations that should be set first. In an ideal scenario, this step is done by the platform engineers. "),(0,r.kt)("p",null,"In the event that they do not exist for you or your organization, e.g. if you are an individual developer, you can either do it yourself or use the ",(0,r.kt)("a",{parentName:"p",href:"#default-values"},"default values")," provided by the KusionStack team. The steps to do this yourself can be found in the ",(0,r.kt)("a",{parentName:"p",href:"../user-guides/observability/prometheus#setting-up-workspace-configs"},"Prometheus User Guide for Kusion"),"."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"For more details on how workspaces work, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"/docs/concepts/workspace"},"workspace concept"))),(0,r.kt)("p",null,"By separating configurations that the developers are interested in and those that platform owners are interested in, we can reduce the cognitive complexity of the application configuration and achieve separation of concern."),(0,r.kt)("p",null,"You can append the following YAML file to your own workspace configurations and update the corresponding workspace with command ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace update"),". "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n kusionstack/monitoring@v0.1.0:\n default:\n interval: 30s\n monitorType: Pod\n operatorMode: true\n scheme: http\n timeout: 15s\n")),(0,r.kt)("h2",{id:"managing-scraping-configuration"},"Managing Scraping Configuration"),(0,r.kt)("p",null,"To manage scrape configuration for the application:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n # Add the monitoring configuration backed by Prometheus\n accessories: {\n "monitoring": m.Prometheus {\n path: "/metrics"\n port: "web"\n }\n }\n}\n')),(0,r.kt)("p",null,"The example above will instruct the Prometheus job to scrape metrics from the ",(0,r.kt)("inlineCode",{parentName:"p"},"/metrics")," endpoint of the application on the port named ",(0,r.kt)("inlineCode",{parentName:"p"},"web"),"."),(0,r.kt)("p",null,"To instruct Prometheus to scrape from ",(0,r.kt)("inlineCode",{parentName:"p"},"/actuator/metrics")," on port ",(0,r.kt)("inlineCode",{parentName:"p"},"9099")," instead:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n # Add the monitoring configuration backed by Prometheus\n accessories: {\n "monitoring": m.Prometheus {\n path: "/actuator/metrics"\n port: "9099"\n }\n }\n}\n')),(0,r.kt)("p",null,"Note that numbered ports only work when your Prometheus is not running as an operator. "),(0,r.kt)("p",null,"Neither ",(0,r.kt)("inlineCode",{parentName:"p"},"path")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"port")," are required fields if Prometheus runs as an operator. If omitted, ",(0,r.kt)("inlineCode",{parentName:"p"},"path")," defaults to ",(0,r.kt)("inlineCode",{parentName:"p"},"/metrics"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"port")," defaults to the container port or service port, depending on which resource is being monitored. If Prometheus does not run as an operator, both fields are required."),(0,r.kt)("p",null,"Scraping scheme, interval and timeout are considered platform-managed configurations and are therefore managed as part of the ",(0,r.kt)("a",{parentName:"p",href:"../user-guides/observability/prometheus#setting-up-workspace-configs"},"workspace configurations"),"."),(0,r.kt)("p",null,"More details about how the Prometheus integration works can be found in the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/prometheus.md"},"design documentation"),"."),(0,r.kt)("h2",{id:"default-values"},"Default values"),(0,r.kt)("p",null,"If no workspace configurations are found, the default values provided by the KusionStack team are:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Scraping interval defaults to 30 seconds"),(0,r.kt)("li",{parentName:"ul"},"Scraping timeout defaults to 15 seconds"),(0,r.kt)("li",{parentName:"ul"},"Scraping scheme defaults to http"),(0,r.kt)("li",{parentName:"ul"},"Defaults to NOT running as an operator")),(0,r.kt)("p",null,"If any of the default values does not meet your need, you can change them by ",(0,r.kt)("a",{parentName:"p",href:"../user-guides/observability/prometheus#setting-up-workspace-configs"},"setting up the workspace configuration"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/db719915.fa9b8b30.js b/assets/js/db719915.fa9b8b30.js deleted file mode 100644 index 3326d1876a5..00000000000 --- a/assets/js/db719915.fa9b8b30.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2679],{3905:(e,t,n)=>{n.d(t,{Zo:()=>l,kt:()=>m});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=o.createContext({}),u=function(e){var t=o.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},l=function(e){var t=u(e.components);return o.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,s=e.parentName,l=p(e,["components","mdxType","originalType","parentName"]),d=u(n),m=r,h=d["".concat(s,".").concat(m)]||d[m]||c[m]||a;return n?o.createElement(h,i(i({ref:t},l),{},{components:n})):o.createElement(h,i({ref:t},l))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,i=new Array(a);i[0]=d;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p.mdxType="string"==typeof e?e:r,i[1]=p;for(var u=2;u{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>c,frontMatter:()=>a,metadata:()=>p,toc:()=>u});var o=n(87462),r=(n(67294),n(3905));const a={},i="Application Monitoring",p={unversionedId:"configuration-walkthrough/monitoring",id:"version-v0.11/configuration-walkthrough/monitoring",title:"Application Monitoring",description:"You could also specify the collection of monitoring requirements for the application. That can be achieved via a monitoring module (or bring-your-own-module) in the accessories field in AppConfiguration to achieve that.",source:"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/8-monitoring.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/monitoring",permalink:"/docs/configuration-walkthrough/monitoring",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/8-monitoring.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:8,frontMatter:{},sidebar:"kusion",previous:{title:"Secrets",permalink:"/docs/configuration-walkthrough/secret"},next:{title:"Operational Rules",permalink:"/docs/configuration-walkthrough/operational-rules"}},s={},u=[{value:"Import",id:"import",level:2},{value:"Workspace configurations",id:"workspace-configurations",level:2},{value:"Managing Scraping Configuration",id:"managing-scraping-configuration",level:2},{value:"Default values",id:"default-values",level:2}],l={toc:u};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,o.Z)({},l,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"application-monitoring"},"Application Monitoring"),(0,r.kt)("p",null,"You could also specify the collection of monitoring requirements for the application. That can be achieved via a ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," module (or bring-your-own-module) in the ",(0,r.kt)("inlineCode",{parentName:"p"},"accessories")," field in ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," to achieve that."),(0,r.kt)("p",null,"As of version 0.11.0, Kusion supports integration with Prometheus by managing scraping behaviors in the configuration file."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"For the monitoring configuration to work (more specifically, consumed by Prometheus), this requires the target cluster to have installed Prometheus correctly, either as a Kubernetes operator or a server/agent."),(0,r.kt)("p",{parentName:"admonition"},"More about how to set up Prometheus can be found in the ",(0,r.kt)("a",{parentName:"p",href:"../user-guides/observability/prometheus"},"Prometheus User Guide for Kusion"))),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"kam")," package and the ",(0,r.kt)("inlineCode",{parentName:"p"},"monitoring")," Kusion Module. For more details on KCL package and module import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport monitoring as m\n")),(0,r.kt)("h2",{id:"workspace-configurations"},"Workspace configurations"),(0,r.kt)("p",null,"In addition to the KCL configuration file, there are also workspace-level configurations that should be set first. In an ideal scenario, this step is done by the platform engineers. "),(0,r.kt)("p",null,"In the event that they do not exist for you or your organization, e.g. if you are an individual developer, you can either do it yourself or use the ",(0,r.kt)("a",{parentName:"p",href:"#default-values"},"default values")," provided by the KusionStack team. The steps to do this yourself can be found in the ",(0,r.kt)("a",{parentName:"p",href:"../user-guides/observability/prometheus#setting-up-workspace-configs"},"Prometheus User Guide for Kusion"),"."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"For more details on how workspaces work, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"/docs/concepts/workspace"},"workspace concept"))),(0,r.kt)("p",null,"By separating configurations that the developers are interested in and those that platform owners are interested in, we can reduce the cognitive complexity of the application configuration and achieve separation of concern."),(0,r.kt)("p",null,"You can append the following YAML file to your own workspace configurations and update the corresponding workspace with command ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace update"),". "),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n kusionstack/monitoring@v0.1.0:\n default:\n interval: 30s\n monitorType: Pod\n operatorMode: true\n scheme: http\n timeout: 15s\n")),(0,r.kt)("h2",{id:"managing-scraping-configuration"},"Managing Scraping Configuration"),(0,r.kt)("p",null,"To manage scrape configuration for the application:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n # Add the monitoring configuration backed by Prometheus\n accessories: {\n "monitoring": m.Prometheus {\n path: "/metrics"\n port: "web"\n }\n }\n}\n')),(0,r.kt)("p",null,"The example above will instruct the Prometheus job to scrape metrics from the ",(0,r.kt)("inlineCode",{parentName:"p"},"/metrics")," endpoint of the application on the port named ",(0,r.kt)("inlineCode",{parentName:"p"},"web"),"."),(0,r.kt)("p",null,"To instruct Prometheus to scrape from ",(0,r.kt)("inlineCode",{parentName:"p"},"/actuator/metrics")," on port ",(0,r.kt)("inlineCode",{parentName:"p"},"9099")," instead:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n # Add the monitoring configuration backed by Prometheus\n accessories: {\n "monitoring": m.Prometheus {\n path: "/actuator/metrics"\n port: "9099"\n }\n }\n}\n')),(0,r.kt)("p",null,"Note that numbered ports only work when your Prometheus is not running as an operator. "),(0,r.kt)("p",null,"Neither ",(0,r.kt)("inlineCode",{parentName:"p"},"path")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"port")," are required fields if Prometheus runs as an operator. If omitted, ",(0,r.kt)("inlineCode",{parentName:"p"},"path")," defaults to ",(0,r.kt)("inlineCode",{parentName:"p"},"/metrics"),", and ",(0,r.kt)("inlineCode",{parentName:"p"},"port")," defaults to the container port or service port, depending on which resource is being monitored. If Prometheus does not run as an operator, both fields are required."),(0,r.kt)("p",null,"Scraping scheme, interval and timeout are considered platform-managed configurations and are therefore managed as part of the ",(0,r.kt)("a",{parentName:"p",href:"../user-guides/observability/prometheus#setting-up-workspace-configs"},"workspace configurations"),"."),(0,r.kt)("p",null,"More details about how the Prometheus integration works can be found in the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/docs/prometheus.md"},"design documentation"),"."),(0,r.kt)("h2",{id:"default-values"},"Default values"),(0,r.kt)("p",null,"If no workspace configurations are found, the default values provided by the KusionStack team are:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Scraping interval defaults to 30 seconds"),(0,r.kt)("li",{parentName:"ul"},"Scraping timeout defaults to 15 seconds"),(0,r.kt)("li",{parentName:"ul"},"Scraping scheme defaults to http"),(0,r.kt)("li",{parentName:"ul"},"Defaults to NOT running as an operator")),(0,r.kt)("p",null,"If any of the default values does not meet your need, you can change them by ",(0,r.kt)("a",{parentName:"p",href:"../user-guides/observability/prometheus#setting-up-workspace-configs"},"setting up the workspace configuration"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/de5e0098.84a7cfaa.js b/assets/js/de5e0098.84a7cfaa.js deleted file mode 100644 index 96e81b13e62..00000000000 --- a/assets/js/de5e0098.84a7cfaa.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8522],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>u});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),c=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},d=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),m=c(r),u=a,f=m["".concat(i,".").concat(u)]||m[u]||p[u]||l;return r?n.createElement(f,o(o({ref:t},d),{},{components:r})):n.createElement(f,o({ref:t},d))}));function u(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=m;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var c=2;c{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>p,frontMatter:()=>l,metadata:()=>s,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const l={},o="secret",s={unversionedId:"reference/modules/catalog-models/internal/secret/secret",id:"version-v0.10/reference/modules/catalog-models/internal/secret/secret",title:"secret",description:"Schema Secret",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/secret/secret.md",sourceDirName:"6-reference/2-modules/1-catalog-models/internal/secret",slug:"/reference/modules/catalog-models/internal/secret/",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/secret/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/secret/secret.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"port",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/network/port"},next:{title:"prometheus",permalink:"/docs/v0.10/reference/modules/catalog-models/monitoring/prometheus"}},i={},c=[{value:"Schema Secret",id:"schema-secret",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],d={toc:c};function p(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"secret"},"secret"),(0,a.kt)("h2",{id:"schema-secret"},"Schema Secret"),(0,a.kt)("p",null,"Secrets are used to provide data that is considered sensitive like passwords, API keys,",(0,a.kt)("br",null),"TLS certificates, tokens or other credentials."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"type"),(0,a.kt)("br",null),"Type of secret, used to facilitate programmatic handling of secret data."),(0,a.kt)("td",{parentName:"tr",align:null},'"basic" ',"|",' "token" ',"|",' "opaque" ',"|",' "certificate" ',"|",' "external"'),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"params"),(0,a.kt)("br",null),"Collection of parameters used to facilitate programmatic handling of secret data."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"data"),(0,a.kt)("br",null),"Data contains the non-binary secret data in string form."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"immutable"),(0,a.kt)("br",null),"Immutable, if set to true, ensures that data stored in the Secret cannot be updated."),(0,a.kt)("td",{parentName:"tr",align:null},"bool"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.secret as sec\n\nbasicAuth = sec.Secret {\n type: "basic"\n data: {\n "username": ""\n "password": ""\n }\n}\n')))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/de5e0098.bb9b7fba.js b/assets/js/de5e0098.bb9b7fba.js new file mode 100644 index 00000000000..d867c6177b5 --- /dev/null +++ b/assets/js/de5e0098.bb9b7fba.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8522],{3905:(e,t,r)=>{r.d(t,{Zo:()=>d,kt:()=>m});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),c=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},d=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),u=c(r),m=a,f=u["".concat(i,".").concat(m)]||u[m]||p[m]||l;return r?n.createElement(f,o(o({ref:t},d),{},{components:r})):n.createElement(f,o({ref:t},d))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=u;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var c=2;c{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>p,frontMatter:()=>l,metadata:()=>s,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const l={},o="secret",s={unversionedId:"reference/modules/catalog-models/internal/secret/secret",id:"version-v0.10/reference/modules/catalog-models/internal/secret/secret",title:"secret",description:"Schema Secret",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/secret/secret.md",sourceDirName:"6-reference/2-modules/1-catalog-models/internal/secret",slug:"/reference/modules/catalog-models/internal/secret/",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/secret/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/secret/secret.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"port",permalink:"/docs/v0.10/reference/modules/catalog-models/internal/network/port"},next:{title:"prometheus",permalink:"/docs/v0.10/reference/modules/catalog-models/monitoring/prometheus"}},i={},c=[{value:"Schema Secret",id:"schema-secret",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],d={toc:c};function p(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},d,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"secret"},"secret"),(0,a.kt)("h2",{id:"schema-secret"},"Schema Secret"),(0,a.kt)("p",null,"Secrets are used to provide data that is considered sensitive like passwords, API keys,",(0,a.kt)("br",null),"TLS certificates, tokens or other credentials."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"type"),(0,a.kt)("br",null),"Type of secret, used to facilitate programmatic handling of secret data."),(0,a.kt)("td",{parentName:"tr",align:null},'"basic" ',"|",' "token" ',"|",' "opaque" ',"|",' "certificate" ',"|",' "external"'),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"params"),(0,a.kt)("br",null),"Collection of parameters used to facilitate programmatic handling of secret data."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"data"),(0,a.kt)("br",null),"Data contains the non-binary secret data in string form."),(0,a.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"immutable"),(0,a.kt)("br",null),"Immutable, if set to true, ensures that data stored in the Secret cannot be updated."),(0,a.kt)("td",{parentName:"tr",align:null},"bool"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.workload.secret as sec\n\nbasicAuth = sec.Secret {\n type: "basic"\n data: {\n "username": ""\n "password": ""\n }\n}\n')))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/de7874bb.2fabde79.js b/assets/js/de7874bb.2fabde79.js new file mode 100644 index 00000000000..fc2994ac483 --- /dev/null +++ b/assets/js/de7874bb.2fabde79.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8026],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var o=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=o.createContext({}),p=function(e){var t=o.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},c=function(e){var t=p(e.components);return o.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},u=o.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=p(n),f=i,h=u["".concat(l,".").concat(f)]||u[f]||d[f]||a;return n?o.createElement(h,r(r({ref:t},c),{},{components:n})):o.createElement(h,r({ref:t},c))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,r=new Array(a);r[0]=u;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,r[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>d,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var o=n(87462),i=(n(67294),n(3905));const a={id:"app-configuration",sidebar_label:"AppConfiguration"},r="AppConfiguration",s={unversionedId:"concepts/app-configuration",id:"concepts/app-configuration",title:"AppConfiguration",description:"As a modern cloud-native application delivery toolchain, declarative intent-based actuation is the central idea of Kusion, and AppConfiguration model plays the role of describing the intent, which provides a simpler path for on-boarding developers to the platform without leaking low level details in runtime infrastructure and allows developers to fully focus on the application logic itself.",source:"@site/docs/kusion/3-concepts/5-appconfiguration.md",sourceDirName:"3-concepts",slug:"/concepts/app-configuration",permalink:"/docs/next/concepts/app-configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/3-concepts/5-appconfiguration.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:5,frontMatter:{id:"app-configuration",sidebar_label:"AppConfiguration"},sidebar:"kusion",previous:{title:"Workspace",permalink:"/docs/next/concepts/workspace"},next:{title:"Spec",permalink:"/docs/next/concepts/spec"}},l={},p=[{value:"Workload",id:"workload",level:4},{value:"Accessory",id:"accessory",level:4},{value:"Pipeline",id:"pipeline",level:4},{value:"Topologies",id:"topologies",level:4}],c={toc:p};function d(e){let{components:t,...a}=e;return(0,i.kt)("wrapper",(0,o.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"appconfiguration"},"AppConfiguration"),(0,i.kt)("p",null,"As a modern cloud-native application delivery toolchain, declarative intent-based actuation is the central idea of Kusion, and ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model plays the role of describing the intent, which provides a simpler path for on-boarding developers to the platform without leaking low level details in runtime infrastructure and allows developers to fully focus on the application logic itself."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model consolidates workload and their dependent accessories for the application deployment, along with any pipeline and operational requirements into one standardized, infrastructure-independent declarative specification. This declarative specification represents the intuitive user intent for the application, which drives a standardized and efficient application delivery and operation process in a hybrid environment."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"appconfig.png",src:n(57091).Z,width:"5512",height:"3390"})),(0,i.kt)("p",null,"AppConfiguration consists of four core concepts, namely ",(0,i.kt)("inlineCode",{parentName:"p"},"Workload"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Accessory"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Pipeline"),", and ",(0,i.kt)("inlineCode",{parentName:"p"},"Dependency"),". We will walk through these concepts one by one."),(0,i.kt)("h4",{id:"workload"},"Workload"),(0,i.kt)("p",null,"Workload is a representation of the business logic that runs in the cluster. Common workload types include long-running services that should \u201cnever\u201d go down and batch jobs that take from a few seconds to a few days to complete. A valid AppConfiguration instance must include at least one Workload, which is made of one or more containers, along with their configurations, such as the container image, environment variables, and resource requirements."),(0,i.kt)("p",null,"In most cases, a Workload is a backend service or the frontend of an Application. For example, in a micro-service architecture, each service would be represented by a distinct Workload. This allows developers to manage and deploy their code in a more organized and efficient manner."),(0,i.kt)("h4",{id:"accessory"},"Accessory"),(0,i.kt)("p",null,"Using the analogy of a car, workload is the core engine of application, but only having the engine isn\u2019t enough for the application to function properly. In most cases there must be other supporting parts for the workload to operate as intended. For those supporting parts we call them Accessory. Accessory refers to various runtime capabilities and operational requirements provided by the underlying infrastructure, such as database, network load-balancer, storage and so on."),(0,i.kt)("p",null,"From the perspective of team collaboration, the platform team should be responsible for creating and maintaining various accessory definitions, providing reusable building blocks out-of-the-box. Application developers just need to leverage the existing accessories to cover the evolving application needs. This helps software organizations achieve separation of concern, so that different roles can focus on the subject matter they are an expert of."),(0,i.kt)("h4",{id:"pipeline"},"Pipeline"),(0,i.kt)("p",null,"Running reliable applications requires reliable delivery pipelines. By default, Kusion provides a relatively fixed built-in application delivery pipeline, which should be sufficient for most use cases. However, as the application scale and complexity grows, so does the need for a customizable delivery pipeline. Developers wish for more fine-tuned control and customization over the workflow to delivery their applications. That\u2019s why we introduced the Pipeline section in AppConfiguration model."),(0,i.kt)("p",null,"A customized delivery pipeline is made of several steps, each corresponds to an operation that needs to be executed, such as running certain tests after a deployment, scanning artifacts for vulnerabilities prior to a deployment, and so on. Implementation-wise, the execution of each step should be carried out in the form of a plugin, developed and managed by the platform owners."),(0,i.kt)("h4",{id:"topologies"},"Topologies"),(0,i.kt)("p",null,"Application dependencies refer to the external services or other software that an application relies on in order to function properly. These dependencies may be required in order to provide certain functionality or to use certain features in the application."),(0,i.kt)("p",null,"Similar to declaring a dependency from an application to an accessory, AppConfiguration lets you declare the dependencies between different applications in the same way."))}d.isMDXComponent=!0},57091:(e,t,n)=>{n.d(t,{Z:()=>o});const o=n.p+"assets/images/appconfig-04e20b2e12ca7d5c3bc3992b2d602416.png"}}]); \ No newline at end of file diff --git a/assets/js/de7874bb.8984941a.js b/assets/js/de7874bb.8984941a.js deleted file mode 100644 index 388cce28b5c..00000000000 --- a/assets/js/de7874bb.8984941a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8026],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var o=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=o.createContext({}),p=function(e){var t=o.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},c=function(e){var t=p(e.components);return o.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},u=o.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=p(n),f=i,h=u["".concat(l,".").concat(f)]||u[f]||d[f]||r;return n?o.createElement(h,a(a({ref:t},c),{},{components:n})):o.createElement(h,a({ref:t},c))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,a=new Array(r);a[0]=u;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,a[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>d,frontMatter:()=>r,metadata:()=>s,toc:()=>p});var o=n(87462),i=(n(67294),n(3905));const r={id:"app-configuration",sidebar_label:"AppConfiguration"},a="AppConfiguration",s={unversionedId:"concepts/app-configuration",id:"concepts/app-configuration",title:"AppConfiguration",description:"As a modern cloud-native application delivery toolchain, declarative intent-based actuation is the central idea of Kusion, and AppConfiguration model plays the role of describing the intent, which provides a simpler path for on-boarding developers to the platform without leaking low level details in runtime infrastructure and allows developers to fully focus on the application logic itself.",source:"@site/docs/kusion/3-concepts/5-appconfiguration.md",sourceDirName:"3-concepts",slug:"/concepts/app-configuration",permalink:"/docs/next/concepts/app-configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/3-concepts/5-appconfiguration.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:5,frontMatter:{id:"app-configuration",sidebar_label:"AppConfiguration"},sidebar:"kusion",previous:{title:"Workspace",permalink:"/docs/next/concepts/workspace"},next:{title:"Spec",permalink:"/docs/next/concepts/spec"}},l={},p=[{value:"Workload",id:"workload",level:4},{value:"Accessory",id:"accessory",level:4},{value:"Pipeline",id:"pipeline",level:4},{value:"Topologies",id:"topologies",level:4}],c={toc:p};function d(e){let{components:t,...r}=e;return(0,i.kt)("wrapper",(0,o.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"appconfiguration"},"AppConfiguration"),(0,i.kt)("p",null,"As a modern cloud-native application delivery toolchain, declarative intent-based actuation is the central idea of Kusion, and ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model plays the role of describing the intent, which provides a simpler path for on-boarding developers to the platform without leaking low level details in runtime infrastructure and allows developers to fully focus on the application logic itself."),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model consolidates workload and their dependent accessories for the application deployment, along with any pipeline and operational requirements into one standardized, infrastructure-independent declarative specification. This declarative specification represents the intuitive user intent for the application, which drives a standardized and efficient application delivery and operation process in a hybrid environment."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"appconfig.png",src:n(57091).Z,width:"5512",height:"3390"})),(0,i.kt)("p",null,"AppConfiguration consists of four core concepts, namely ",(0,i.kt)("inlineCode",{parentName:"p"},"Workload"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Accessory"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Pipeline"),", and ",(0,i.kt)("inlineCode",{parentName:"p"},"Dependency"),". We will walk through these concepts one by one."),(0,i.kt)("h4",{id:"workload"},"Workload"),(0,i.kt)("p",null,"Workload is a representation of the business logic that runs in the cluster. Common workload types include long-running services that should \u201cnever\u201d go down and batch jobs that take from a few seconds to a few days to complete. A valid AppConfiguration instance must include at least one Workload, which is made of one or more containers, along with their configurations, such as the container image, environment variables, and resource requirements."),(0,i.kt)("p",null,"In most cases, a Workload is a backend service or the frontend of an Application. For example, in a micro-service architecture, each service would be represented by a distinct Workload. This allows developers to manage and deploy their code in a more organized and efficient manner."),(0,i.kt)("h4",{id:"accessory"},"Accessory"),(0,i.kt)("p",null,"Using the analogy of a car, workload is the core engine of application, but only having the engine isn\u2019t enough for the application to function properly. In most cases there must be other supporting parts for the workload to operate as intended. For those supporting parts we call them Accessory. Accessory refers to various runtime capabilities and operational requirements provided by the underlying infrastructure, such as database, network load-balancer, storage and so on."),(0,i.kt)("p",null,"From the perspective of team collaboration, the platform team should be responsible for creating and maintaining various accessory definitions, providing reusable building blocks out-of-the-box. Application developers just need to leverage the existing accessories to cover the evolving application needs. This helps software organizations achieve separation of concern, so that different roles can focus on the subject matter they are an expert of."),(0,i.kt)("h4",{id:"pipeline"},"Pipeline"),(0,i.kt)("p",null,"Running reliable applications requires reliable delivery pipelines. By default, Kusion provides a relatively fixed built-in application delivery pipeline, which should be sufficient for most use cases. However, as the application scale and complexity grows, so does the need for a customizable delivery pipeline. Developers wish for more fine-tuned control and customization over the workflow to delivery their applications. That\u2019s why we introduced the Pipeline section in AppConfiguration model."),(0,i.kt)("p",null,"A customized delivery pipeline is made of several steps, each corresponds to an operation that needs to be executed, such as running certain tests after a deployment, scanning artifacts for vulnerabilities prior to a deployment, and so on. Implementation-wise, the execution of each step should be carried out in the form of a plugin, developed and managed by the platform owners."),(0,i.kt)("h4",{id:"topologies"},"Topologies"),(0,i.kt)("p",null,"Application dependencies refer to the external services or other software that an application relies on in order to function properly. These dependencies may be required in order to provide certain functionality or to use certain features in the application."),(0,i.kt)("p",null,"Similar to declaring a dependency from an application to an accessory, AppConfiguration lets you declare the dependencies between different applications in the same way."))}d.isMDXComponent=!0},57091:(e,t,n)=>{n.d(t,{Z:()=>o});const o=n.p+"assets/images/appconfig-04e20b2e12ca7d5c3bc3992b2d602416.png"}}]); \ No newline at end of file diff --git a/assets/js/e08a2305.b272811d.js b/assets/js/e08a2305.51f3299b.js similarity index 83% rename from assets/js/e08a2305.b272811d.js rename to assets/js/e08a2305.51f3299b.js index 9eaf6f48d15..af4d8544a72 100644 --- a/assets/js/e08a2305.b272811d.js +++ b/assets/js/e08a2305.51f3299b.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3021],{3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>d});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),c=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},u=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},l={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),f=c(r),d=o,m=f["".concat(i,".").concat(d)]||f[d]||l[d]||a;return r?n.createElement(m,p(p({ref:t},u),{},{components:r})):n.createElement(m,p({ref:t},u))}));function d(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=f;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:o,p[1]=s;for(var c=2;c{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>p,default:()=>l,frontMatter:()=>a,metadata:()=>s,toc:()=>c});var n=r(87462),o=(r(67294),r(3905));const a={},p="FAQ",s={unversionedId:"support/support",id:"version-v0.9/support/support",title:"FAQ",description:"KusionStack frequently asked questions.",source:"@site/docs_versioned_docs/version-v0.9/support/support.md",sourceDirName:"support",slug:"/support/",permalink:"/docs/v0.9/support/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/support/support.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Roadmap",permalink:"/docs/v0.9/reference/roadmap"},next:{title:"Installation",permalink:"/docs/v0.9/support/install-error"}},i={},c=[],u={toc:c};function l(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"faq"},"FAQ"),(0,o.kt)("p",null,"KusionStack frequently asked questions."))}l.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3021],{3905:(e,t,r)=>{r.d(t,{Zo:()=>u,kt:()=>d});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),c=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):p(p({},t),e)),r},u=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},l={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),f=c(r),d=o,m=f["".concat(i,".").concat(d)]||f[d]||l[d]||a;return r?n.createElement(m,p(p({ref:t},u),{},{components:r})):n.createElement(m,p({ref:t},u))}));function d(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,p=new Array(a);p[0]=f;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:o,p[1]=s;for(var c=2;c{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>p,default:()=>l,frontMatter:()=>a,metadata:()=>s,toc:()=>c});var n=r(87462),o=(r(67294),r(3905));const a={},p="FAQ",s={unversionedId:"support/support",id:"version-v0.9/support/support",title:"FAQ",description:"KusionStack frequently asked questions.",source:"@site/docs_versioned_docs/version-v0.9/support/support.md",sourceDirName:"support",slug:"/support/",permalink:"/docs/v0.9/support/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/support/support.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Roadmap",permalink:"/docs/v0.9/reference/roadmap"},next:{title:"Installation",permalink:"/docs/v0.9/support/install-error"}},i={},c=[],u={toc:c};function l(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},u,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"faq"},"FAQ"),(0,o.kt)("p",null,"KusionStack frequently asked questions."))}l.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e0d4068f.079fd85a.js b/assets/js/e0d4068f.079fd85a.js new file mode 100644 index 00000000000..bd4410b6deb --- /dev/null +++ b/assets/js/e0d4068f.079fd85a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5815],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=o.createContext({}),c=function(e){var t=o.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=c(e.components);return o.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=c(n),m=r,f=d["".concat(l,".").concat(m)]||d[m]||u[m]||a;return n?o.createElement(f,i(i({ref:t},p),{},{components:n})):o.createElement(f,i({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,i=new Array(a);i[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>c});var o=n(87462),r=(n(67294),n(3905));const a={},i="Overview",s={unversionedId:"concepts/kusion-module/overview",id:"version-v0.11/concepts/kusion-module/overview",title:"Overview",description:"A Kusion module is a reusable building block designed by platform engineers to standardize application deployments and enable app developers to self-service. It consists of two parts:",source:"@site/docs_versioned_docs/version-v0.11/3-concepts/3-kusion-module/1-overview.md",sourceDirName:"3-concepts/3-kusion-module",slug:"/concepts/kusion-module/overview",permalink:"/docs/concepts/kusion-module/overview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/3-concepts/3-kusion-module/1-overview.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{},sidebar:"kusion",previous:{title:"Stack file reference",permalink:"/docs/concepts/stack/configuration"},next:{title:"Platform Engineer Develop Guide",permalink:"/docs/concepts/kusion-module/develop-guide"}},l={},c=[],p={toc:c};function u(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,o.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"overview"},"Overview"),(0,r.kt)("p",null,"A Kusion module is a reusable building block designed by platform engineers to standardize application deployments and enable app developers to self-service. It consists of two parts:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"App developer-oriented schema: It is a ",(0,r.kt)("a",{parentName:"li",href:"https://kcl-lang.io/docs/user_docs/guides/schema-definition/"},"KCL schema"),". Fields in this schema are recommended to be understandable to application developers and workspace-agnostic. For example, a database Kusion module schema only contains fields like database engine type and database version."),(0,r.kt)("li",{parentName:"ul"},"Kusion module generator: It is a piece of logic that generates the Intent with an instantiated schema mentioned above, along with platform configurations (",(0,r.kt)("a",{parentName:"li",href:"../workspace"},"workspace"),"). As a building block, Kusion module hides the complexity of infrastructures. A database Kusion module not only represents a cloud RDS, but it also contains logic to configure other resources such as security groups and IAM policies. Additionally, it seamlessly injects the database host address, username, and password into the workload's environment variables. The generator logic can be very complex in some situations so we recommend implementing it in a GPL like ",(0,r.kt)("a",{parentName:"li",href:"https://go.dev/"},"go"),".")),(0,r.kt)("p",null,"Here are some explanations of the Kusion Module:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"It represents an independent unit that provides a specific capability to the application with clear business semantics."),(0,r.kt)("li",{parentName:"ol"},"It consists of one or multiple infrastructure resources (K8s/Terraform resources), but it is not merely a collection of unrelated resources. For instance, a database, monitoring capabilities, and network access are typical Kusion Modules."),(0,r.kt)("li",{parentName:"ol"},"Modules should not have dependencies or be nested within each other."),(0,r.kt)("li",{parentName:"ol"},"AppConfig is not a Module."),(0,r.kt)("li",{parentName:"ol"},"Kusion Module is a superset of ",(0,r.kt)("a",{parentName:"li",href:"https://www.kcl-lang.io/docs/user_docs/guides/package-management/quick-start"},"KPM"),". It leverages the KPM to manage KCL schemas in the Kusion module.")),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kusion-module",src:n(63623).Z,width:"1443",height:"429"})))}u.isMDXComponent=!0},63623:(e,t,n)=>{n.d(t,{Z:()=>o});const o=n.p+"assets/images/kusion-module-635aee19e95fcd57ebebeaa106fa04ee.png"}}]); \ No newline at end of file diff --git a/assets/js/e0d4068f.5a1b5eaa.js b/assets/js/e0d4068f.5a1b5eaa.js deleted file mode 100644 index a13a3f5e5c3..00000000000 --- a/assets/js/e0d4068f.5a1b5eaa.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5815],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=o.createContext({}),c=function(e){var t=o.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},p=function(e){var t=c(e.components);return o.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=c(n),m=r,f=d["".concat(l,".").concat(m)]||d[m]||u[m]||i;return n?o.createElement(f,a(a({ref:t},p),{},{components:n})):o.createElement(f,a({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,a=new Array(i);a[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,a[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var o=n(87462),r=(n(67294),n(3905));const i={},a="Overview",s={unversionedId:"concepts/kusion-module/overview",id:"version-v0.11/concepts/kusion-module/overview",title:"Overview",description:"A Kusion module is a reusable building block designed by platform engineers to standardize application deployments and enable app developers to self-service. It consists of two parts:",source:"@site/docs_versioned_docs/version-v0.11/3-concepts/3-kusion-module/1-overview.md",sourceDirName:"3-concepts/3-kusion-module",slug:"/concepts/kusion-module/overview",permalink:"/docs/concepts/kusion-module/overview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/3-concepts/3-kusion-module/1-overview.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{},sidebar:"kusion",previous:{title:"Stack file reference",permalink:"/docs/concepts/stack/configuration"},next:{title:"Platform Engineer Develop Guide",permalink:"/docs/concepts/kusion-module/develop-guide"}},l={},c=[],p={toc:c};function u(e){let{components:t,...i}=e;return(0,r.kt)("wrapper",(0,o.Z)({},p,i,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"overview"},"Overview"),(0,r.kt)("p",null,"A Kusion module is a reusable building block designed by platform engineers to standardize application deployments and enable app developers to self-service. It consists of two parts:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"App developer-oriented schema: It is a ",(0,r.kt)("a",{parentName:"li",href:"https://kcl-lang.io/docs/user_docs/guides/schema-definition/"},"KCL schema"),". Fields in this schema are recommended to be understandable to application developers and workspace-agnostic. For example, a database Kusion module schema only contains fields like database engine type and database version."),(0,r.kt)("li",{parentName:"ul"},"Kusion module generator: It is a piece of logic that generates the Intent with an instantiated schema mentioned above, along with platform configurations (",(0,r.kt)("a",{parentName:"li",href:"../workspace"},"workspace"),"). As a building block, Kusion module hides the complexity of infrastructures. A database Kusion module not only represents a cloud RDS, but it also contains logic to configure other resources such as security groups and IAM policies. Additionally, it seamlessly injects the database host address, username, and password into the workload's environment variables. The generator logic can be very complex in some situations so we recommend implementing it in a GPL like ",(0,r.kt)("a",{parentName:"li",href:"https://go.dev/"},"go"),".")),(0,r.kt)("p",null,"Here are some explanations of Kusion Module:"),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"It represents an independent unit that provides a specific capability to the application with clear business semantics."),(0,r.kt)("li",{parentName:"ol"},"It consists of one or multiple infrastructure resources (K8s/Terraform resources), but it is not merely a collection of unrelated resources. For instance, a database, monitoring capabilities, and network access are typical Kusion Modules."),(0,r.kt)("li",{parentName:"ol"},"Modules should not have dependencies or be nested within each other."),(0,r.kt)("li",{parentName:"ol"},"AppConfig is not a Module.")),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"kusion-module",src:n(63623).Z,width:"1443",height:"429"})))}u.isMDXComponent=!0},63623:(e,t,n)=>{n.d(t,{Z:()=>o});const o=n.p+"assets/images/kusion-module-635aee19e95fcd57ebebeaa106fa04ee.png"}}]); \ No newline at end of file diff --git a/assets/js/e14874ff.b3f06a1c.js b/assets/js/e14874ff.b3f06a1c.js deleted file mode 100644 index 6ae0fcc0798..00000000000 --- a/assets/js/e14874ff.b3f06a1c.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6061],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>u});var i=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=i.createContext({}),p=function(e){var t=i.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},c=function(e){var t=p(e.components);return i.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},m=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),m=p(n),u=a,k=m["".concat(l,".").concat(u)]||m[u]||d[u]||o;return n?i.createElement(k,r(r({ref:t},c),{},{components:n})):i.createElement(k,r({ref:t},c))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,r=new Array(o);r[0]=m;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,r[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var i=n(87462),a=(n(67294),n(3905));const o={id:"configuration",sidebar_label:"Configuration"},r="Configuration",s={unversionedId:"concepts/configuration",id:"version-v0.11/concepts/configuration",title:"Configuration",description:"Kusion can be configured with some global settings, which are separate from the AppConfiguration written by the application developers and the workspace configurations written by the platform engineers.",source:"@site/docs_versioned_docs/version-v0.11/3-concepts/8-configuration.md",sourceDirName:"3-concepts",slug:"/concepts/configuration",permalink:"/docs/concepts/configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/3-concepts/8-configuration.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:8,frontMatter:{id:"configuration",sidebar_label:"Configuration"},sidebar:"kusion",previous:{title:"Backend",permalink:"/docs/concepts/backend"},next:{title:"How Kusion Works?",permalink:"/docs/concepts/how-kusion-works"}},l={},p=[{value:"Configuration Management",id:"configuration-management",level:2},{value:"Get a Specified Configuration Item",id:"get-a-specified-configuration-item",level:3},{value:"List the Configuration Items",id:"list-the-configuration-items",level:3},{value:"Set a Specified Configuration Item",id:"set-a-specified-configuration-item",level:3},{value:"Unset a Specified Configuration Item",id:"unset-a-specified-configuration-item",level:3},{value:"Backend Configurations",id:"backend-configurations",level:2},{value:"Available Configuration Items",id:"available-configuration-items",level:3}],c={toc:p};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,i.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"configuration"},"Configuration"),(0,a.kt)("p",null,"Kusion can be configured with some global settings, which are separate from the AppConfiguration written by the application developers and the workspace configurations written by the platform engineers. "),(0,a.kt)("p",null,"The configurations are only relevant to the Kusion itself, and can be managed by command ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion config"),". The configuration items are specified, which are in the hierarchical format with full stop for segmentation, such as ",(0,a.kt)("inlineCode",{parentName:"p"},"backends.current"),". For now, only the backend configurations are included."),(0,a.kt)("p",null,"The configuration is stored in the file ",(0,a.kt)("inlineCode",{parentName:"p"},"${KUSION_HOME}/config.yaml"),". For sensitive data, such as password, access key id and secret, setting them in the configuration file is not recommended, using the corresponding environment variables is safer. "),(0,a.kt)("h2",{id:"configuration-management"},"Configuration Management"),(0,a.kt)("p",null,"Kusion provides the command ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion config"),", and its sub-commands ",(0,a.kt)("inlineCode",{parentName:"p"},"get"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"list"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"set"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"unset")," to manage the configuration. The usages are shown as below:"),(0,a.kt)("h3",{id:"get-a-specified-configuration-item"},"Get a Specified Configuration Item"),(0,a.kt)("p",null,"Use ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion config get")," to get the value of a specified configuration item, only the registered item can be obtained correctly. The example is as below."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"# get a configuration item\nkusion config get backends.current\n")),(0,a.kt)("h3",{id:"list-the-configuration-items"},"List the Configuration Items"),(0,a.kt)("p",null,"Use ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion config list")," to list all the Kusion configurations, where the result is in the YAML format. The example is as below."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"# list all the Kusion configurations\nkusion config list\n")),(0,a.kt)("h3",{id:"set-a-specified-configuration-item"},"Set a Specified Configuration Item"),(0,a.kt)("p",null,"Use ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion config set")," to set the value of a specified configuration item, where the type of the value of is also determinate. Kusion supports ",(0,a.kt)("inlineCode",{parentName:"p"},"string"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"int"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"bool"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"array")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"map")," as the value type, which should be conveyed in the following format through CLI."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"string"),": the original format, such as ",(0,a.kt)("inlineCode",{parentName:"li"},"local-dev"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"oss-pre"),";"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"int"),": convert to string, such as ",(0,a.kt)("inlineCode",{parentName:"li"},"3306"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"80"),";"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"bool"),": convert to string, only support ",(0,a.kt)("inlineCode",{parentName:"li"},"true")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"false"),";"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"array"),": convert to string with JSON marshal, such as ",(0,a.kt)("inlineCode",{parentName:"li"},'\'["mysql","oss"]\''),". To preserve the format, enclosing the string content in single quotes is a good idea, or there may be unexpected errors;"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"map"),": convert to string with JSON marshal, such as ",(0,a.kt)("inlineCode",{parentName:"li"},'\'{"path":"\\etc"}\''),".")),(0,a.kt)("p",null,"Besides the type, some configuration items have more setting requirements. The configuration item dependency may exist, that is, a configuration item must be set after another item. And there may exist more restrictions for the configuration values themselves. For example, the valid keys for the map type value, the data range for the int type value. For detailed configuration item information, please refer to the following content of this article."),(0,a.kt)("p",null,"The example of setting configuration item is as blow."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},'# set a configuration item of type string\nkusion config set backends.pre.type mysql\n\n# set a configuration item of type int\nkusion config set backends.pre.configs.port 3306\n\n# set a configuration item of type map\nkusion config set backends.prod `{"configs":{"bucket":"kusion"},"type":"s3"}`\n')),(0,a.kt)("h3",{id:"unset-a-specified-configuration-item"},"Unset a Specified Configuration Item"),(0,a.kt)("p",null,"Use ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion config unset")," to unset a specified configuration item. Be attention, some items have dependencies, which must be unset in a correct order. The example is as below."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"# unset a specified configuration item\nkusion config unset backends.pre\n")),(0,a.kt)("h2",{id:"backend-configurations"},"Backend Configurations"),(0,a.kt)("p",null,"The backend configurations define the place to store Workspace, Spec and State files. Multiple backends and current backend are supported to set."),(0,a.kt)("h3",{id:"available-configuration-items"},"Available Configuration Items"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.current"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the current used backend name. It can be set as the configured backend name. If not set, the default local backend will be used."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"map"),", a total backend configuration, contains type and config items, whose format is as below. It can be unset when the backend is not the current.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'{\n "type": "${backend_type}", # type string, required, support local, mysql, oss, s3.\n "configs": ${backend_configs} # type map, optional for type local, required for the others, the specific keys depend on the type, refer to the description of backends.${name}.configs.\n}\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.type"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the backend type, support ",(0,a.kt)("inlineCode",{parentName:"li"},"local"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"mysql"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"s3")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"oss"),". It can be unset when the backend is not the current, and the corresponding ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.configs")," are empty."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"map"),", the backend config items, whose format depends on the backend type and is as below. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type"),".")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'# type local\n{\n "path": "${local_path}" # type string, optional, the directory to store the files. If not set, use the default path ${KUSION_HOME}.\n}\n\n# type mysql\n {\n "dbName": "${mysql_db_name}", # type string, required, the database name.\n "user": "${mysql_user}", # type string, required, the database user.\n "password": "${mysql_password}", # type string, optional, the database password, which can be also obtained by environment variable KUSION_BACKEND_MYSQL_PASSWORD.\n "host": "${mysql_host}", # type string, required, the database host.\n "port": "${mysql_port}" # type string, optional, the database port. If not set, use the default port 3306.\n }\n\n# type oss\n {\n "endpoint": "${oss_endpoint}", # type string, required, the oss endpoint.\n "accessKeyID": "${oss_access_key_id}", # type string, optional, the oss access key id, which can be also obtained by environment variable OSS_ACCESS_KEY_ID.\n "accessKeySecret": "${oss_access_key_secret}", # type string, optional, the oss access key secret, which can be also obtained by environment variable OSS_ACCESS_KEY_SECRET\n "bucket": "${oss_bucket}", # type string, required, the oss bucket.\n "prefix": "${oss_prefix}" # type string, optional, the prefix to store the files.\n }\n\n # type s3\n {\n "region": "${s3_region}", # type string, optional, the aws region, which can be also obtained by environment variables AWS_REGION and AWS_DEFAULT_REGION.\n "endpoint": "${s3_endpoint}", # type string, optional, the aws endpoint. \n "accessKeyID": "${s3_access_key_id}", # type string, optional, the aws access key id, which can be also obtained by environment variable AWS_ACCESS_KEY_ID.\n "accessKeySecret": "${s3_access_key_secret}", # type string, optional, the aws access key secret, which can be also obtained by environment variable AWS_SECRET_ACCESS_KEY\n "bucket": "${s3_bucket}", # type string, required, the s3 bucket.\n "prefix": "${s3_prefix}" # type string, optional, the prefix to store the files.\n }\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.path"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the path of local type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"local"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.dbName"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the database name of mysql type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"mysql"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.user"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the database user of mysql type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"mysql"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.password"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the database password of mysql type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"mysql"),". It can be also obtained by environment variable ",(0,a.kt)("inlineCode",{parentName:"li"},"KUSION_BACKEND_MYSQL_PASSWORD"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.host"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the database host of mysql type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"mysql"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.port"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"int"),", the database port of mysql type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"mysql"),". If not set, the default value ",(0,a.kt)("inlineCode",{parentName:"li"},"3306")," will be used."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.endpoint"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the endpoint of oss or s3 type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"oss")," or ",(0,a.kt)("inlineCode",{parentName:"li"},"s3"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.accessKeyID"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the access key id of oss or s3 type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"oss")," or ",(0,a.kt)("inlineCode",{parentName:"li"},"s3"),". For ",(0,a.kt)("inlineCode",{parentName:"li"},"oss"),", it can be also obtained by environment variable ",(0,a.kt)("inlineCode",{parentName:"li"},"OSS_ACCESS_KEY_ID"),"; while for s3, it is ",(0,a.kt)("inlineCode",{parentName:"li"},"AWS_ACCESS_KEY_ID"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.accessKeySecret"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the access key secret of oss or s3 type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"oss")," or ",(0,a.kt)("inlineCode",{parentName:"li"},"s3"),". For ",(0,a.kt)("inlineCode",{parentName:"li"},"oss"),", it can be also obtained by environment variable ",(0,a.kt)("inlineCode",{parentName:"li"},"OSS_ACCESS_KEY_SECRET"),"; while for s3, it is ",(0,a.kt)("inlineCode",{parentName:"li"},"AWS_SECRET_ACCESS_KEY"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.bucket"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the bucket of oss or s3 type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"oss")," or ",(0,a.kt)("inlineCode",{parentName:"li"},"s3"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.prefix"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the prefix to store the files of oss or s3 type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"oss")," or ",(0,a.kt)("inlineCode",{parentName:"li"},"s3"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.region"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the aws region of s3 type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"s3"),". It can be also obtained by environment variables ",(0,a.kt)("inlineCode",{parentName:"li"},"AWS_REGION")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"AWS_DEFAULT_REGION"),", where the former is priority.")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e14874ff.c571c778.js b/assets/js/e14874ff.c571c778.js new file mode 100644 index 00000000000..9e0e0b6520a --- /dev/null +++ b/assets/js/e14874ff.c571c778.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6061],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>u});var i=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=i.createContext({}),p=function(e){var t=i.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},c=function(e){var t=p(e.components);return i.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},m=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),m=p(n),u=a,k=m["".concat(l,".").concat(u)]||m[u]||d[u]||o;return n?i.createElement(k,r(r({ref:t},c),{},{components:n})):i.createElement(k,r({ref:t},c))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,r=new Array(o);r[0]=m;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,r[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>p});var i=n(87462),a=(n(67294),n(3905));const o={id:"configuration",sidebar_label:"Configuration"},r="Configuration",s={unversionedId:"concepts/configuration",id:"version-v0.11/concepts/configuration",title:"Configuration",description:"Kusion can be configured with some global settings, which are separate from the AppConfiguration written by the application developers and the workspace configurations written by the platform engineers.",source:"@site/docs_versioned_docs/version-v0.11/3-concepts/8-configuration.md",sourceDirName:"3-concepts",slug:"/concepts/configuration",permalink:"/docs/concepts/configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/3-concepts/8-configuration.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:8,frontMatter:{id:"configuration",sidebar_label:"Configuration"},sidebar:"kusion",previous:{title:"Backend",permalink:"/docs/concepts/backend"},next:{title:"How Kusion Works?",permalink:"/docs/concepts/how-kusion-works"}},l={},p=[{value:"Configuration Management",id:"configuration-management",level:2},{value:"Get a Specified Configuration Item",id:"get-a-specified-configuration-item",level:3},{value:"List the Configuration Items",id:"list-the-configuration-items",level:3},{value:"Set a Specified Configuration Item",id:"set-a-specified-configuration-item",level:3},{value:"Unset a Specified Configuration Item",id:"unset-a-specified-configuration-item",level:3},{value:"Backend Configurations",id:"backend-configurations",level:2},{value:"Available Configuration Items",id:"available-configuration-items",level:3}],c={toc:p};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,i.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"configuration"},"Configuration"),(0,a.kt)("p",null,"Kusion can be configured with some global settings, which are separate from the AppConfiguration written by the application developers and the workspace configurations written by the platform engineers. "),(0,a.kt)("p",null,"The configurations are only relevant to the Kusion itself, and can be managed by command ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion config"),". The configuration items are specified, which are in the hierarchical format with full stop for segmentation, such as ",(0,a.kt)("inlineCode",{parentName:"p"},"backends.current"),". For now, only the backend configurations are included."),(0,a.kt)("p",null,"The configuration is stored in the file ",(0,a.kt)("inlineCode",{parentName:"p"},"${KUSION_HOME}/config.yaml"),". For sensitive data, such as password, access key id and secret, setting them in the configuration file is not recommended, using the corresponding environment variables is safer. "),(0,a.kt)("h2",{id:"configuration-management"},"Configuration Management"),(0,a.kt)("p",null,"Kusion provides the command ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion config"),", and its sub-commands ",(0,a.kt)("inlineCode",{parentName:"p"},"get"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"list"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"set"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"unset")," to manage the configuration. The usages are shown as below:"),(0,a.kt)("h3",{id:"get-a-specified-configuration-item"},"Get a Specified Configuration Item"),(0,a.kt)("p",null,"Use ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion config get")," to get the value of a specified configuration item, only the registered item can be obtained correctly. The example is as below."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"# get a configuration item\nkusion config get backends.current\n")),(0,a.kt)("h3",{id:"list-the-configuration-items"},"List the Configuration Items"),(0,a.kt)("p",null,"Use ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion config list")," to list all the Kusion configurations, where the result is in the YAML format. The example is as below."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"# list all the Kusion configurations\nkusion config list\n")),(0,a.kt)("h3",{id:"set-a-specified-configuration-item"},"Set a Specified Configuration Item"),(0,a.kt)("p",null,"Use ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion config set")," to set the value of a specified configuration item, where the type of the value of is also determinate. Kusion supports ",(0,a.kt)("inlineCode",{parentName:"p"},"string"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"int"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"bool"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"array")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"map")," as the value type, which should be conveyed in the following format through CLI."),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"string"),": the original format, such as ",(0,a.kt)("inlineCode",{parentName:"li"},"local-dev"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"oss-pre"),";"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"int"),": convert to string, such as ",(0,a.kt)("inlineCode",{parentName:"li"},"3306"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"80"),";"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"bool"),": convert to string, only support ",(0,a.kt)("inlineCode",{parentName:"li"},"true")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"false"),";"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"array"),": convert to string with JSON marshal, such as ",(0,a.kt)("inlineCode",{parentName:"li"},'\'["mysql","oss"]\''),". To preserve the format, enclosing the string content in single quotes is a good idea, or there may be unexpected errors;"),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"map"),": convert to string with JSON marshal, such as ",(0,a.kt)("inlineCode",{parentName:"li"},'\'{"path":"\\etc"}\''),".")),(0,a.kt)("p",null,"Besides the type, some configuration items have more setting requirements. The configuration item dependency may exist, that is, a configuration item must be set after another item. And there may exist more restrictions for the configuration values themselves. For example, the valid keys for the map type value, the data range for the int type value. For detailed configuration item information, please refer to the following content of this article."),(0,a.kt)("p",null,"The example of setting configuration item is as blow."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},'# set a configuration item of type string\nkusion config set backends.pre.type mysql\n\n# set a configuration item of type int\nkusion config set backends.pre.configs.port 3306\n\n# set a configuration item of type map\nkusion config set backends.prod `{"configs":{"bucket":"kusion"},"type":"s3"}`\n')),(0,a.kt)("h3",{id:"unset-a-specified-configuration-item"},"Unset a Specified Configuration Item"),(0,a.kt)("p",null,"Use ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion config unset")," to unset a specified configuration item. Be attention, some items have dependencies, which must be unset in a correct order. The example is as below."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"# unset a specified configuration item\nkusion config unset backends.pre\n")),(0,a.kt)("h2",{id:"backend-configurations"},"Backend Configurations"),(0,a.kt)("p",null,"The backend configurations define the place to store Workspace, Spec and State files. Multiple backends and current backend are supported to set."),(0,a.kt)("h3",{id:"available-configuration-items"},"Available Configuration Items"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.current"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the current used backend name. It can be set as the configured backend name. If not set, the default local backend will be used."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"map"),", a total backend configuration, contains type and config items, whose format is as below. It can be unset when the backend is not the current.")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'{\n "type": "${backend_type}", # type string, required, support local, mysql, oss, s3.\n "configs": ${backend_configs} # type map, optional for type local, required for the others, the specific keys depend on the type, refer to the description of backends.${name}.configs.\n}\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.type"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the backend type, support ",(0,a.kt)("inlineCode",{parentName:"li"},"local"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"mysql"),", ",(0,a.kt)("inlineCode",{parentName:"li"},"s3")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"oss"),". It can be unset when the backend is not the current, and the corresponding ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.configs")," are empty."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"map"),", the backend config items, whose format depends on the backend type and is as below. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type"),".")),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'# type local\n{\n "path": "${local_path}" # type string, optional, the directory to store the files. If not set, use the default path ${KUSION_HOME}.\n}\n\n# type mysql\n {\n "dbName": "${mysql_db_name}", # type string, required, the database name.\n "user": "${mysql_user}", # type string, required, the database user.\n "password": "${mysql_password}", # type string, optional, the database password, which can be also obtained by environment variable KUSION_BACKEND_MYSQL_PASSWORD.\n "host": "${mysql_host}", # type string, required, the database host.\n "port": "${mysql_port}" # type string, optional, the database port. If not set, use the default port 3306.\n }\n\n# type oss\n {\n "endpoint": "${oss_endpoint}", # type string, required, the oss endpoint.\n "accessKeyID": "${oss_access_key_id}", # type string, optional, the oss access key id, which can be also obtained by environment variable OSS_ACCESS_KEY_ID.\n "accessKeySecret": "${oss_access_key_secret}", # type string, optional, the oss access key secret, which can be also obtained by environment variable OSS_ACCESS_KEY_SECRET\n "bucket": "${oss_bucket}", # type string, required, the oss bucket.\n "prefix": "${oss_prefix}" # type string, optional, the prefix to store the files.\n }\n\n # type s3\n {\n "region": "${s3_region}", # type string, optional, the aws region, which can be also obtained by environment variables AWS_REGION and AWS_DEFAULT_REGION.\n "endpoint": "${s3_endpoint}", # type string, optional, the aws endpoint. \n "accessKeyID": "${s3_access_key_id}", # type string, optional, the aws access key id, which can be also obtained by environment variable AWS_ACCESS_KEY_ID.\n "accessKeySecret": "${s3_access_key_secret}", # type string, optional, the aws access key secret, which can be also obtained by environment variable AWS_SECRET_ACCESS_KEY\n "bucket": "${s3_bucket}", # type string, required, the s3 bucket.\n "prefix": "${s3_prefix}" # type string, optional, the prefix to store the files.\n }\n')),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.path"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the path of local type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"local"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.dbName"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the database name of mysql type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"mysql"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.user"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the database user of mysql type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"mysql"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.password"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the database password of mysql type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"mysql"),". It can be also obtained by environment variable ",(0,a.kt)("inlineCode",{parentName:"li"},"KUSION_BACKEND_MYSQL_PASSWORD"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.host"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the database host of mysql type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"mysql"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.port"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"int"),", the database port of mysql type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"mysql"),". If not set, the default value ",(0,a.kt)("inlineCode",{parentName:"li"},"3306")," will be used."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.endpoint"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the endpoint of oss or s3 type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"oss")," or ",(0,a.kt)("inlineCode",{parentName:"li"},"s3"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.accessKeyID"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the access key id of oss or s3 type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"oss")," or ",(0,a.kt)("inlineCode",{parentName:"li"},"s3"),". For ",(0,a.kt)("inlineCode",{parentName:"li"},"oss"),", it can be also obtained by environment variable ",(0,a.kt)("inlineCode",{parentName:"li"},"OSS_ACCESS_KEY_ID"),"; while for s3, it is ",(0,a.kt)("inlineCode",{parentName:"li"},"AWS_ACCESS_KEY_ID"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.accessKeySecret"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the access key secret of oss or s3 type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"oss")," or ",(0,a.kt)("inlineCode",{parentName:"li"},"s3"),". For ",(0,a.kt)("inlineCode",{parentName:"li"},"oss"),", it can be also obtained by environment variable ",(0,a.kt)("inlineCode",{parentName:"li"},"OSS_ACCESS_KEY_SECRET"),"; while for s3, it is ",(0,a.kt)("inlineCode",{parentName:"li"},"AWS_SECRET_ACCESS_KEY"),"."),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.bucket"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the bucket of oss or s3 type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"oss")," or ",(0,a.kt)("inlineCode",{parentName:"li"},"s3"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.prefix"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the prefix to store the files of oss or s3 type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"oss")," or ",(0,a.kt)("inlineCode",{parentName:"li"},"s3"),". "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("strong",{parentName:"li"},"backends.${name}.configs.region"),": type ",(0,a.kt)("inlineCode",{parentName:"li"},"string"),", the aws region of s3 type backend. It must be set after ",(0,a.kt)("inlineCode",{parentName:"li"},"backends.${name}.type")," and which must be ",(0,a.kt)("inlineCode",{parentName:"li"},"s3"),". It can be also obtained by environment variables ",(0,a.kt)("inlineCode",{parentName:"li"},"AWS_REGION")," and ",(0,a.kt)("inlineCode",{parentName:"li"},"AWS_DEFAULT_REGION"),", where the former is priority.")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e1b9f8c7.82bd3d24.js b/assets/js/e1b9f8c7.82bd3d24.js new file mode 100644 index 00000000000..f66fdcfaa0f --- /dev/null +++ b/assets/js/e1b9f8c7.82bd3d24.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7626],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=s(n),m=i,k=d["".concat(p,".").concat(m)]||d[m]||c[m]||r;return n?a.createElement(k,o(o({ref:t},u),{},{components:n})):a.createElement(k,o({ref:t},u))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,o=new Array(r);o[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:i,o[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>c,frontMatter:()=>r,metadata:()=>l,toc:()=>s});var a=n(87462),i=(n(67294),n(3905));const r={},o="Set up Operational Rules",l={unversionedId:"user-guides/working-with-k8s/set-up-operational-rules",id:"version-v0.10/user-guides/working-with-k8s/set-up-operational-rules",title:"Set up Operational Rules",description:"You can set up operational rules in the AppConfiguration model via the opsRule field and corresponding platform configurations in the workspace directory. The opsRule is the collection of operational rule requirements for the application that are used as a preemptive measure to police and stop any unwanted changes.",source:"@site/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/6-set-up-operational-rules.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/set-up-operational-rules",permalink:"/docs/v0.10/user-guides/working-with-k8s/set-up-operational-rules",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/6-set-up-operational-rules.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:6,frontMatter:{},sidebar:"kusion",previous:{title:"Configure Resource Specification",permalink:"/docs/v0.10/user-guides/working-with-k8s/resource-spec"},next:{title:"Schedule a Job",permalink:"/docs/v0.10/user-guides/working-with-k8s/job"}},p={},s=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],u={toc:s};function c(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"set-up-operational-rules"},"Set up Operational Rules"),(0,i.kt)("p",null,"You can set up operational rules in the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model via the ",(0,i.kt)("inlineCode",{parentName:"p"},"opsRule")," field and corresponding platform configurations in the workspace directory. The ",(0,i.kt)("inlineCode",{parentName:"p"},"opsRule")," is the collection of operational rule requirements for the application that are used as a preemptive measure to police and stop any unwanted changes."),(0,i.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,i.kt)("p",null,"Please refer to the ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,i.kt)("p",null,"The example below also requires you to have ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,i.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,i.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,i.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,i.kt)("p",null,"However, if you (or the platform team) would like to set default values for the opsRule to standardize the behavior of applications, you can do so by updating the ",(0,i.kt)("inlineCode",{parentName:"p"},"~/dev.yaml"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n opsRule:\n default:\n maxUnavailable: "40%"\n')),(0,i.kt)("p",null,"Please note that the ",(0,i.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," in the workspace configuration only works as a default value and will be overridden by the value set in the application configuration."),(0,i.kt)("p",null,"The workspace configuration need to be updated with the command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace update dev -f ~/dev.yaml\n")),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"If the platform engineers have set the default workload to ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/operating"},"Kusion Operation")," and installed the Kusion Operation controllers properly, the ",(0,i.kt)("inlineCode",{parentName:"p"},"opsRules")," module will generate a ",(0,i.kt)("a",{parentName:"p",href:"https://www.kusionstack.io/docs/operating/manuals/podtransitionrule"},"PodTransitionRule")," instead of updating the ",(0,i.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," value in the deployment")),(0,i.kt)("h2",{id:"example"},"Example"),(0,i.kt)("p",null,"Add the ",(0,i.kt)("inlineCode",{parentName:"p"},"opsRule")," snippet to the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," in ",(0,i.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-py"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.trait as t\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Service {\n ...\n }\n # Configure the maxUnavailable rule\n opsRule = t.OpsRule {\n maxUnavailable: "30%"\n }\n}\n')),(0,i.kt)("h2",{id:"applying"},"Applying"),(0,i.kt)("p",null,"Re-run steps in ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", resource scaling is completed."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"$ kusion apply\n\u2714\ufe0e Generating Intent in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private UnChanged\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Update\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS UnChanged v1:Service:simple-service:simple-service-dev-helloworld-private, skip \n SUCCESS Update apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \nUpdate apps/v1:Deployment:simple-service:simple-service-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,i.kt)("h2",{id:"validation"},"Validation"),(0,i.kt)("p",null,"We can verify the application deployment strategy now has the updated attributes ",(0,i.kt)("inlineCode",{parentName:"p"},"maxUnavailable: 30%")," in the container configuration:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"kubectl get deployment -n simple-service -o yaml\n...\napiVersion: apps/v1\n kind: Deployment\n...\n spec:\n strategy:\n rollingUpdate:\n maxUnavailable: 30%\n type: RollingUpdate\n\n...\n")))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e1b9f8c7.890bb2d6.js b/assets/js/e1b9f8c7.890bb2d6.js deleted file mode 100644 index ac61acb3ad1..00000000000 --- a/assets/js/e1b9f8c7.890bb2d6.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7626],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,i=e.mdxType,r=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=s(n),m=i,h=d["".concat(p,".").concat(m)]||d[m]||c[m]||r;return n?a.createElement(h,o(o({ref:t},u),{},{components:n})):a.createElement(h,o({ref:t},u))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var r=n.length,o=new Array(r);o[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:i,o[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>c,frontMatter:()=>r,metadata:()=>l,toc:()=>s});var a=n(87462),i=(n(67294),n(3905));const r={},o="Set up Operational Rules",l={unversionedId:"user-guides/working-with-k8s/set-up-operational-rules",id:"version-v0.10/user-guides/working-with-k8s/set-up-operational-rules",title:"Set up Operational Rules",description:"You can set up operational rules in the AppConfiguration model via the opsRule field and corresponding platform configurations in the workspace directory. The opsRule is the collection of operational rule requirements for the application that are used as a preemptive measure to police and stop any unwanted changes.",source:"@site/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/6-set-up-operational-rules.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/set-up-operational-rules",permalink:"/docs/v0.10/user-guides/working-with-k8s/set-up-operational-rules",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/6-set-up-operational-rules.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:6,frontMatter:{},sidebar:"kusion",previous:{title:"Configure Resource Specification",permalink:"/docs/v0.10/user-guides/working-with-k8s/resource-spec"},next:{title:"Schedule a Job",permalink:"/docs/v0.10/user-guides/working-with-k8s/job"}},p={},s=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],u={toc:s};function c(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"set-up-operational-rules"},"Set up Operational Rules"),(0,i.kt)("p",null,"You can set up operational rules in the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model via the ",(0,i.kt)("inlineCode",{parentName:"p"},"opsRule")," field and corresponding platform configurations in the workspace directory. The ",(0,i.kt)("inlineCode",{parentName:"p"},"opsRule")," is the collection of operational rule requirements for the application that are used as a preemptive measure to police and stop any unwanted changes."),(0,i.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,i.kt)("p",null,"Please refer to the ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,i.kt)("p",null,"The example below also requires you to have ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,i.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,i.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,i.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,i.kt)("p",null,"However, if you (or the platform team) would like to set default values for the opsRule to standardize the behavior of applications, you can do so by updating the ",(0,i.kt)("inlineCode",{parentName:"p"},"~/dev.yaml"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n opsRule:\n default:\n maxUnavailable: "40%"\n')),(0,i.kt)("p",null,"Please note that the ",(0,i.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," in the workspace configuration only works as a default value and will be overridden by the value set in the application configuration."),(0,i.kt)("p",null,"The workspace configuration need to be updated with the command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace update dev -f ~/dev.yaml\n")),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"If the platform engineers have set the default workload to ",(0,i.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/operating"},"Kusion Operation")," and installed the Kusion Operation controllers properly, the ",(0,i.kt)("inlineCode",{parentName:"p"},"opsRules")," module will generate a ",(0,i.kt)("a",{parentName:"p",href:"https://www.kusionstack.io/docs/operating/manuals/podtransitionrule"},"PodTransitionRule")," instead of updating the ",(0,i.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," value in the deployment")),(0,i.kt)("h2",{id:"example"},"Example"),(0,i.kt)("p",null,"Add the ",(0,i.kt)("inlineCode",{parentName:"p"},"opsRule")," snippet to the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," in ",(0,i.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-py"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.trait as t\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Service {\n ...\n }\n # Configure the maxUnavailable rule\n opsRule = t.OpsRule {\n maxUnavailable: "30%"\n }\n}\n')),(0,i.kt)("h2",{id:"applying"},"Applying"),(0,i.kt)("p",null,"Re-run steps in ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", resource scaling is completed."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"$ kusion apply\n\u2714\ufe0e Generating Intent in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private UnChanged\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Update\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS UnChanged v1:Service:simple-service:simple-service-dev-helloworld-private, skip \n SUCCESS Update apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \nUpdate apps/v1:Deployment:simple-service:simple-service-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,i.kt)("h2",{id:"validation"},"Validation"),(0,i.kt)("p",null,"We can verify the application deployment strategy now has the updated attributes ",(0,i.kt)("inlineCode",{parentName:"p"},"maxUnavailable: 30%")," in the container configuration:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-shell"},"kubectl get deployment -n simple-service -o yaml\n...\napiVersion: apps/v1\n kind: Deployment\n...\n spec:\n strategy:\n rollingUpdate:\n maxUnavailable: 30%\n type: RollingUpdate\n\n...\n")))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e1c24df0.5dc84bae.js b/assets/js/e1c24df0.9cbd257d.js similarity index 54% rename from assets/js/e1c24df0.5dc84bae.js rename to assets/js/e1c24df0.9cbd257d.js index 560815d5b15..8ba062ac9aa 100644 --- a/assets/js/e1c24df0.5dc84bae.js +++ b/assets/js/e1c24df0.9cbd257d.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2195],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>k});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=c(n),k=a,m=d["".concat(s,".").concat(k)]||d[k]||u[k]||o;return n?r.createElement(m,l(l({ref:t},p),{},{components:n})):r.createElement(m,l({ref:t},p))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const o={},l="network",i={unversionedId:"reference/modules/workspace-configs/networking/network",id:"version-v0.11/reference/modules/workspace-configs/networking/network",title:"network",description:"network can be used to define workspace-level networking configurations.",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/networking/network.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/networking",slug:"/reference/modules/workspace-configs/networking/network",permalink:"/docs/reference/modules/workspace-configs/networking/network",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/networking/network.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"monitoring",permalink:"/docs/reference/modules/workspace-configs/monitoring/prometheus"},next:{title:"opsrule",permalink:"/docs/reference/modules/workspace-configs/opsrule/"}},s={},c=[{value:"Attributes",id:"attributes",level:2},{value:"Examples",id:"examples",level:3}],p={toc:c};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"network"},"network"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"network")," can be used to define workspace-level networking configurations."),(0,a.kt)("h2",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"type"),(0,a.kt)("br",null),"The specific cloud vendor that provides load balancer."),(0,a.kt)("td",{parentName:"tr",align:null},'"alicloud" ',"|",' "aws"'),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels"),(0,a.kt)("br",null),"The attached labels of the port."),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations"),(0,a.kt)("br",null),"The attached annotations of the port."),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n kusionstack/network@0.1.0:\n default:\n type: alicloud\n labels:\n kusionstack.io/control: "true"\n annotations:\n service.beta.kubernetes.io/alibaba-cloud-loadbalancer-spec: slb.s1.small\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2195],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>k});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),c=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=c(n),k=a,m=d["".concat(s,".").concat(k)]||d[k]||u[k]||o;return n?r.createElement(m,l(l({ref:t},p),{},{components:n})):r.createElement(m,l({ref:t},p))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=d;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>u,frontMatter:()=>o,metadata:()=>i,toc:()=>c});var r=n(87462),a=(n(67294),n(3905));const o={},l="network",i={unversionedId:"reference/modules/workspace-configs/networking/network",id:"version-v0.11/reference/modules/workspace-configs/networking/network",title:"network",description:"network can be used to define workspace-level networking configurations.",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/networking/network.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/networking",slug:"/reference/modules/workspace-configs/networking/network",permalink:"/docs/reference/modules/workspace-configs/networking/network",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/networking/network.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"monitoring",permalink:"/docs/reference/modules/workspace-configs/monitoring/prometheus"},next:{title:"opsrule",permalink:"/docs/reference/modules/workspace-configs/opsrule/"}},s={},c=[{value:"Attributes",id:"attributes",level:2},{value:"Examples",id:"examples",level:3}],p={toc:c};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"network"},"network"),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"network")," can be used to define workspace-level networking configurations."),(0,a.kt)("h2",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"type"),(0,a.kt)("br",null),"The specific cloud vendor that provides load balancer."),(0,a.kt)("td",{parentName:"tr",align:null},'"alicloud" ',"|",' "aws"'),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"required"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"labels"),(0,a.kt)("br",null),"The attached labels of the port."),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"annotations"),(0,a.kt)("br",null),"The attached annotations of the port."),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n kusionstack/network@0.1.0:\n default:\n type: alicloud\n labels:\n kusionstack.io/control: "true"\n annotations:\n service.beta.kubernetes.io/alibaba-cloud-loadbalancer-spec: slb.s1.small\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e31dd6e1.a71cef1b.js b/assets/js/e31dd6e1.a71cef1b.js deleted file mode 100644 index 32d6aa4d20e..00000000000 --- a/assets/js/e31dd6e1.a71cef1b.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8708],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>g});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=o.createContext({}),c=function(e){var t=o.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},s=function(e){var t=c(e.components);return o.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),d=c(n),g=r,m=d["".concat(l,".").concat(g)]||d[g]||u[g]||i;return n?o.createElement(m,a(a({ref:t},s),{},{components:n})):o.createElement(m,a({ref:t},s))}));function g(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,a=new Array(i);a[0]=d;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p.mdxType="string"==typeof e?e:r,a[1]=p;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>p,toc:()=>c});var o=n(87462),r=(n(67294),n(3905));const i={id:"networking"},a="Application Networking",p={unversionedId:"configuration-walkthrough/networking",id:"version-v0.10/configuration-walkthrough/networking",title:"Application Networking",description:"In addition to configuring application's container specifications, you can also configure its networking behaviors, including how to expose the application and how it can be accessed.",source:"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/5-networking.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/networking",permalink:"/docs/v0.10/configuration-walkthrough/networking",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/5-networking.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:5,frontMatter:{id:"networking"},sidebar:"kusion",previous:{title:"Workload",permalink:"/docs/v0.10/configuration-walkthrough/workload"},next:{title:"Managed Databases",permalink:"/docs/v0.10/configuration-walkthrough/databse"}},l={},c=[{value:"Import",id:"import",level:2},{value:"Private vs Public Access",id:"private-vs-public-access",level:2},{value:"Mapping ports",id:"mapping-ports",level:2},{value:"Exposing multiple ports",id:"exposing-multiple-ports",level:2},{value:"Choosing protocol",id:"choosing-protocol",level:2}],s={toc:c};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,o.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"application-networking"},"Application Networking"),(0,r.kt)("p",null,"In addition to configuring application's ",(0,r.kt)("a",{parentName:"p",href:"workload#configure-containers"},"container specifications"),", you can also configure its networking behaviors, including how to expose the application and how it can be accessed."),(0,r.kt)("p",null,"In future versions, this will also include ingress-based routing strategy and DNS configurations."),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"catalog")," package. For more details on KCL package import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.network as n\n")),(0,r.kt)("h2",{id:"private-vs-public-access"},"Private vs Public Access"),(0,r.kt)("p",null,"Private network access means the service can only be access from within the target cluster."),(0,r.kt)("p",null,"Public access is implemented using public load balancers on the cloud. This generally requires a Kubernetes cluster that is running on the cloud with a vendor-specific service controller."),(0,r.kt)("p",null,"Any ports defined default to private access unless explicitly specified."),(0,r.kt)("p",null,"To expose port 80 to be accessed privately:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n}\n")),(0,r.kt)("p",null,"To expose port 80 to be accessed publicly:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n ports: [\n n.Port {\n port: 80\n public: True\n }\n ]\n }\n}\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"The CSP (Cloud Service Provider) used to provide load balancers is defined by platform engineers in workspace.")),(0,r.kt)("h2",{id:"mapping-ports"},"Mapping ports"),(0,r.kt)("p",null,"To expose a port ",(0,r.kt)("inlineCode",{parentName:"p"},"80")," that maps to a different port ",(0,r.kt)("inlineCode",{parentName:"p"},"8088")," on the container:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n ports: [\n n.Port {\n port: 80\n targetPort: 8088\n }\n ]\n }\n}\n")),(0,r.kt)("h2",{id:"exposing-multiple-ports"},"Exposing multiple ports"),(0,r.kt)("p",null,"You can also expose multiple ports and configure them separately. "),(0,r.kt)("p",null,"To expose port 80 to be accessed publicly, and port 9099 for private access (to be scraped by Prometheus, for example):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n ports: [\n n.Port {\n port: 80\n public: True\n }\n n.Port {\n port: 9099\n }\n ]\n }\n}\n")),(0,r.kt)("h2",{id:"choosing-protocol"},"Choosing protocol"),(0,r.kt)("p",null,"To expose a port using the ",(0,r.kt)("inlineCode",{parentName:"p"},"UDP")," protocol:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n ports: [\n n.Port {\n port: 80\n targetPort: 8088\n protocol: "UDP"\n }\n ]\n }\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e31dd6e1.f180556b.js b/assets/js/e31dd6e1.f180556b.js new file mode 100644 index 00000000000..35488a2a8d9 --- /dev/null +++ b/assets/js/e31dd6e1.f180556b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8708],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>g});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=o.createContext({}),c=function(e){var t=o.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},s=function(e){var t=c(e.components);return o.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,l=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),d=c(n),g=r,m=d["".concat(l,".").concat(g)]||d[g]||u[g]||i;return n?o.createElement(m,a(a({ref:t},s),{},{components:n})):o.createElement(m,a({ref:t},s))}));function g(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,a=new Array(i);a[0]=d;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p.mdxType="string"==typeof e?e:r,a[1]=p;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>p,toc:()=>c});var o=n(87462),r=(n(67294),n(3905));const i={id:"networking"},a="Application Networking",p={unversionedId:"configuration-walkthrough/networking",id:"version-v0.10/configuration-walkthrough/networking",title:"Application Networking",description:"In addition to configuring application's container specifications, you can also configure its networking behaviors, including how to expose the application and how it can be accessed.",source:"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/5-networking.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/networking",permalink:"/docs/v0.10/configuration-walkthrough/networking",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/5-networking.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:5,frontMatter:{id:"networking"},sidebar:"kusion",previous:{title:"Workload",permalink:"/docs/v0.10/configuration-walkthrough/workload"},next:{title:"Managed Databases",permalink:"/docs/v0.10/configuration-walkthrough/databse"}},l={},c=[{value:"Import",id:"import",level:2},{value:"Private vs Public Access",id:"private-vs-public-access",level:2},{value:"Mapping ports",id:"mapping-ports",level:2},{value:"Exposing multiple ports",id:"exposing-multiple-ports",level:2},{value:"Choosing protocol",id:"choosing-protocol",level:2}],s={toc:c};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,o.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"application-networking"},"Application Networking"),(0,r.kt)("p",null,"In addition to configuring application's ",(0,r.kt)("a",{parentName:"p",href:"workload#configure-containers"},"container specifications"),", you can also configure its networking behaviors, including how to expose the application and how it can be accessed."),(0,r.kt)("p",null,"In future versions, this will also include ingress-based routing strategy and DNS configurations."),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"catalog")," package. For more details on KCL package import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.network as n\n")),(0,r.kt)("h2",{id:"private-vs-public-access"},"Private vs Public Access"),(0,r.kt)("p",null,"Private network access means the service can only be access from within the target cluster."),(0,r.kt)("p",null,"Public access is implemented using public load balancers on the cloud. This generally requires a Kubernetes cluster that is running on the cloud with a vendor-specific service controller."),(0,r.kt)("p",null,"Any ports defined default to private access unless explicitly specified."),(0,r.kt)("p",null,"To expose port 80 to be accessed privately:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n}\n")),(0,r.kt)("p",null,"To expose port 80 to be accessed publicly:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n ports: [\n n.Port {\n port: 80\n public: True\n }\n ]\n }\n}\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"The CSP (Cloud Service Provider) used to provide load balancers is defined by platform engineers in workspace.")),(0,r.kt)("h2",{id:"mapping-ports"},"Mapping ports"),(0,r.kt)("p",null,"To expose a port ",(0,r.kt)("inlineCode",{parentName:"p"},"80")," that maps to a different port ",(0,r.kt)("inlineCode",{parentName:"p"},"8088")," on the container:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n ports: [\n n.Port {\n port: 80\n targetPort: 8088\n }\n ]\n }\n}\n")),(0,r.kt)("h2",{id:"exposing-multiple-ports"},"Exposing multiple ports"),(0,r.kt)("p",null,"You can also expose multiple ports and configure them separately. "),(0,r.kt)("p",null,"To expose port 80 to be accessed publicly, and port 9099 for private access (to be scraped by Prometheus, for example):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n ports: [\n n.Port {\n port: 80\n public: True\n }\n n.Port {\n port: 9099\n }\n ]\n }\n}\n")),(0,r.kt)("h2",{id:"choosing-protocol"},"Choosing protocol"),(0,r.kt)("p",null,"To expose a port using the ",(0,r.kt)("inlineCode",{parentName:"p"},"UDP")," protocol:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n ports: [\n n.Port {\n port: 80\n targetPort: 8088\n protocol: "UDP"\n }\n ]\n }\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e3966691.b0802950.js b/assets/js/e3966691.b0802950.js deleted file mode 100644 index 3d656ca07ec..00000000000 --- a/assets/js/e3966691.b0802950.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3975],{3905:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},m=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,m=s(e,["components","mdxType","originalType","parentName"]),u=c(n),d=o,f=u["".concat(l,".").concat(d)]||u[d]||p[d]||i;return n?r.createElement(f,a(a({ref:t},m),{},{components:n})):r.createElement(f,a({ref:t},m))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=u;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>p,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var r=n(87462),o=(n(67294),n(3905));const i={},a="kusion mod init",s={unversionedId:"reference/commands/kusion-mod-init",id:"reference/commands/kusion-mod-init",title:"kusion mod init",description:"Create a kusion module along with common files and directories in the current directory",source:"@site/docs/kusion/6-reference/1-commands/kusion-mod-init.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-mod-init",permalink:"/docs/next/reference/commands/kusion-mod-init",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-mod-init.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion init",permalink:"/docs/next/reference/commands/kusion-init"},next:{title:"kusion mod push",permalink:"/docs/next/reference/commands/kusion-mod-push"}},l={},c=[{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],m={toc:c};function p(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-mod-init"},"kusion mod init"),(0,o.kt)("p",null,"Create a kusion module along with common files and directories in the current directory"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion mod init [MODULE NAME] [PATH] [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Create a kusion module template in the current directory\n kusion mod init my-module\n \n # Init a kusion module at the specified Path\n kusion mod init my-module ./modules\n \n # Init a module from a remote git template repository\n kusion mod init my-module --template https://github.com//\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for init\n --template string Initialize with specified template\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-mod"},"kusion mod"),"\t - Manage Kusion modules")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e3966691.daa202c5.js b/assets/js/e3966691.daa202c5.js new file mode 100644 index 00000000000..a49e884f110 --- /dev/null +++ b/assets/js/e3966691.daa202c5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3975],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>d});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},m=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),m=c(n),d=o,f=m["".concat(l,".").concat(d)]||m[d]||u[d]||i;return n?r.createElement(f,a(a({ref:t},p),{},{components:n})):r.createElement(f,a({ref:t},p))}));function d(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=m;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var r=n(87462),o=(n(67294),n(3905));const i={},a="kusion mod init",s={unversionedId:"reference/commands/kusion-mod-init",id:"reference/commands/kusion-mod-init",title:"kusion mod init",description:"Create a kusion module along with common files and directories in the current directory",source:"@site/docs/kusion/6-reference/1-commands/kusion-mod-init.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-mod-init",permalink:"/docs/next/reference/commands/kusion-mod-init",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-mod-init.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion init",permalink:"/docs/next/reference/commands/kusion-init"},next:{title:"kusion mod push",permalink:"/docs/next/reference/commands/kusion-mod-push"}},l={},c=[{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:c};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-mod-init"},"kusion mod init"),(0,o.kt)("p",null,"Create a kusion module along with common files and directories in the current directory"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion mod init [MODULE NAME] [PATH] [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Create a kusion module template in the current directory\n kusion mod init my-module\n \n # Init a kusion module at the specified Path\n kusion mod init my-module ./modules\n \n # Init a module from a remote git template repository\n kusion mod init my-module --template https://github.com//\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for init\n --template string Initialize with specified template\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-mod"},"kusion mod"),"\t - Manage Kusion modules")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e4f1eb77.dbe0b5ca.js b/assets/js/e4f1eb77.dbe0b5ca.js new file mode 100644 index 00000000000..1183fe8fb51 --- /dev/null +++ b/assets/js/e4f1eb77.dbe0b5ca.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2636],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var r=t(67294);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var s=r.createContext({}),l=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=l(e.components);return r.createElement(s.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),u=l(t),m=i,k=u["".concat(s,".").concat(m)]||u[m]||d[m]||a;return t?r.createElement(k,o(o({ref:n},c),{},{components:t})):r.createElement(k,o({ref:n},c))}));function m(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var a=t.length,o=new Array(a);o[0]=u;var p={};for(var s in n)hasOwnProperty.call(n,s)&&(p[s]=n[s]);p.originalType=e,p.mdxType="string"==typeof e?e:i,o[1]=p;for(var l=2;l{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>p,toc:()=>l});var r=t(87462),i=(t(67294),t(3905));const a={id:"service"},o="Expose Service",p={unversionedId:"user-guides/working-with-k8s/service",id:"user-guides/working-with-k8s/service",title:"Expose Service",description:"You can determine how to expose your service in the AppConfiguration model via the ports field (under the network accessory). The ports field defines a list of all the Ports you want to expose for the application (and their corresponding listening ports on the container, if they don't match the service ports), so that it can be consumed by other applications.",source:"@site/docs/kusion/5-user-guides/2-working-with-k8s/3-service.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/service",permalink:"/docs/next/user-guides/working-with-k8s/service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/5-user-guides/2-working-with-k8s/3-service.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{id:"service"},sidebar:"kusion",previous:{title:"Configure Containers",permalink:"/docs/next/user-guides/working-with-k8s/container"},next:{title:"Upgrade Image",permalink:"/docs/next/user-guides/working-with-k8s/image-upgrade"}},s={},l=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],c={toc:l};function d(e){let{components:n,...a}=e;return(0,i.kt)("wrapper",(0,r.Z)({},c,a,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"expose-service"},"Expose Service"),(0,i.kt)("p",null,"You can determine how to expose your service in the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model via the ",(0,i.kt)("inlineCode",{parentName:"p"},"ports")," field (under the ",(0,i.kt)("inlineCode",{parentName:"p"},"network")," accessory). The ",(0,i.kt)("inlineCode",{parentName:"p"},"ports")," field defines a list of all the ",(0,i.kt)("inlineCode",{parentName:"p"},"Port"),"s you want to expose for the application (and their corresponding listening ports on the container, if they don't match the service ports), so that it can be consumed by other applications."),(0,i.kt)("p",null,"Unless explicitly defined, each of the ports exposed is by default exposed privately as a ",(0,i.kt)("inlineCode",{parentName:"p"},"ClusterIP")," type service. You can expose a port publicly by specifying the ",(0,i.kt)("inlineCode",{parentName:"p"},"public")," field in the ",(0,i.kt)("inlineCode",{parentName:"p"},"Port")," schema. At the moment, the implementation for publicly access is done via Load Balancer type service backed by cloud providers. Ingress will be supported in a future version of kusion."),(0,i.kt)("p",null,"For the ",(0,i.kt)("inlineCode",{parentName:"p"},"Port")," schema reference, please see ",(0,i.kt)("a",{parentName:"p",href:"../../reference/modules/developer-schemas/workload/service#schema-port"},"here")," for more details."),(0,i.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,i.kt)("p",null,"Please refer to the ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,i.kt)("p",null,"The example below also requires you to have ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,i.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,i.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,i.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,i.kt)("p",null,"However, if you (or the platform team) would like to set default values for the services to standardize the behavior of applications in the ",(0,i.kt)("inlineCode",{parentName:"p"},"dev")," workspace, you can do so by updating the ",(0,i.kt)("inlineCode",{parentName:"p"},"~/dev.yaml"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n kusionstack/network@0.1.0: \n default:\n port: \n type: alicloud\n labels:\n kusionstack.io/control: "true"\n annotations:\n service.beta.kubernetes.io/alibaba-cloud-loadbalancer-spec: slb.s1.small\n')),(0,i.kt)("p",null,"The workspace configuration need to be updated with the command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace update dev -f ~/dev.yaml\n")),(0,i.kt)("p",null,"For a full reference of what can be configured in the workspace level, please see the ",(0,i.kt)("a",{parentName:"p",href:"../../reference/modules/workspace-configs/networking/network"},"workspace reference"),"."),(0,i.kt)("h2",{id:"example"},"Example"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\n\n"helloworld": ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "helloworld": c.Container {\n image = "gcr.io/google-samples/gb-frontend:v4"\n env: {\n "env1": "VALUE"\n "env2": "VALUE2"\n }\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n # Configure an HTTP readiness probe\n readinessProbe: p.Probe {\n probeHandler: p.Http {\n url: "http://localhost:80"\n }\n initialDelaySeconds: 10\n }\n }\n }\n replicas: 2\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 8080\n targetPort: 80\n }\n ]\n }\n }\n}\n')),(0,i.kt)("p",null,"The code above changes the service port to expose from ",(0,i.kt)("inlineCode",{parentName:"p"},"80")," in the last guide to ",(0,i.kt)("inlineCode",{parentName:"p"},"8080"),", but still targeting the container port ",(0,i.kt)("inlineCode",{parentName:"p"},"80")," because that's what the application is listening on."),(0,i.kt)("h2",{id:"applying"},"Applying"),(0,i.kt)("p",null,"Re-run steps in ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", new service configuration can be applied."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private Update\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld UnChanged\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS Update v1:Service:simple-service:simple-service-dev-helloworld-private success \n SUCCESS UnChanged apps/v1:Deployment:simple-service:simple-service-dev-helloworld, skip \nUnChanged apps/v1:Deployment:simple-service:simple-service-dev-helloworld, skip [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,i.kt)("h2",{id:"validation"},"Validation"),(0,i.kt)("p",null,"We can verify the Kubernetes service now has the updated attributes (mapping service port 8080 to container port 80) as defined in the ",(0,i.kt)("inlineCode",{parentName:"p"},"ports")," configuration:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"kubectl get svc -n simple-service -o yaml\n...\n spec:\n ...\n ports:\n - name: simple-service-dev-helloworld-private-8080-tcp\n port: 8080\n protocol: TCP\n targetPort: 80\n...\n")),(0,i.kt)("p",null,"Exposing service port 8080:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"kubectl port-forward svc/simple-service-dev-helloworld-private -n simple-service 30000:8080\n")),(0,i.kt)("p",null,"Open browser and visit ",(0,i.kt)("a",{parentName:"p",href:"http://127.0.0.1:30000"},"http://127.0.0.1:30000"),", the application should be up and running\uff1a"),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"app-preview",src:t(92287).Z,width:"1830",height:"330"})))}d.isMDXComponent=!0},92287:(e,n,t)=>{t.d(n,{Z:()=>r});const r=t.p+"assets/images/app-preview-de5274f4267fa725d2a65099e47c6c2c.png"}}]); \ No newline at end of file diff --git a/assets/js/e4f1eb77.e6514259.js b/assets/js/e4f1eb77.e6514259.js deleted file mode 100644 index 97bf34575b0..00000000000 --- a/assets/js/e4f1eb77.e6514259.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2636],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var r=t(67294);function i(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function o(e){for(var n=1;n=0||(i[t]=e[t]);return i}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(i[t]=e[t])}return i}var s=r.createContext({}),l=function(e){var n=r.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=l(e.components);return r.createElement(s.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},u=r.forwardRef((function(e,n){var t=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),u=l(t),m=i,k=u["".concat(s,".").concat(m)]||u[m]||d[m]||a;return t?r.createElement(k,o(o({ref:n},c),{},{components:t})):r.createElement(k,o({ref:n},c))}));function m(e,n){var t=arguments,i=n&&n.mdxType;if("string"==typeof e||i){var a=t.length,o=new Array(a);o[0]=u;var p={};for(var s in n)hasOwnProperty.call(n,s)&&(p[s]=n[s]);p.originalType=e,p.mdxType="string"==typeof e?e:i,o[1]=p;for(var l=2;l{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>p,toc:()=>l});var r=t(87462),i=(t(67294),t(3905));const a={id:"service"},o="Expose Service",p={unversionedId:"user-guides/working-with-k8s/service",id:"user-guides/working-with-k8s/service",title:"Expose Service",description:"You can determine how to expose your service in the AppConfiguration model via the ports field (under the network accessory). The ports field defines a list of all the Ports you want to expose for the application (and their corresponding listening ports on the container, if they don't match the service ports), so that it can be consumed by other applications.",source:"@site/docs/kusion/5-user-guides/2-working-with-k8s/3-service.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/service",permalink:"/docs/next/user-guides/working-with-k8s/service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/5-user-guides/2-working-with-k8s/3-service.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{id:"service"},sidebar:"kusion",previous:{title:"Configure Containers",permalink:"/docs/next/user-guides/working-with-k8s/container"},next:{title:"Upgrade Image",permalink:"/docs/next/user-guides/working-with-k8s/image-upgrade"}},s={},l=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],c={toc:l};function d(e){let{components:n,...a}=e;return(0,i.kt)("wrapper",(0,r.Z)({},c,a,{components:n,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"expose-service"},"Expose Service"),(0,i.kt)("p",null,"You can determine how to expose your service in the ",(0,i.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model via the ",(0,i.kt)("inlineCode",{parentName:"p"},"ports")," field (under the ",(0,i.kt)("inlineCode",{parentName:"p"},"network")," accessory). The ",(0,i.kt)("inlineCode",{parentName:"p"},"ports")," field defines a list of all the ",(0,i.kt)("inlineCode",{parentName:"p"},"Port"),"s you want to expose for the application (and their corresponding listening ports on the container, if they don't match the service ports), so that it can be consumed by other applications."),(0,i.kt)("p",null,"Unless explicitly defined, each of the ports exposed is by default exposed privately as a ",(0,i.kt)("inlineCode",{parentName:"p"},"ClusterIP")," type service. You can expose a port publicly by specifying the ",(0,i.kt)("inlineCode",{parentName:"p"},"public")," field in the ",(0,i.kt)("inlineCode",{parentName:"p"},"Port")," schema. At the moment, the implementation for publicly access is done via Load Balancer type service backed by cloud providers. Ingress will be supported in a future version of kusion."),(0,i.kt)("p",null,"For the ",(0,i.kt)("inlineCode",{parentName:"p"},"Port")," schema reference, please see ",(0,i.kt)("a",{parentName:"p",href:"../../reference/modules/developer-schemas/workload/service#schema-port"},"here")," for more details."),(0,i.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,i.kt)("p",null,"Please refer to the ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,i.kt)("p",null,"The example below also requires you to have ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,i.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,i.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,i.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,i.kt)("p",null,"However, if you (or the platform team) would like to set default values for the services to standardize the behavior of applications in the ",(0,i.kt)("inlineCode",{parentName:"p"},"dev")," workspace, you can do so by updating the ",(0,i.kt)("inlineCode",{parentName:"p"},"~/dev.yaml"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-yaml"},'modules:\n kusionstack/network@0.1.0: \n default:\n port: \n type: alicloud\n labels:\n kusionstack.io/control: "true"\n annotations:\n service.beta.kubernetes.io/alibaba-cloud-loadbalancer-spec: slb.s1.small\n')),(0,i.kt)("p",null,"The workspace configuration need to be updated with the command:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace update dev -f ~/dev.yaml\n")),(0,i.kt)("p",null,"For a full reference of what can be configured in the workspace level, please see the ",(0,i.kt)("a",{parentName:"p",href:"../../reference/modules/workspace-configs/networking/network"},"workspace reference"),"."),(0,i.kt)("h2",{id:"example"},"Example"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport network as n\n\n"helloworld": ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "helloworld": c.Container {\n image = "gcr.io/google-samples/gb-frontend:v4"\n env: {\n "env1": "VALUE"\n "env2": "VALUE2"\n }\n resources: {\n "cpu": "500m"\n "memory": "512Mi"\n }\n # Configure an HTTP readiness probe\n readinessProbe: p.Probe {\n probeHandler: p.Http {\n url: "http://localhost:80"\n }\n initialDelaySeconds: 10\n }\n }\n }\n replicas: 2\n }\n accessories: {\n "network": n.Network {\n ports: [\n n.Port {\n port: 8080\n targetPort: 80\n }\n ]\n }\n }\n}\n')),(0,i.kt)("p",null,"The code above changes the service port to expose from ",(0,i.kt)("inlineCode",{parentName:"p"},"80")," in the last guide to ",(0,i.kt)("inlineCode",{parentName:"p"},"8080"),", but still targeting the container port ",(0,i.kt)("inlineCode",{parentName:"p"},"80")," because that's what the application is listening on."),(0,i.kt)("h2",{id:"applying"},"Applying"),(0,i.kt)("p",null,"Re-run steps in ",(0,i.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", new service configuration can be applied."),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private Update\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld UnChanged\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS Update v1:Service:simple-service:simple-service-dev-helloworld-private success \n SUCCESS UnChanged apps/v1:Deployment:simple-service:simple-service-dev-helloworld, skip \nUnChanged apps/v1:Deployment:simple-service:simple-service-dev-helloworld, skip [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,i.kt)("h2",{id:"validation"},"Validation"),(0,i.kt)("p",null,"We can verify the Kubernetes service now has the updated attributes (mapping service port 8080 to container port 80) as defined in the ",(0,i.kt)("inlineCode",{parentName:"p"},"ports")," configuration:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"kubectl get svc -n simple-service -o yaml\n...\n spec:\n ...\n ports:\n - name: simple-service-dev-helloworld-private-8080-tcp\n port: 8080\n protocol: TCP\n targetPort: 80\n...\n")),(0,i.kt)("p",null,"Exposing service port 8080:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"},"kubectl port-forward svc/simple-service-dev-helloworld-private -n simple-service 30000:8080\n")),(0,i.kt)("p",null,"Open browser and visit ",(0,i.kt)("a",{parentName:"p",href:"http://127.0.0.1:30000"},"http://127.0.0.1:30000"),", the application should be up and running\uff1a"),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"app-preview",src:t(92287).Z,width:"1830",height:"330"})))}d.isMDXComponent=!0},92287:(e,n,t)=>{t.d(n,{Z:()=>r});const r=t.p+"assets/images/app-preview-de5274f4267fa725d2a65099e47c6c2c.png"}}]); \ No newline at end of file diff --git a/assets/js/e5474da6.6e0a0db1.js b/assets/js/e5474da6.3cbbe942.js similarity index 50% rename from assets/js/e5474da6.6e0a0db1.js rename to assets/js/e5474da6.3cbbe942.js index 731d3b87fd8..3ef39dcf21d 100644 --- a/assets/js/e5474da6.6e0a0db1.js +++ b/assets/js/e5474da6.3cbbe942.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[574],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):a(a({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=l(r),f=o,g=d["".concat(c,".").concat(f)]||d[f]||u[f]||i;return r?n.createElement(g,a(a({ref:t},p),{},{components:r})):n.createElement(g,a({ref:t},p))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=r.length,a=new Array(i);a[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const i={},a="Get Started",s={unversionedId:"getting-started/getting-started",id:"version-v0.9/getting-started/getting-started",title:"Get Started",description:"This section includes a quick overview of KusionStack and how to deploy a cloud-native app with it.",source:"@site/docs_versioned_docs/version-v0.9/getting-started/getting-started.md",sourceDirName:"getting-started",slug:"/getting-started/",permalink:"/docs/v0.9/getting-started/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/getting-started/getting-started.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Kusion vs. Other Software",permalink:"/docs/v0.9/intro/kusion-vs-x"},next:{title:"Install Kusion",permalink:"/docs/v0.9/getting-started/install-kusion"}},c={},l=[],p={toc:l};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"get-started"},"Get Started"),(0,o.kt)("p",null,"This section includes a quick overview of KusionStack and how to deploy a cloud-native app with it."))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[574],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>f});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=l(r),f=o,g=d["".concat(c,".").concat(f)]||d[f]||u[f]||a;return r?n.createElement(g,i(i({ref:t},p),{},{components:r})):n.createElement(g,i({ref:t},p))}));function f(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const a={},i="Get Started",s={unversionedId:"getting-started/getting-started",id:"version-v0.9/getting-started/getting-started",title:"Get Started",description:"This section includes a quick overview of KusionStack and how to deploy a cloud-native app with it.",source:"@site/docs_versioned_docs/version-v0.9/getting-started/getting-started.md",sourceDirName:"getting-started",slug:"/getting-started/",permalink:"/docs/v0.9/getting-started/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/getting-started/getting-started.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Kusion vs. Other Software",permalink:"/docs/v0.9/intro/kusion-vs-x"},next:{title:"Install Kusion",permalink:"/docs/v0.9/getting-started/install-kusion"}},c={},l=[],p={toc:l};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"get-started"},"Get Started"),(0,o.kt)("p",null,"This section includes a quick overview of KusionStack and how to deploy a cloud-native app with it."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e5601569.6499cac4.js b/assets/js/e5601569.6499cac4.js new file mode 100644 index 00000000000..b593a34d868 --- /dev/null +++ b/assets/js/e5601569.6499cac4.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5392],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var i=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var l=i.createContext({}),s=function(e){var n=i.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=s(e.components);return i.createElement(l.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return i.createElement(i.Fragment,{},n)}},u=i.forwardRef((function(e,n){var t=e.components,r=e.mdxType,a=e.originalType,l=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),u=s(t),m=r,g=u["".concat(l,".").concat(m)]||u[m]||d[m]||a;return t?i.createElement(g,o(o({ref:n},c),{},{components:t})):i.createElement(g,o({ref:n},c))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var a=t.length,o=new Array(a);o[0]=u;var p={};for(var l in n)hasOwnProperty.call(n,l)&&(p[l]=n[l]);p.originalType=e,p.mdxType="string"==typeof e?e:r,o[1]=p;for(var s=2;s{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>p,toc:()=>s});var i=t(87462),r=(t(67294),t(3905));const a={id:"image-upgrade"},o="Upgrade Image",p={unversionedId:"user-guides/working-with-k8s/image-upgrade",id:"version-v0.11/user-guides/working-with-k8s/image-upgrade",title:"Upgrade Image",description:"You can declare the application's container image via image field of the Container schema.",source:"@site/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/4-image-upgrade.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/image-upgrade",permalink:"/docs/user-guides/working-with-k8s/image-upgrade",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/4-image-upgrade.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:4,frontMatter:{id:"image-upgrade"},sidebar:"kusion",previous:{title:"Expose Service",permalink:"/docs/user-guides/working-with-k8s/service"},next:{title:"Configure Resource Specification",permalink:"/docs/user-guides/working-with-k8s/resource-spec"}},l={},s=[{value:"Pre-requisite",id:"pre-requisite",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],c={toc:s};function d(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,i.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"upgrade-image"},"Upgrade Image"),(0,r.kt)("p",null,"You can declare the application's container image via ",(0,r.kt)("inlineCode",{parentName:"p"},"image")," field of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Container")," schema."),(0,r.kt)("p",null,"For the full ",(0,r.kt)("inlineCode",{parentName:"p"},"Container")," schema reference, please see ",(0,r.kt)("a",{parentName:"p",href:"../../reference/modules/developer-schemas/workload/service#schema-container"},"here")," for more details."),(0,r.kt)("h2",{id:"pre-requisite"},"Pre-requisite"),(0,r.kt)("p",null,"Please refer to the ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,r.kt)("p",null,"The example below also requires you to have ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,r.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,r.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,r.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,r.kt)("h2",{id:"example"},"Example"),(0,r.kt)("p",null,"Update the image value in ",(0,r.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\n\nhelloworld: ac.AppConfiguration {\n workload.containers.nginx: {\n ...\n # before: \n # image = "gcr.io/google-samples/gb-frontend:v4"\n # after: \n image = "gcr.io/google-samples/gb-frontend:v5"\n ...\n }\n}\n')),(0,r.kt)("p",null,"Everything else in ",(0,r.kt)("inlineCode",{parentName:"p"},"main.k")," stay the same."),(0,r.kt)("h2",{id:"applying"},"Applying"),(0,r.kt)("p",null,"Re-run steps in ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", update image is completed."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private UnChanged\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Update\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS UnChanged v1:Service:simple-service:simple-service-dev-helloworld-private, skip \n SUCCESS Update apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \nUpdate apps/v1:Deployment:simple-service:simple-service-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,r.kt)("h2",{id:"validation"},"Validation"),(0,r.kt)("p",null,"We can verify the application container (in the deployment template) now has the updated image (v5) as defined in the container configuration:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kubectl get deployment -n simple-service -o yaml\n...\n template:\n ...\n spec:\n containers:\n - env:\n ...\n image: gcr.io/google-samples/gb-frontend:v5\n ...\n...\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e5601569.d299888b.js b/assets/js/e5601569.d299888b.js deleted file mode 100644 index cafb7162fce..00000000000 --- a/assets/js/e5601569.d299888b.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5392],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var i=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var l=i.createContext({}),s=function(e){var n=i.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=s(e.components);return i.createElement(l.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return i.createElement(i.Fragment,{},n)}},u=i.forwardRef((function(e,n){var t=e.components,r=e.mdxType,a=e.originalType,l=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),u=s(t),m=r,g=u["".concat(l,".").concat(m)]||u[m]||d[m]||a;return t?i.createElement(g,o(o({ref:n},c),{},{components:t})):i.createElement(g,o({ref:n},c))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var a=t.length,o=new Array(a);o[0]=u;var p={};for(var l in n)hasOwnProperty.call(n,l)&&(p[l]=n[l]);p.originalType=e,p.mdxType="string"==typeof e?e:r,o[1]=p;for(var s=2;s{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>p,toc:()=>s});var i=t(87462),r=(t(67294),t(3905));const a={id:"image-upgrade"},o="Upgrade Image",p={unversionedId:"user-guides/working-with-k8s/image-upgrade",id:"version-v0.11/user-guides/working-with-k8s/image-upgrade",title:"Upgrade Image",description:"You can declare the application's container image via image field of the Container schema.",source:"@site/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/4-image-upgrade.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/image-upgrade",permalink:"/docs/user-guides/working-with-k8s/image-upgrade",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/4-image-upgrade.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:4,frontMatter:{id:"image-upgrade"},sidebar:"kusion",previous:{title:"Expose Service",permalink:"/docs/user-guides/working-with-k8s/service"},next:{title:"Configure Resource Specification",permalink:"/docs/user-guides/working-with-k8s/resource-spec"}},l={},s=[{value:"Pre-requisite",id:"pre-requisite",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],c={toc:s};function d(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,i.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"upgrade-image"},"Upgrade Image"),(0,r.kt)("p",null,"You can declare the application's container image via ",(0,r.kt)("inlineCode",{parentName:"p"},"image")," field of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Container")," schema."),(0,r.kt)("p",null,"For the full ",(0,r.kt)("inlineCode",{parentName:"p"},"Container")," schema reference, please see ",(0,r.kt)("a",{parentName:"p",href:"../../reference/modules/developer-schemas/workload/service#schema-container"},"here")," for more details."),(0,r.kt)("h2",{id:"pre-requisite"},"Pre-requisite"),(0,r.kt)("p",null,"Please refer to the ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,r.kt)("p",null,"The example below also requires you to have ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,r.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,r.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,r.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,r.kt)("h2",{id:"example"},"Example"),(0,r.kt)("p",null,"Update the image value in ",(0,r.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.v1.app_configuration as ac\n\nhelloworld: ac.AppConfiguration {\n workload.containers.nginx: {\n ...\n # before: \n # image = "gcr.io/google-samples/gb-frontend:v4"\n # after: \n image = "gcr.io/google-samples/gb-frontend:v5"\n ...\n }\n}\n')),(0,r.kt)("p",null,"Everything else in ",(0,r.kt)("inlineCode",{parentName:"p"},"main.k")," stay the same."),(0,r.kt)("h2",{id:"applying"},"Applying"),(0,r.kt)("p",null,"Re-run steps in ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", update image is completed."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Spec in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private UnChanged\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Update\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS UnChanged v1:Service:simple-service:simple-service-dev-helloworld-private, skip \n SUCCESS Update apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \nUpdate apps/v1:Deployment:simple-service:simple-service-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,r.kt)("h2",{id:"validation"},"Validation"),(0,r.kt)("p",null,"We can verify the application container (in the deployment template) now has the updated image (v5) as defined in the container configuration:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kubectl get deployment -n simple-service -o yaml\n...\n template:\n ...\n spec:\n containers:\n - env:\n ...\n image: gcr.io/google-samples/gb-frontend:v5\n ...\n...\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e7791cad.12fbf57a.js b/assets/js/e7791cad.12fbf57a.js deleted file mode 100644 index d2a56c06058..00000000000 --- a/assets/js/e7791cad.12fbf57a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[745],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var i=a.createContext({}),d=function(e){var t=a.useContext(i),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=d(e.components);return a.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,i=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),c=d(n),m=r,k=c["".concat(i,".").concat(m)]||c[m]||u[m]||l;return n?a.createElement(k,o(o({ref:t},p),{},{components:n})):a.createElement(k,o({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,o=new Array(l);o[0]=c;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var d=2;d{n.r(t),n.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>u,frontMatter:()=>l,metadata:()=>s,toc:()=>d});var a=n(87462),r=(n(67294),n(3905));const l={},o="mysql",s={unversionedId:"reference/modules/workspace-configs/database/mysql",id:"version-v0.11/reference/modules/workspace-configs/database/mysql",title:"mysql",description:"Module MySQL",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/database/mysql.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/database",slug:"/reference/modules/workspace-configs/database/mysql",permalink:"/docs/reference/modules/workspace-configs/database/mysql",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/database/mysql.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"service",permalink:"/docs/reference/modules/developer-schemas/workload/service"},next:{title:"postgres",permalink:"/docs/reference/modules/workspace-configs/database/postgres"}},i={},d=[{value:"Module MySQL",id:"module-mysql",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:d};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"mysql"},"mysql"),(0,r.kt)("h2",{id:"module-mysql"},"Module MySQL"),(0,r.kt)("p",null,"MySQL describes the attributes to locally deploy or create a cloud provider managed mysql database instance for the workload. "),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"cloud"),(0,r.kt)("br",null),"Cloud specifies the type of the cloud vendor."),(0,r.kt)("td",{parentName:"tr",align:null},'"aws" ',"|",' "alicloud"'),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"username"),(0,r.kt)("br",null),"Username specifies the operation account for the mysql database."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},'"root"'),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"category"),(0,r.kt)("br",null),"Category specifies the edition of the mysql instance provided by the cloud vendor."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},'"Basic"'),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"securityIPs"),(0,r.kt)("br",null),"SecurityIPs specifies the list of IP addresses allowed to access the mysql instance provided by the cloud vendor."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},'["0.0.0.0/0"]'),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"privateRouting"),(0,r.kt)("br",null),"PrivateRouting specifies whether the host address of the cloud mysql instance for the workload to connect with is via public network or private network of the cloud vendor."),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"true"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"size"),(0,r.kt)("br",null),"Size specifies the allocated storage size of the mysql instance."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"10"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"subnetID"),(0,r.kt)("br",null),"SubnetID specifies the virtual subnet ID associated with the VPC that the cloud mysql instance will be created in."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"databaseName"),(0,r.kt)("br",null),"databaseName specifies the database name."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'# MySQL workspace configs for AWS RDS\nmodules: \n kusionstack@mysql@0.1.0: \n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n privateRouting: false\n databaseName: "my-mysql"\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'# MySQL workspace configs for Alicloud RDS\nmodules: \n kusionstack@mysql@0.1.0: \n default: \n cloud: alicloud\n size: 20\n instanceType: mysql.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n databaseName: "my-mysql"\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e7791cad.cd201f42.js b/assets/js/e7791cad.cd201f42.js new file mode 100644 index 00000000000..464e6f74d76 --- /dev/null +++ b/assets/js/e7791cad.cd201f42.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[745],{3905:(e,t,a)=>{a.d(t,{Zo:()=>p,kt:()=>m});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function o(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var i=n.createContext({}),d=function(e){var t=n.useContext(i),a=t;return e&&(a="function"==typeof e?e(t):o(o({},t),e)),a},p=function(e){var t=d(e.components);return n.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,i=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),c=d(a),m=r,k=c["".concat(i,".").concat(m)]||c[m]||u[m]||l;return a?n.createElement(k,o(o({ref:t},p),{},{components:a})):n.createElement(k,o({ref:t},p))}));function m(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,o=new Array(l);o[0]=c;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var d=2;d{a.r(t),a.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>u,frontMatter:()=>l,metadata:()=>s,toc:()=>d});var n=a(87462),r=(a(67294),a(3905));const l={},o="mysql",s={unversionedId:"reference/modules/workspace-configs/database/mysql",id:"version-v0.11/reference/modules/workspace-configs/database/mysql",title:"mysql",description:"Module MySQL",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/database/mysql.md",sourceDirName:"6-reference/2-modules/2-workspace-configs/database",slug:"/reference/modules/workspace-configs/database/mysql",permalink:"/docs/reference/modules/workspace-configs/database/mysql",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/database/mysql.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"service",permalink:"/docs/reference/modules/developer-schemas/workload/service"},next:{title:"postgres",permalink:"/docs/reference/modules/workspace-configs/database/postgres"}},i={},d=[{value:"Module MySQL",id:"module-mysql",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:d};function u(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"mysql"},"mysql"),(0,r.kt)("h2",{id:"module-mysql"},"Module MySQL"),(0,r.kt)("p",null,"MySQL describes the attributes to locally deploy or create a cloud provider managed mysql database instance for the workload. "),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"cloud"),(0,r.kt)("br",null),"Cloud specifies the type of the cloud vendor."),(0,r.kt)("td",{parentName:"tr",align:null},'"aws" ',"|",' "alicloud"'),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"required"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"username"),(0,r.kt)("br",null),"Username specifies the operation account for the mysql database."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},'"root"'),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"category"),(0,r.kt)("br",null),"Category specifies the edition of the mysql instance provided by the cloud vendor."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},'"Basic"'),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"securityIPs"),(0,r.kt)("br",null),"SecurityIPs specifies the list of IP addresses allowed to access the mysql instance provided by the cloud vendor."),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},'["0.0.0.0/0"]'),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"privateRouting"),(0,r.kt)("br",null),"PrivateRouting specifies whether the host address of the cloud mysql instance for the workload to connect with is via public network or private network of the cloud vendor."),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"true"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"size"),(0,r.kt)("br",null),"Size specifies the allocated storage size of the mysql instance."),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"10"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"subnetID"),(0,r.kt)("br",null),"SubnetID specifies the virtual subnet ID associated with the VPC that the cloud mysql instance will be created in."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"databaseName"),(0,r.kt)("br",null),"databaseName specifies the database name."),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'# MySQL workspace configs for AWS RDS\nmodules: \n kusionstack@mysql@0.1.0: \n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n privateRouting: false\n databaseName: "my-mysql"\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},'# MySQL workspace configs for Alicloud RDS\nmodules: \n kusionstack@mysql@0.1.0: \n default: \n cloud: alicloud\n size: 20\n instanceType: mysql.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: [your-subnet-id]\n databaseName: "my-mysql"\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e803704a.519838ad.js b/assets/js/e803704a.519838ad.js deleted file mode 100644 index 0e19d9bde08..00000000000 --- a/assets/js/e803704a.519838ad.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9904],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(n),m=a,g=d["".concat(c,".").concat(m)]||d[m]||u[m]||s;return n?r.createElement(g,o(o({ref:t},p),{},{components:n})):r.createElement(g,o({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>s,metadata:()=>i,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const s={id:"using-cloud-secrets"},o="Using Cloud Secrets Manager",i={unversionedId:"user-guides/secrets-management/using-cloud-secrets",id:"version-v0.11/user-guides/secrets-management/using-cloud-secrets",title:"Using Cloud Secrets Manager",description:"Applications usually store sensitive data in secrets by using centralized secrets management solutions. For example, you authenticate databases, services, and external systems with passwords, API keys, tokens, and other credentials stored in a secret store, e.g. Hashicorp Vault, AWS Secrets Manager, Azure Key Vault, etc",source:"@site/docs_versioned_docs/version-v0.11/5-user-guides/4-secrets-management/1-using-cloud-secrets.md",sourceDirName:"5-user-guides/4-secrets-management",slug:"/user-guides/secrets-management/using-cloud-secrets",permalink:"/docs/user-guides/secrets-management/using-cloud-secrets",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/5-user-guides/4-secrets-management/1-using-cloud-secrets.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"using-cloud-secrets"},sidebar:"kusion",previous:{title:"Configure Monitoring Behavior With Prometheus",permalink:"/docs/user-guides/observability/prometheus"},next:{title:"Kusion Commands",permalink:"/docs/reference/commands/"}},c={},l=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Setting up workspace",id:"setting-up-workspace",level:2},{value:"Update AppConfiguration",id:"update-appconfiguration",level:2},{value:"Apply and Verify",id:"apply-and-verify",level:2}],p={toc:l};function u(e){let{components:t,...s}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,s,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"using-cloud-secrets-manager"},"Using Cloud Secrets Manager"),(0,a.kt)("p",null,"Applications usually store sensitive data in secrets by using centralized secrets management solutions. For example, you authenticate databases, services, and external systems with passwords, API keys, tokens, and other credentials stored in a secret store, e.g. Hashicorp Vault, AWS Secrets Manager, Azure Key Vault, etc"),(0,a.kt)("p",null,"Kusion provides out-of-the-box support to reference existing external secrets management solution, this tutorial introduces that how to pull the secret from AWS Secrets Manager to make it available to applications."),(0,a.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,a.kt)("p",null,"Please refer to the ",(0,a.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,a.kt)("p",null,"The example below also requires you to have ",(0,a.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#initializing"},"initialized the project")," using the ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will generate a ",(0,a.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#kclmod"},(0,a.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the project directory."),(0,a.kt)("p",null,"Additionally, you also need to configure the obtained AccessKey and SecretKey as environment variables: "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},'export AWS_ACCESS_KEY_ID="AKIAQZDxxxx" # replace it with your AccessKey\nexport AWS_SECRET_ACCESS_KEY="oE/xxxx" # replace it with your SecretKey\n')),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"aws iam account",src:n(24838).Z,width:"2874",height:"1398"})),(0,a.kt)("h2",{id:"setting-up-workspace"},"Setting up workspace"),(0,a.kt)("p",null,"Since v0.10.0, we have introduced the concept of ",(0,a.kt)("a",{parentName:"p",href:"/docs/concepts/workspace"},"workspaces"),", whose configurations represent the part of the application behaviors that platform teams are interested in standardizing, or the ones to eliminate from developer's mind to make their lives easier."),(0,a.kt)("p",null,"In the case of setting up cloud secrets manager, platform teams need to specify which secrets management solution to use and necessary information to access on the workspace level."),(0,a.kt)("p",null,"A sample ",(0,a.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," with AWS Secrets Manager settings:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"modules:\n ...\nsecretStore:\n provider:\n aws:\n region: us-east-1\n profile: The optional profile to be used to interact with AWS Secrets Manager.\n...\n")),(0,a.kt)("h2",{id:"update-appconfiguration"},"Update AppConfiguration"),(0,a.kt)("p",null,"At this point we are set up for good! Now you can declare external type of secrets via the ",(0,a.kt)("inlineCode",{parentName:"p"},"secrets")," field in the ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model to consume sensitive data stored in AWS Secrets Manager."),(0,a.kt)("p",null,"See the example below for a full, deployable AppConfiguration."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport kam.v1.workload.secret as sec\n\ngitsync: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "syncer": c.Container {\n image: "dyrnq/git-sync"\n # Run the following command as defined\n command: [\n "--repo=https://github.com/KusionStack/kusion"\n "--ref=HEAD"\n "--root=/mnt/git"\n ]\n # Consume secrets in environment variables\n env: {\n "GIT_SYNC_USERNAME": "secret://git-auth/username"\n "GIT_SYNC_PASSWORD": "secret://git-auth/password"\n }\n }\n }\n # Secrets used to retrieve secret data from AWS Secrets Manager\n secrets: {\n "git-auth": sec.Secret {\n type: "external"\n data: {\n "username": "ref://git-auth-info/username"\n "password": "ref://git-auth-info/password"\n }\n }\n }\n }\n}\n')),(0,a.kt)("h2",{id:"apply-and-verify"},"Apply and Verify"),(0,a.kt)("p",null,"Run ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion apply")," command to deploy above application, then use the below command to verify if the secret got deployed:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"kubectl get secret -n secretdemo\n")),(0,a.kt)("p",null,"You will find ",(0,a.kt)("inlineCode",{parentName:"p"},"git-auth")," of type Opaque automatically created and contains sensitive information pulled from AWS Secrets Manager."))}u.isMDXComponent=!0},24838:(e,t,n)=>{n.d(t,{Z:()=>r});const r=n.p+"assets/images/aws-iam-account-2216105e7fa18fb2f7bf4be7e19f98bd.png"}}]); \ No newline at end of file diff --git a/assets/js/e803704a.9ab4b3c3.js b/assets/js/e803704a.9ab4b3c3.js new file mode 100644 index 00000000000..eb4ba0bf5aa --- /dev/null +++ b/assets/js/e803704a.9ab4b3c3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9904],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),d=l(n),m=a,g=d["".concat(c,".").concat(m)]||d[m]||u[m]||s;return n?r.createElement(g,o(o({ref:t},p),{},{components:n})):r.createElement(g,o({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>u,frontMatter:()=>s,metadata:()=>i,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const s={id:"using-cloud-secrets"},o="Using Cloud Secrets Manager",i={unversionedId:"user-guides/secrets-management/using-cloud-secrets",id:"version-v0.11/user-guides/secrets-management/using-cloud-secrets",title:"Using Cloud Secrets Manager",description:"Applications usually store sensitive data in secrets by using centralized secrets management solutions. For example, you authenticate databases, services, and external systems with passwords, API keys, tokens, and other credentials stored in a secret store, e.g. Hashicorp Vault, AWS Secrets Manager, Azure Key Vault, etc",source:"@site/docs_versioned_docs/version-v0.11/5-user-guides/4-secrets-management/1-using-cloud-secrets.md",sourceDirName:"5-user-guides/4-secrets-management",slug:"/user-guides/secrets-management/using-cloud-secrets",permalink:"/docs/user-guides/secrets-management/using-cloud-secrets",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/5-user-guides/4-secrets-management/1-using-cloud-secrets.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{id:"using-cloud-secrets"},sidebar:"kusion",previous:{title:"Configure Monitoring Behavior With Prometheus",permalink:"/docs/user-guides/observability/prometheus"},next:{title:"Kusion Commands",permalink:"/docs/reference/commands/"}},c={},l=[{value:"Prerequisites",id:"prerequisites",level:2},{value:"Setting up workspace",id:"setting-up-workspace",level:2},{value:"Update AppConfiguration",id:"update-appconfiguration",level:2},{value:"Apply and Verify",id:"apply-and-verify",level:2}],p={toc:l};function u(e){let{components:t,...s}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,s,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"using-cloud-secrets-manager"},"Using Cloud Secrets Manager"),(0,a.kt)("p",null,"Applications usually store sensitive data in secrets by using centralized secrets management solutions. For example, you authenticate databases, services, and external systems with passwords, API keys, tokens, and other credentials stored in a secret store, e.g. Hashicorp Vault, AWS Secrets Manager, Azure Key Vault, etc"),(0,a.kt)("p",null,"Kusion provides out-of-the-box support to reference existing external secrets management solution, this tutorial introduces that how to pull the secret from AWS Secrets Manager to make it available to applications."),(0,a.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,a.kt)("p",null,"Please refer to the ",(0,a.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,a.kt)("p",null,"The example below also requires you to have ",(0,a.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#initializing"},"initialized the project")," using the ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will generate a ",(0,a.kt)("a",{parentName:"p",href:"../working-with-k8s/deploy-application#kclmod"},(0,a.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the project directory."),(0,a.kt)("p",null,"Additionally, you also need to configure the obtained AccessKey and SecretKey as environment variables: "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-bash"},'export AWS_ACCESS_KEY_ID="AKIAQZDxxxx" # replace it with your AccessKey\nexport AWS_SECRET_ACCESS_KEY="oE/xxxx" # replace it with your SecretKey\n')),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"aws iam account",src:n(24838).Z,width:"2874",height:"1398"})),(0,a.kt)("h2",{id:"setting-up-workspace"},"Setting up workspace"),(0,a.kt)("p",null,"Since v0.10.0, we have introduced the concept of ",(0,a.kt)("a",{parentName:"p",href:"/docs/concepts/workspace"},"workspaces"),", whose configurations represent the part of the application behaviors that platform teams are interested in standardizing, or the ones to eliminate from developer's mind to make their lives easier."),(0,a.kt)("p",null,"In the case of setting up cloud secrets manager, platform teams need to specify which secrets management solution to use and necessary information to access on the workspace level."),(0,a.kt)("p",null,"A sample ",(0,a.kt)("inlineCode",{parentName:"p"},"workspace.yaml")," with AWS Secrets Manager settings:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"modules:\n ...\nsecretStore:\n provider:\n aws:\n region: us-east-1\n profile: The optional profile to be used to interact with AWS Secrets Manager.\n...\n")),(0,a.kt)("h2",{id:"update-appconfiguration"},"Update AppConfiguration"),(0,a.kt)("p",null,"At this point we are set up for good! Now you can declare external type of secrets via the ",(0,a.kt)("inlineCode",{parentName:"p"},"secrets")," field in the ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model to consume sensitive data stored in AWS Secrets Manager."),(0,a.kt)("p",null,"See the example below for a full, deployable AppConfiguration."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import kam.v1.app_configuration as ac\nimport kam.v1.workload as wl\nimport kam.v1.workload.container as c\nimport kam.v1.workload.secret as sec\n\ngitsync: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "syncer": c.Container {\n image: "dyrnq/git-sync"\n # Run the following command as defined\n command: [\n "--repo=https://github.com/KusionStack/kusion"\n "--ref=HEAD"\n "--root=/mnt/git"\n ]\n # Consume secrets in environment variables\n env: {\n "GIT_SYNC_USERNAME": "secret://git-auth/username"\n "GIT_SYNC_PASSWORD": "secret://git-auth/password"\n }\n }\n }\n # Secrets used to retrieve secret data from AWS Secrets Manager\n secrets: {\n "git-auth": sec.Secret {\n type: "external"\n data: {\n "username": "ref://git-auth-info/username"\n "password": "ref://git-auth-info/password"\n }\n }\n }\n }\n}\n')),(0,a.kt)("h2",{id:"apply-and-verify"},"Apply and Verify"),(0,a.kt)("p",null,"Run ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion apply")," command to deploy above application, then use the below command to verify if the secret got deployed:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"kubectl get secret -n secretdemo\n")),(0,a.kt)("p",null,"You will find ",(0,a.kt)("inlineCode",{parentName:"p"},"git-auth")," of type Opaque automatically created and contains sensitive information pulled from AWS Secrets Manager."))}u.isMDXComponent=!0},24838:(e,t,n)=>{n.d(t,{Z:()=>r});const r=n.p+"assets/images/aws-iam-account-2216105e7fa18fb2f7bf4be7e19f98bd.png"}}]); \ No newline at end of file diff --git a/assets/js/e82e5e58.85ec3add.js b/assets/js/e82e5e58.85ec3add.js new file mode 100644 index 00000000000..c939cb6770b --- /dev/null +++ b/assets/js/e82e5e58.85ec3add.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9319],{3905:(e,t,a)=>{a.d(t,{Zo:()=>m,kt:()=>u});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},m=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),c=s(a),u=r,k=c["".concat(p,".").concat(u)]||c[u]||d[u]||l;return a?n.createElement(k,i(i({ref:t},m),{},{components:a})):n.createElement(k,i({ref:t},m))}));function u(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,i=new Array(l);i[0]=c;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var s=2;s{a.r(t),a.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>d,frontMatter:()=>l,metadata:()=>o,toc:()=>s});var n=a(87462),r=(a(67294),a(3905));const l={},i="service",o={unversionedId:"reference/modules/developer-schemas/workload/service",id:"version-v0.11/reference/modules/developer-schemas/workload/service",title:"service",description:"Schemas",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/workload/service.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/workload",slug:"/reference/modules/developer-schemas/workload/service",permalink:"/docs/reference/modules/developer-schemas/workload/service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/workload/service.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"job",permalink:"/docs/reference/modules/developer-schemas/workload/job"},next:{title:"mysql",permalink:"/docs/reference/modules/workspace-configs/database/mysql"}},p={},s=[{value:"Schemas",id:"schemas",level:2},{value:"Schema Service",id:"schema-service",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Base Schema",id:"base-schema",level:3},{value:"Schema Container",id:"schema-container",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3},{value:"Schema FileSpec",id:"schema-filespec",level:2},{value:"Attributes",id:"attributes-2",level:3},{value:"Examples",id:"examples-2",level:3},{value:"Schema Lifecycle",id:"schema-lifecycle",level:3},{value:"Attributes",id:"attributes-3",level:4},{value:"Examples",id:"examples-3",level:4},{value:"Schema Exec",id:"schema-exec",level:3},{value:"Attributes",id:"attributes-4",level:4},{value:"Examples",id:"examples-4",level:4},{value:"Schema Http",id:"schema-http",level:3},{value:"Attributes",id:"attributes-5",level:4},{value:"Examples",id:"examples-5",level:4},{value:"Schema Probe",id:"schema-probe",level:3},{value:"Attributes",id:"attributes-6",level:4},{value:"Examples",id:"examples-6",level:4},{value:"Schema Tcp",id:"schema-tcp",level:3},{value:"Attributes",id:"attributes-7",level:4},{value:"Examples",id:"examples-7",level:4},{value:"Schema Secret",id:"schema-secret",level:2},{value:"Attributes",id:"attributes-8",level:3},{value:"Examples",id:"examples-8",level:3}],m={toc:s};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},m,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"service"},"service"),(0,r.kt)("h2",{id:"schemas"},"Schemas"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-service"},"Service"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-container"},"Container"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-filespec"},"Filespec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-lifecycle"},"LifeCycle")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-probe"},"Probe"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-exec"},"Exec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-http"},"Http")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-tcp"},"Tcp")))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-secret"},"Secret"))))),(0,r.kt)("h2",{id:"schema-service"},"Schema Service"),(0,r.kt)("p",null,"Service is a kind of workload profile that describes how to run your application code. This",(0,r.kt)("br",null),'is typically used for long-running web applications that should "never" go down, and handle',(0,r.kt)("br",null),"short-lived latency-sensitive web requests, or events."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"annotations")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"containers")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:}"),(0,r.kt)("td",{parentName:"tr",align:null},"Containers defines the templates of containers to be ran.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers"},"https://kubernetes.io/docs/concepts/containers")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"labels")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Labels are key/value pairs that are attached to the workload."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"replicas")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Number of container replicas based on this configuration that should be ran."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"secrets")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:",(0,r.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/secret/#schema-secret"},"Secret"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Secrets can be used to store small amount of sensitive data e.g. password, token."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'# Instantiate a long-running service and its image is "nginx:v1"\n\nimport kam.workload as wl\nimport kam.workload.container as c\n\nnginxSvc : wl.Service {\n containers: {\n "nginx": c.Container {\n image: "nginx:v1"\n }\n }\n}\n')),(0,r.kt)("h3",{id:"base-schema"},"Base Schema"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../internal/common#schema-workloadbase"},"WorkloadBase")),(0,r.kt)("h2",{id:"schema-container"},"Schema Container"),(0,r.kt)("p",null,"Container describes how the Application's tasks are expected to be run. Depending on",(0,r.kt)("br",null),"the replicas parameter 1 or more containers can be created from each template."),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"args")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Arguments to the entrypoint.",(0,r.kt)("br",null),"Args will overwrite the CMD value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's CMD is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Entrypoint array. Not executed within a shell.",(0,r.kt)("br",null),"Command will overwrite the ENTRYPOINT value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's ENTRYPOINT is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"dirs")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of volumes mount into the container's filesystem.",(0,r.kt)("br",null),"The dirs parameter is a dict with the key being the folder name in the container and the value",(0,r.kt)("br",null),"being the referenced volume."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"env")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"List of environment variables to set in the container.",(0,r.kt)("br",null),"The value of the environment variable may be static text or a value from a secret."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"files")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:",(0,r.kt)("a",{parentName:"td",href:"#filespec"},"FileSpec"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"List of files to create in the container.",(0,r.kt)("br",null),"The files parameter is a dict with the key being the file name in the container and the value",(0,r.kt)("br",null),"being the target file specification."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"image")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Image refers to the Docker image name to run for this container.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/images"},"https://kubernetes.io/docs/concepts/containers/images")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/container/lifecycle/#schema-lifecycle"},"lc.Lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},"Lifecycle refers to actions that the management system should take in response to container lifecycle events."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"livenessProbe")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"LivenessProbe indicates if a running process is healthy.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"readinessProbe")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"ReadinessProbe indicates whether an application is available to handle requests."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"resources")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Map of resource requirements the container should run with.",(0,r.kt)("br",null),"The resources parameter is a dict with the key being the resource name and the value being",(0,r.kt)("br",null),"the resource value."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"startupProbe")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"StartupProbe indicates that the container has started for the first time.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"workingDir")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The working directory of the running process defined in entrypoint.",(0,r.kt)("br",null),"Default container runtime will be used if this is not specified."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container as c\n\nweb = c.Container {\n image: "nginx:latest"\n command: ["/bin/sh", "-c", "echo hi"]\n env: {\n "name": "value"\n }\n resources: {\n "cpu": "2"\n "memory": "4Gi"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-filespec"},"Schema FileSpec"),(0,r.kt)("p",null,"FileSpec defines the target file in a Container."),(0,r.kt)("h3",{id:"attributes-2"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"content")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"File content in plain text."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"contentFrom")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Source for the file content, reference to a secret of configmap value."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"mode")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Mode bits used to set permissions on this file, must be an octal value",(0,r.kt)("br",null),"between 0000 and 0777 or a decimal value between 0 and 511"),(0,r.kt)("td",{parentName:"tr",align:null},'"0644"')))),(0,r.kt)("h3",{id:"examples-2"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container as c\n\ntmpFile = c.FileSpec {\n content: "some file contents"\n mode: "0777"\n}\n')),(0,r.kt)("h3",{id:"schema-lifecycle"},"Schema Lifecycle"),(0,r.kt)("p",null,"Lifecycle describes actions that the management system should take in response to container lifecycle events."),(0,r.kt)("h4",{id:"attributes-3"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"postStart")),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null},"The action to be taken after a container is created.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"preStop")),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null},"The action to be taken before a container is terminated due to an API request or",(0,r.kt)("br",null),"management event such as liveness/startup probe failure, preemption, resource contention, etc.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"))))),(0,r.kt)("h4",{id:"examples-3"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\nimport kam.workload.container.lifecycle as lc\n\nlifecycleHook = lc.Lifecycle {\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n postStart: p.Http {\n url: "http://localhost:80"\n }\n}\n')),(0,r.kt)("h3",{id:"schema-exec"},"Schema Exec"),(0,r.kt)("p",null,'Exec describes a "run in container" action.'),(0,r.kt)("h4",{id:"attributes-4"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"The command line to execute inside the container."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-4"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\nexecProbe = p.Exec {\n command: ["probe.sh"]\n}\n')),(0,r.kt)("h3",{id:"schema-http"},"Schema Http"),(0,r.kt)("p",null,"Http describes an action based on HTTP Get requests."),(0,r.kt)("h4",{id:"attributes-5"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"headers")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of custom headers to set in the request"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The full qualified url to send HTTP requests."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-5"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\nhttpProbe = p.Http {\n url: "http://localhost:80"\n headers: {\n "X-HEADER": "VALUE"\n }\n}\n')),(0,r.kt)("h3",{id:"schema-probe"},"Schema Probe"),(0,r.kt)("p",null,"Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic. There are three probe types: readiness, liveness, and startup."),(0,r.kt)("h4",{id:"attributes-6"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"failureThreshold")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimum consecutive failures for the probe to be considered failed after having succeeded."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"initialDelaySeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"The number of seconds before health checking is activated.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"periodSeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"How often (in seconds) to perform the probe."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"probeHandler")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#exec"},"Exec")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#http"},"Http")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#tcp"},"Tcp"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"successThreshold")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimum consecutive successes for the probe to be considered successful after having failed."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"terminationGracePeriod")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Duration in seconds before terminate gracefully upon probe failure."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"timeoutSeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"The number of seconds after which the probe times out.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-6"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\nprobe = p.Probe {\n probeHandler: p.Http {\n path: "/healthz"\n }\n initialDelaySeconds: 10\n}\n')),(0,r.kt)("h3",{id:"schema-tcp"},"Schema Tcp"),(0,r.kt)("p",null,"Tcp describes an action based on opening a socket."),(0,r.kt)("h4",{id:"attributes-7"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The full qualified url to open a socket."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-7"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\ntcpProbe = p.Tcp {\n url: "tcp://localhost:1234"\n}\n')),(0,r.kt)("h2",{id:"schema-secret"},"Schema Secret"),(0,r.kt)("p",null,"Secret can be used to store sensitive data."),(0,r.kt)("h3",{id:"attributes-8"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"data")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Data contains the non-binary secret data in string form."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"immutable")),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"Immutable, if set to true, ensures that data stored in the Secret cannot be updated."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"params")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of parameters used to facilitate programmatic handling of secret data."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},'"basic"'),(0,r.kt)("td",{parentName:"tr",align:null},'"token"'),(0,r.kt)("td",{parentName:"tr",align:null},'"opaque"')))),(0,r.kt)("h3",{id:"examples-8"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.secret as sec\n\nbasicAuth = sec.Secret {\n type: "basic"\n data: {\n "username": ""\n "password": ""\n }\n}\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e82e5e58.d14836ef.js b/assets/js/e82e5e58.d14836ef.js deleted file mode 100644 index f7249a4b6c9..00000000000 --- a/assets/js/e82e5e58.d14836ef.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9319],{3905:(e,t,a)=>{a.d(t,{Zo:()=>m,kt:()=>u});var n=a(67294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),s=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},m=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),c=s(a),u=r,k=c["".concat(p,".").concat(u)]||c[u]||d[u]||l;return a?n.createElement(k,i(i({ref:t},m),{},{components:a})):n.createElement(k,i({ref:t},m))}));function u(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,i=new Array(l);i[0]=c;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var s=2;s{a.r(t),a.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>d,frontMatter:()=>l,metadata:()=>o,toc:()=>s});var n=a(87462),r=(a(67294),a(3905));const l={},i="service",o={unversionedId:"reference/modules/developer-schemas/workload/service",id:"version-v0.11/reference/modules/developer-schemas/workload/service",title:"service",description:"Schemas",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/workload/service.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/workload",slug:"/reference/modules/developer-schemas/workload/service",permalink:"/docs/reference/modules/developer-schemas/workload/service",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/workload/service.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"job",permalink:"/docs/reference/modules/developer-schemas/workload/job"},next:{title:"mysql",permalink:"/docs/reference/modules/workspace-configs/database/mysql"}},p={},s=[{value:"Schemas",id:"schemas",level:2},{value:"Schema Service",id:"schema-service",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Base Schema",id:"base-schema",level:3},{value:"Schema Container",id:"schema-container",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3},{value:"Schema FileSpec",id:"schema-filespec",level:2},{value:"Attributes",id:"attributes-2",level:3},{value:"Examples",id:"examples-2",level:3},{value:"Schema Lifecycle",id:"schema-lifecycle",level:3},{value:"Attributes",id:"attributes-3",level:4},{value:"Examples",id:"examples-3",level:4},{value:"Schema Exec",id:"schema-exec",level:3},{value:"Attributes",id:"attributes-4",level:4},{value:"Examples",id:"examples-4",level:4},{value:"Schema Http",id:"schema-http",level:3},{value:"Attributes",id:"attributes-5",level:4},{value:"Examples",id:"examples-5",level:4},{value:"Schema Probe",id:"schema-probe",level:3},{value:"Attributes",id:"attributes-6",level:4},{value:"Examples",id:"examples-6",level:4},{value:"Schema Tcp",id:"schema-tcp",level:3},{value:"Attributes",id:"attributes-7",level:4},{value:"Examples",id:"examples-7",level:4},{value:"Schema Secret",id:"schema-secret",level:2},{value:"Attributes",id:"attributes-8",level:3},{value:"Examples",id:"examples-8",level:3}],m={toc:s};function d(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},m,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"service"},"service"),(0,r.kt)("h2",{id:"schemas"},"Schemas"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-service"},"Service"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-container"},"Container"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-filespec"},"Filespec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-lifecycle"},"LifeCycle")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-probe"},"Probe"),(0,r.kt)("ul",{parentName:"li"},(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-exec"},"Exec")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-http"},"Http")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-tcp"},"Tcp")))))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#schema-secret"},"Secret"))))),(0,r.kt)("h2",{id:"schema-service"},"Schema Service"),(0,r.kt)("p",null,"Service is a kind of workload profile that describes how to run your application code. This",(0,r.kt)("br",null),'is typically used for long-running web applications that should "never" go down, and handle',(0,r.kt)("br",null),"short-lived latency-sensitive web requests, or events."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"annotations")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Annotations are key/value pairs that attach arbitrary non-identifying metadata to the workload."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"containers")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:}"),(0,r.kt)("td",{parentName:"tr",align:null},"Containers defines the templates of containers to be ran.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers"},"https://kubernetes.io/docs/concepts/containers")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"labels")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Labels are key/value pairs that are attached to the workload."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"replicas")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Number of container replicas based on this configuration that should be ran."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"secrets")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:",(0,r.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/secret/#schema-secret"},"Secret"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Secrets can be used to store small amount of sensitive data e.g. password, token."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'# Instantiate a long-running service and its image is "nginx:v1"\n\nimport kam.workload as wl\nimport kam.workload.container as c\n\nnginxSvc : wl.Service {\n containers: {\n "nginx": c.Container {\n image: "nginx:v1"\n }\n }\n}\n')),(0,r.kt)("h3",{id:"base-schema"},"Base Schema"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"../internal/common#schema-workloadbase"},"WorkloadBase")),(0,r.kt)("h2",{id:"schema-container"},"Schema Container"),(0,r.kt)("p",null,"Container describes how the Application's tasks are expected to be run. Depending on",(0,r.kt)("br",null),"the replicas parameter 1 or more containers can be created from each template."),(0,r.kt)("h3",{id:"attributes-1"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"args")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Arguments to the entrypoint.",(0,r.kt)("br",null),"Args will overwrite the CMD value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's CMD is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"Entrypoint array. Not executed within a shell.",(0,r.kt)("br",null),"Command will overwrite the ENTRYPOINT value set in the Dockfile, otherwise the Docker",(0,r.kt)("br",null),"image's ENTRYPOINT is used if this is not provided."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"dirs")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of volumes mount into the container's filesystem.",(0,r.kt)("br",null),"The dirs parameter is a dict with the key being the folder name in the container and the value",(0,r.kt)("br",null),"being the referenced volume."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"env")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"List of environment variables to set in the container.",(0,r.kt)("br",null),"The value of the environment variable may be static text or a value from a secret."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"files")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:",(0,r.kt)("a",{parentName:"td",href:"#filespec"},"FileSpec"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"List of files to create in the container.",(0,r.kt)("br",null),"The files parameter is a dict with the key being the file name in the container and the value",(0,r.kt)("br",null),"being the target file specification."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"image")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Image refers to the Docker image name to run for this container.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/images"},"https://kubernetes.io/docs/concepts/containers/images")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/container/lifecycle/#schema-lifecycle"},"lc.Lifecycle")),(0,r.kt)("td",{parentName:"tr",align:null},"Lifecycle refers to actions that the management system should take in response to container lifecycle events."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"livenessProbe")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"LivenessProbe indicates if a running process is healthy.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"readinessProbe")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"ReadinessProbe indicates whether an application is available to handle requests."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"resources")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Map of resource requirements the container should run with.",(0,r.kt)("br",null),"The resources parameter is a dict with the key being the resource name and the value being",(0,r.kt)("br",null),"the resource value."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"startupProbe")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,r.kt)("td",{parentName:"tr",align:null},"StartupProbe indicates that the container has started for the first time.",(0,r.kt)("br",null),"Container will be restarted if the probe fails."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"workingDir")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The working directory of the running process defined in entrypoint.",(0,r.kt)("br",null),"Default container runtime will be used if this is not specified."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h3",{id:"examples-1"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container as c\n\nweb = c.Container {\n image: "nginx:latest"\n command: ["/bin/sh", "-c", "echo hi"]\n env: {\n "name": "value"\n }\n resources: {\n "cpu": "2"\n "memory": "4Gi"\n }\n}\n')),(0,r.kt)("h2",{id:"schema-filespec"},"Schema FileSpec"),(0,r.kt)("p",null,"FileSpec defines the target file in a Container."),(0,r.kt)("h3",{id:"attributes-2"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"content")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"File content in plain text."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"contentFrom")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Source for the file content, reference to a secret of configmap value."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"mode")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"Mode bits used to set permissions on this file, must be an octal value",(0,r.kt)("br",null),"between 0000 and 0777 or a decimal value between 0 and 511"),(0,r.kt)("td",{parentName:"tr",align:null},'"0644"')))),(0,r.kt)("h3",{id:"examples-2"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container as c\n\ntmpFile = c.FileSpec {\n content: "some file contents"\n mode: "0777"\n}\n')),(0,r.kt)("h3",{id:"schema-lifecycle"},"Schema Lifecycle"),(0,r.kt)("p",null,"Lifecycle describes actions that the management system should take in response to container lifecycle events."),(0,r.kt)("h4",{id:"attributes-3"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"postStart")),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null},"The action to be taken after a container is created.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"preStop")),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null}),(0,r.kt)("td",{parentName:"tr",align:null},"The action to be taken before a container is terminated due to an API request or",(0,r.kt)("br",null),"management event such as liveness/startup probe failure, preemption, resource contention, etc.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"},"https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#container-hooks"))))),(0,r.kt)("h4",{id:"examples-3"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\nimport kam.workload.container.lifecycle as lc\n\nlifecycleHook = lc.Lifecycle {\n preStop: p.Exec {\n command: ["preStop.sh"]\n }\n postStart: p.Http {\n url: "http://localhost:80"\n }\n}\n')),(0,r.kt)("h3",{id:"schema-exec"},"Schema Exec"),(0,r.kt)("p",null,'Exec describes a "run in container" action.'),(0,r.kt)("h4",{id:"attributes-4"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"command")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"[str]"),(0,r.kt)("td",{parentName:"tr",align:null},"The command line to execute inside the container."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-4"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\nexecProbe = p.Exec {\n command: ["probe.sh"]\n}\n')),(0,r.kt)("h3",{id:"schema-http"},"Schema Http"),(0,r.kt)("p",null,"Http describes an action based on HTTP Get requests."),(0,r.kt)("h4",{id:"attributes-5"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"headers")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of custom headers to set in the request"),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The full qualified url to send HTTP requests."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-5"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\nhttpProbe = p.Http {\n url: "http://localhost:80"\n headers: {\n "X-HEADER": "VALUE"\n }\n}\n')),(0,r.kt)("h3",{id:"schema-probe"},"Schema Probe"),(0,r.kt)("p",null,"Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic. There are three probe types: readiness, liveness, and startup."),(0,r.kt)("h4",{id:"attributes-6"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"failureThreshold")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimum consecutive failures for the probe to be considered failed after having succeeded."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"initialDelaySeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"The number of seconds before health checking is activated.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"periodSeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"How often (in seconds) to perform the probe."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"probeHandler")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#exec"},"Exec")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#http"},"Http")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"#tcp"},"Tcp"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"successThreshold")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Minimum consecutive successes for the probe to be considered successful after having failed."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"terminationGracePeriod")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"Duration in seconds before terminate gracefully upon probe failure."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"timeoutSeconds")),(0,r.kt)("td",{parentName:"tr",align:null},"int"),(0,r.kt)("td",{parentName:"tr",align:null},"The number of seconds after which the probe times out.",(0,r.kt)("br",null),"More info: ",(0,r.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes"},"https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle#container-probes")),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-6"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\nprobe = p.Probe {\n probeHandler: p.Http {\n path: "/healthz"\n }\n initialDelaySeconds: 10\n}\n')),(0,r.kt)("h3",{id:"schema-tcp"},"Schema Tcp"),(0,r.kt)("p",null,"Tcp describes an action based on opening a socket."),(0,r.kt)("h4",{id:"attributes-7"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"url")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},"str"),(0,r.kt)("td",{parentName:"tr",align:null},"The full qualified url to open a socket."),(0,r.kt)("td",{parentName:"tr",align:null})))),(0,r.kt)("h4",{id:"examples-7"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'import kam.workload.container.probe as p\n\ntcpProbe = p.Tcp {\n url: "tcp://localhost:1234"\n}\n')),(0,r.kt)("h2",{id:"schema-secret"},"Schema Secret"),(0,r.kt)("p",null,"Secret can be used to store sensitive data."),(0,r.kt)("h3",{id:"attributes-8"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"name"),(0,r.kt)("th",{parentName:"tr",align:null},"type"),(0,r.kt)("th",{parentName:"tr",align:null},"description"),(0,r.kt)("th",{parentName:"tr",align:null},"default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"data")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Data contains the non-binary secret data in string form."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"immutable")),(0,r.kt)("td",{parentName:"tr",align:null},"bool"),(0,r.kt)("td",{parentName:"tr",align:null},"Immutable, if set to true, ensures that data stored in the Secret cannot be updated."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"params")),(0,r.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Collection of parameters used to facilitate programmatic handling of secret data."),(0,r.kt)("td",{parentName:"tr",align:null})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"type")," ",(0,r.kt)("inlineCode",{parentName:"td"},"required")),(0,r.kt)("td",{parentName:"tr",align:null},'"basic"'),(0,r.kt)("td",{parentName:"tr",align:null},'"token"'),(0,r.kt)("td",{parentName:"tr",align:null},'"opaque"')))),(0,r.kt)("h3",{id:"examples-8"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.secret as sec\n\nbasicAuth = sec.Secret {\n type: "basic"\n data: {\n "username": ""\n "password": ""\n }\n}\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e86c9445.6f7a9de5.js b/assets/js/e86c9445.6f7a9de5.js deleted file mode 100644 index addc2acfca9..00000000000 --- a/assets/js/e86c9445.6f7a9de5.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[466],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),d=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=d(e.components);return r.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=d(n),m=a,k=u["".concat(s,".").concat(m)]||u[m]||c[m]||o;return n?r.createElement(k,l(l({ref:t},p),{},{components:n})):r.createElement(k,l({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=u;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var r=n(87462),a=(n(67294),n(3905));const o={id:"naming-conventions",sidebar_label:"Resource Naming Conventions"},l="Resource Naming Conventions",i={unversionedId:"reference/modules/naming-conventions",id:"version-v0.10/reference/modules/naming-conventions",title:"Resource Naming Conventions",description:"Kusion will automatically create Kubernetes or Terraform resources for the applications, many of which do not require users' awareness. This document will introduce the naming conventions for these related resources.",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/3-naming-conventions.md",sourceDirName:"6-reference/2-modules",slug:"/reference/modules/naming-conventions",permalink:"/docs/v0.10/reference/modules/naming-conventions",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/3-naming-conventions.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{id:"naming-conventions",sidebar_label:"Resource Naming Conventions"},sidebar:"kusion",previous:{title:"service",permalink:"/docs/v0.10/reference/modules/workspace-configs/workload/service"},next:{title:"Roadmap",permalink:"/docs/v0.10/reference/roadmap"}},s={},d=[{value:"Kubernetes Resources",id:"kubernetes-resources",level:2},{value:"Terraform Resources",id:"terraform-resources",level:2}],p={toc:d};function c(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"resource-naming-conventions"},"Resource Naming Conventions"),(0,a.kt)("p",null,"Kusion will automatically create Kubernetes or Terraform resources for the applications, many of which do not require users' awareness. This document will introduce the naming conventions for these related resources. "),(0,a.kt)("h2",{id:"kubernetes-resources"},"Kubernetes Resources"),(0,a.kt)("p",null,"Kusion adheres to specific rules when generating the Kubernetes resources for users' applications. The table below lists some common Kubernetes resource naming conventions. Note that ",(0,a.kt)("inlineCode",{parentName:"p"},"Namespace")," can now be specified by users. "),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Resource"),(0,a.kt)("th",{parentName:"tr",align:null},"Concatenation Rule"),(0,a.kt)("th",{parentName:"tr",align:null},"Example ID"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"Namespace"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"v1:Namespace:wordpress-local-db")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"Deployment"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"apps/v1:Deployment:wordpress-local-db:wordpress-local-db-dev-wordpress")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"CronJob"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"batch/v1:CronJob:helloworld:helloworld-dev-helloworld")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"Service"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"}," or ")),(0,a.kt)("td",{parentName:"tr",align:null},"v1:Service:helloworld:helloworld-dev-helloworld-public")))),(0,a.kt)("h2",{id:"terraform-resources"},"Terraform Resources"),(0,a.kt)("p",null,"Similarly, Kusion also adheres to specific naming conventions when generating the Terraform Resources. Some common resources are listed below. "),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Resource"),(0,a.kt)("th",{parentName:"tr",align:null},"Concatenation Rule"),(0,a.kt)("th",{parentName:"tr",align:null},"Example ID"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"random_password"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"hashicorp:random:random_password:wordpress-db-mysql")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"aws_security_group"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"hashicorp:aws:aws_security_group:wordpress-db-mysql")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"aws_db_instance"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"hashicorp:aws:aws_db_instance:wordpress-db")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"alicloud_db_instance"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"aliyun:alicloud:alicloud_db_instance:wordpress-db")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"alicloud_db_connection"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"aliyun:alicloud:alicloud_db_connection:wordpress")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"alicloud_rds_account"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"aliyun:alicloud:alicloud_rds_account:wordpress")))),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"")," is composed of two parts, one of which is the ",(0,a.kt)("inlineCode",{parentName:"p"},"key")," of database declared in ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," and the other is the ",(0,a.kt)("inlineCode",{parentName:"p"},"suffix")," declared in ",(0,a.kt)("inlineCode",{parentName:"p"},"workspace")," configuration. Kusion will concatenate the database key and suffix, convert them to uppercase, and replace ",(0,a.kt)("inlineCode",{parentName:"p"},"-")," with ",(0,a.kt)("inlineCode",{parentName:"p"},"_"),". And the ",(0,a.kt)("inlineCode",{parentName:"p"},"")," supported now includes ",(0,a.kt)("inlineCode",{parentName:"p"},"mysql")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"postgres"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e86c9445.89363706.js b/assets/js/e86c9445.89363706.js new file mode 100644 index 00000000000..4a6a6b6283b --- /dev/null +++ b/assets/js/e86c9445.89363706.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[466],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),d=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},p=function(e){var t=d(e.components);return r.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=d(n),m=a,k=u["".concat(s,".").concat(m)]||u[m]||c[m]||o;return n?r.createElement(k,l(l({ref:t},p),{},{components:n})):r.createElement(k,l({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,l=new Array(o);l[0]=u;var i={};for(var s in t)hasOwnProperty.call(t,s)&&(i[s]=t[s]);i.originalType=e,i.mdxType="string"==typeof e?e:a,l[1]=i;for(var d=2;d{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>d});var r=n(87462),a=(n(67294),n(3905));const o={id:"naming-conventions",sidebar_label:"Resource Naming Conventions"},l="Resource Naming Conventions",i={unversionedId:"reference/modules/naming-conventions",id:"version-v0.10/reference/modules/naming-conventions",title:"Resource Naming Conventions",description:"Kusion will automatically create Kubernetes or Terraform resources for the applications, many of which do not require users' awareness. This document will introduce the naming conventions for these related resources.",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/3-naming-conventions.md",sourceDirName:"6-reference/2-modules",slug:"/reference/modules/naming-conventions",permalink:"/docs/v0.10/reference/modules/naming-conventions",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/3-naming-conventions.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:3,frontMatter:{id:"naming-conventions",sidebar_label:"Resource Naming Conventions"},sidebar:"kusion",previous:{title:"service",permalink:"/docs/v0.10/reference/modules/workspace-configs/workload/service"},next:{title:"Roadmap",permalink:"/docs/v0.10/reference/roadmap"}},s={},d=[{value:"Kubernetes Resources",id:"kubernetes-resources",level:2},{value:"Terraform Resources",id:"terraform-resources",level:2}],p={toc:d};function c(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"resource-naming-conventions"},"Resource Naming Conventions"),(0,a.kt)("p",null,"Kusion will automatically create Kubernetes or Terraform resources for the applications, many of which do not require users' awareness. This document will introduce the naming conventions for these related resources. "),(0,a.kt)("h2",{id:"kubernetes-resources"},"Kubernetes Resources"),(0,a.kt)("p",null,"Kusion adheres to specific rules when generating the Kubernetes resources for users' applications. The table below lists some common Kubernetes resource naming conventions. Note that ",(0,a.kt)("inlineCode",{parentName:"p"},"Namespace")," can now be specified by users. "),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Resource"),(0,a.kt)("th",{parentName:"tr",align:null},"Concatenation Rule"),(0,a.kt)("th",{parentName:"tr",align:null},"Example ID"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"Namespace"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"v1:Namespace:wordpress-local-db")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"Deployment"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"apps/v1:Deployment:wordpress-local-db:wordpress-local-db-dev-wordpress")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"CronJob"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"batch/v1:CronJob:helloworld:helloworld-dev-helloworld")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"Service"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"}," or ")),(0,a.kt)("td",{parentName:"tr",align:null},"v1:Service:helloworld:helloworld-dev-helloworld-public")))),(0,a.kt)("h2",{id:"terraform-resources"},"Terraform Resources"),(0,a.kt)("p",null,"Similarly, Kusion also adheres to specific naming conventions when generating the Terraform Resources. Some common resources are listed below. "),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Resource"),(0,a.kt)("th",{parentName:"tr",align:null},"Concatenation Rule"),(0,a.kt)("th",{parentName:"tr",align:null},"Example ID"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"random_password"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"hashicorp:random:random_password:wordpress-db-mysql")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"aws_security_group"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},""),"-",(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"hashicorp:aws:aws_security_group:wordpress-db-mysql")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"aws_db_instance"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"hashicorp:aws:aws_db_instance:wordpress-db")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"alicloud_db_instance"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"aliyun:alicloud:alicloud_db_instance:wordpress-db")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"alicloud_db_connection"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"aliyun:alicloud:alicloud_db_connection:wordpress")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},"alicloud_rds_account"),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("inlineCode",{parentName:"td"},"")),(0,a.kt)("td",{parentName:"tr",align:null},"aliyun:alicloud:alicloud_rds_account:wordpress")))),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"")," is composed of two parts, one of which is the ",(0,a.kt)("inlineCode",{parentName:"p"},"key")," of database declared in ",(0,a.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," and the other is the ",(0,a.kt)("inlineCode",{parentName:"p"},"suffix")," declared in ",(0,a.kt)("inlineCode",{parentName:"p"},"workspace")," configuration. Kusion will concatenate the database key and suffix, convert them to uppercase, and replace ",(0,a.kt)("inlineCode",{parentName:"p"},"-")," with ",(0,a.kt)("inlineCode",{parentName:"p"},"_"),". And the ",(0,a.kt)("inlineCode",{parentName:"p"},"")," supported now includes ",(0,a.kt)("inlineCode",{parentName:"p"},"mysql")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"postgres"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e8d372a7.a591a1f2.js b/assets/js/e8d372a7.3be01d80.js similarity index 54% rename from assets/js/e8d372a7.a591a1f2.js rename to assets/js/e8d372a7.3be01d80.js index 2528fc12be6..6bf32486c18 100644 --- a/assets/js/e8d372a7.a591a1f2.js +++ b/assets/js/e8d372a7.3be01d80.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1937],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),d=p(r),m=o,k=d["".concat(i,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(k,s(s({ref:t},l),{},{components:r})):n.createElement(k,s({ref:t},l))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=d;var c={};for(var i in t)hasOwnProperty.call(t,i)&&(c[i]=t[i]);c.originalType=e,c.mdxType="string"==typeof e?e:o,s[1]=c;for(var p=2;p{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion workspace switch",c={unversionedId:"reference/commands/kusion-workspace-switch",id:"version-v0.11/reference/commands/kusion-workspace-switch",title:"kusion workspace switch",description:"Switch the current workspace",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-switch.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-switch",permalink:"/docs/reference/commands/kusion-workspace-switch",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-switch.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace show",permalink:"/docs/reference/commands/kusion-workspace-show"},next:{title:"kusion workspace update",permalink:"/docs/reference/commands/kusion-workspace-update"}},i={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-switch"},"kusion workspace switch"),(0,o.kt)("p",null,"Switch the current workspace"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command switches the workspace, where the workspace must be created."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace switch\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Switch the current workspace\n kusion workspace switch dev\n \n # Switch the current workspace in a specified backend\n kusion workspace switch prod --backend oss-prod\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string the backend name\n -h, --help help for switch\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1937],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>m});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var i=n.createContext({}),p=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(i.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,i=e.parentName,l=c(e,["components","mdxType","originalType","parentName"]),d=p(r),m=o,k=d["".concat(i,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(k,s(s({ref:t},l),{},{components:r})):n.createElement(k,s({ref:t},l))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=d;var c={};for(var i in t)hasOwnProperty.call(t,i)&&(c[i]=t[i]);c.originalType=e,c.mdxType="string"==typeof e?e:o,s[1]=c;for(var p=2;p{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion workspace switch",c={unversionedId:"reference/commands/kusion-workspace-switch",id:"version-v0.11/reference/commands/kusion-workspace-switch",title:"kusion workspace switch",description:"Switch the current workspace",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-switch.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-switch",permalink:"/docs/reference/commands/kusion-workspace-switch",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-switch.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace show",permalink:"/docs/reference/commands/kusion-workspace-show"},next:{title:"kusion workspace update",permalink:"/docs/reference/commands/kusion-workspace-update"}},i={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-switch"},"kusion workspace switch"),(0,o.kt)("p",null,"Switch the current workspace"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command switches the workspace, where the workspace must be created."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace switch\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Switch the current workspace\n kusion workspace switch dev\n \n # Switch the current workspace in a specified backend\n kusion workspace switch prod --backend oss-prod\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," --backend string the backend name\n -h, --help help for switch\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ec5071fd.1f58f84c.js b/assets/js/ec5071fd.1f58f84c.js deleted file mode 100644 index cffca08cb2f..00000000000 --- a/assets/js/ec5071fd.1f58f84c.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6234],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>u});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),m=s(n),u=r,g=m["".concat(p,".").concat(u)]||m[u]||c[u]||o;return n?a.createElement(g,l(l({ref:t},d),{},{components:n})):a.createElement(g,l({ref:t},d))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=m;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>s});var a=n(87462),r=(n(67294),n(3905));const o={},l="appconfiguration",i={unversionedId:"reference/modules/catalog-models/app-configuration",id:"version-v0.10/reference/modules/catalog-models/app-configuration",title:"appconfiguration",description:"Schema AppConfiguration",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/app-configuration.md",sourceDirName:"6-reference/2-modules/1-catalog-models",slug:"/reference/modules/catalog-models/app-configuration",permalink:"/docs/v0.10/reference/modules/catalog-models/app-configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/app-configuration.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Kusion Modules",permalink:"/docs/v0.10/reference/modules/"},next:{title:"mysql",permalink:"/docs/v0.10/reference/modules/catalog-models/database/mysql"}},p={},s=[{value:"Schema AppConfiguration",id:"schema-appconfiguration",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],d={toc:s};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"appconfiguration"},"appconfiguration"),(0,r.kt)("h2",{id:"schema-appconfiguration"},"Schema AppConfiguration"),(0,r.kt)("p",null,"AppConfiguration is a developer-centric definition that describes how to run an Application.",(0,r.kt)("br",null),"This application model builds upon a decade of experience at AntGroup running super large scale",(0,r.kt)("br",null),"internal developer platform, combined with best-of-breed ideas and practices from the community."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"workload"),(0,r.kt)("br",null),"Workload defines how to run your application code. Currently supported workload profile",(0,r.kt)("br",null),"includes Service and Job."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"workload/service#schema-service"},"workload.Service")," \\ "),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"workload/job#schema-job"},"workload.Job")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"opsRule"),(0,r.kt)("br",null),"OpsRule specifies collection of rules that will be checked for Day-2 operation."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"trait/opsrule#schema-opsrule"},"trait.OpsRule")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"database"),(0,r.kt)("br",null),"Database describes a locally deployed or a cloud provider managed database instance for the workload."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"database/mysql#schema-mysql"},"mysql.MySQL")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"database/postgres#schema-postgresql"},"postgres.PostgreSQL"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"monitoring")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"monitoring/prometheus#schema-prometheus"},"monitoring.Prometheus")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"labels")),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"annotations")),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'# Instantiate an App with a long-running service and its image is "nginx:v1"\n\nimport catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.accessories.database as db\nimport catalog.models.schema.v1.accessories.monitoring as m\nimport catalog.models.schema.v1.accessories.trait as t\n\nappConfiguration = ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "nginx": c.Container {\n image: "nginx:v1"\n }\n }\n type: "CollaSet"\n }\n opsRule: t.OpsRule {\n maxUnavailable: "30%"\n }\n database: db.Database {\n type: "aws"\n engine: "mysql"\n version: "5.7"\n instanceType: "db.t3.micro"\n }\n monitoring: m.Prometheus{\n interval: "30s"\n timeout: "15s"\n path: "/metrics"\n port: "web"\n scheme: "http"\n }\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ec5071fd.27ec8539.js b/assets/js/ec5071fd.27ec8539.js new file mode 100644 index 00000000000..af14ce855a8 --- /dev/null +++ b/assets/js/ec5071fd.27ec8539.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6234],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>u});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},d=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,d=i(e,["components","mdxType","originalType","parentName"]),m=s(n),u=r,g=m["".concat(p,".").concat(u)]||m[u]||c[u]||o;return n?a.createElement(g,l(l({ref:t},d),{},{components:n})):a.createElement(g,l({ref:t},d))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,l=new Array(o);l[0]=m;var i={};for(var p in t)hasOwnProperty.call(t,p)&&(i[p]=t[p]);i.originalType=e,i.mdxType="string"==typeof e?e:r,l[1]=i;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>i,toc:()=>s});var a=n(87462),r=(n(67294),n(3905));const o={},l="appconfiguration",i={unversionedId:"reference/modules/catalog-models/app-configuration",id:"version-v0.10/reference/modules/catalog-models/app-configuration",title:"appconfiguration",description:"Schema AppConfiguration",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/app-configuration.md",sourceDirName:"6-reference/2-modules/1-catalog-models",slug:"/reference/modules/catalog-models/app-configuration",permalink:"/docs/v0.10/reference/modules/catalog-models/app-configuration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/app-configuration.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"Kusion Modules",permalink:"/docs/v0.10/reference/modules/"},next:{title:"mysql",permalink:"/docs/v0.10/reference/modules/catalog-models/database/mysql"}},p={},s=[{value:"Schema AppConfiguration",id:"schema-appconfiguration",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],d={toc:s};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"appconfiguration"},"appconfiguration"),(0,r.kt)("h2",{id:"schema-appconfiguration"},"Schema AppConfiguration"),(0,r.kt)("p",null,"AppConfiguration is a developer-centric definition that describes how to run an Application.",(0,r.kt)("br",null),"This application model builds upon a decade of experience at AntGroup running super large scale",(0,r.kt)("br",null),"internal developer platform, combined with best-of-breed ideas and practices from the community."),(0,r.kt)("h3",{id:"attributes"},"Attributes"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,r.kt)("th",{parentName:"tr",align:null},"Type"),(0,r.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,r.kt)("th",{parentName:"tr",align:null},"Required"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"workload"),(0,r.kt)("br",null),"Workload defines how to run your application code. Currently supported workload profile",(0,r.kt)("br",null),"includes Service and Job."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"workload/service#schema-service"},"workload.Service")," \\ "),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"workload/job#schema-job"},"workload.Job")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"opsRule"),(0,r.kt)("br",null),"OpsRule specifies collection of rules that will be checked for Day-2 operation."),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"trait/opsrule#schema-opsrule"},"trait.OpsRule")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"database"),(0,r.kt)("br",null),"Database describes a locally deployed or a cloud provider managed database instance for the workload."),(0,r.kt)("td",{parentName:"tr",align:null},"{str: ",(0,r.kt)("a",{parentName:"td",href:"database/mysql#schema-mysql"},"mysql.MySQL")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"database/postgres#schema-postgresql"},"postgres.PostgreSQL"),"}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"monitoring")),(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("a",{parentName:"td",href:"monitoring/prometheus#schema-prometheus"},"monitoring.Prometheus")),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"labels")),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},"annotations")),(0,r.kt)("td",{parentName:"tr",align:null},"{str: str}"),(0,r.kt)("td",{parentName:"tr",align:null},"Undefined"),(0,r.kt)("td",{parentName:"tr",align:null},"optional")))),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-python"},'# Instantiate an App with a long-running service and its image is "nginx:v1"\n\nimport catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.accessories.database as db\nimport catalog.models.schema.v1.accessories.monitoring as m\nimport catalog.models.schema.v1.accessories.trait as t\n\nappConfiguration = ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "nginx": c.Container {\n image: "nginx:v1"\n }\n }\n type: "CollaSet"\n }\n opsRule: t.OpsRule {\n maxUnavailable: "30%"\n }\n database: db.Database {\n type: "aws"\n engine: "mysql"\n version: "5.7"\n instanceType: "db.t3.micro"\n }\n monitoring: m.Prometheus{\n interval: "30s"\n timeout: "15s"\n path: "/metrics"\n port: "web"\n scheme: "http"\n }\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ed44aa5e.1aec9ae5.js b/assets/js/ed44aa5e.1aec9ae5.js new file mode 100644 index 00000000000..14e68cfd405 --- /dev/null +++ b/assets/js/ed44aa5e.1aec9ae5.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3849],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var i=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var l=i.createContext({}),s=function(e){var n=i.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=s(e.components);return i.createElement(l.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return i.createElement(i.Fragment,{},n)}},u=i.forwardRef((function(e,n){var t=e.components,r=e.mdxType,a=e.originalType,l=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),u=s(t),m=r,g=u["".concat(l,".").concat(m)]||u[m]||d[m]||a;return t?i.createElement(g,o(o({ref:n},c),{},{components:t})):i.createElement(g,o({ref:n},c))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var a=t.length,o=new Array(a);o[0]=u;var p={};for(var l in n)hasOwnProperty.call(n,l)&&(p[l]=n[l]);p.originalType=e,p.mdxType="string"==typeof e?e:r,o[1]=p;for(var s=2;s{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>p,toc:()=>s});var i=t(87462),r=(t(67294),t(3905));const a={},o="Upgrade Image",p={unversionedId:"user-guides/working-with-k8s/image-upgrade",id:"version-v0.10/user-guides/working-with-k8s/image-upgrade",title:"Upgrade Image",description:"You can declare the application's container image via image field of the Container schema.",source:"@site/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/4-image-upgrade.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/image-upgrade",permalink:"/docs/v0.10/user-guides/working-with-k8s/image-upgrade",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/4-image-upgrade.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:4,frontMatter:{},sidebar:"kusion",previous:{title:"Expose Service",permalink:"/docs/v0.10/user-guides/working-with-k8s/service"},next:{title:"Configure Resource Specification",permalink:"/docs/v0.10/user-guides/working-with-k8s/resource-spec"}},l={},s=[{value:"Pre-requisite",id:"pre-requisite",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],c={toc:s};function d(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,i.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"upgrade-image"},"Upgrade Image"),(0,r.kt)("p",null,"You can declare the application's container image via ",(0,r.kt)("inlineCode",{parentName:"p"},"image")," field of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Container")," schema."),(0,r.kt)("p",null,"For the full ",(0,r.kt)("inlineCode",{parentName:"p"},"Container")," schema reference, please see ",(0,r.kt)("a",{parentName:"p",href:"../../reference/modules/catalog-models/workload/service#schema-container"},"here")," for more details."),(0,r.kt)("h2",{id:"pre-requisite"},"Pre-requisite"),(0,r.kt)("p",null,"Please refer to the ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,r.kt)("p",null,"The example below also requires you to have ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,r.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,r.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,r.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,r.kt)("h2",{id:"example"},"Example"),(0,r.kt)("p",null,"Update the image value in ",(0,r.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-py"},'import catalog.models.schema.v1 as ac\n\nhelloworld: ac.AppConfiguration {\n workload.containers.nginx: {\n ...\n # before: \n # image = "gcr.io/google-samples/gb-frontend:v4"\n # after: \n image = "gcr.io/google-samples/gb-frontend:v5"\n ...\n }\n}\n')),(0,r.kt)("p",null,"Everything else in ",(0,r.kt)("inlineCode",{parentName:"p"},"main.k")," stay the same."),(0,r.kt)("h2",{id:"applying"},"Applying"),(0,r.kt)("p",null,"Re-run steps in ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", update image is completed."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Intent in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private UnChanged\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Update\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS UnChanged v1:Service:simple-service:simple-service-dev-helloworld-private, skip \n SUCCESS Update apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \nUpdate apps/v1:Deployment:simple-service:simple-service-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,r.kt)("h2",{id:"validation"},"Validation"),(0,r.kt)("p",null,"We can verify the application container (in the deployment template) now has the updated image (v5) as defined in the container configuration:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kubectl get deployment -n simple-service -o yaml\n...\n template:\n ...\n spec:\n containers:\n - env:\n ...\n image: gcr.io/google-samples/gb-frontend:v5\n ...\n...\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ed44aa5e.c9cfe6ea.js b/assets/js/ed44aa5e.c9cfe6ea.js deleted file mode 100644 index b87d8286eb9..00000000000 --- a/assets/js/ed44aa5e.c9cfe6ea.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3849],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var i=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var l=i.createContext({}),s=function(e){var n=i.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=s(e.components);return i.createElement(l.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return i.createElement(i.Fragment,{},n)}},u=i.forwardRef((function(e,n){var t=e.components,r=e.mdxType,a=e.originalType,l=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),u=s(t),m=r,g=u["".concat(l,".").concat(m)]||u[m]||d[m]||a;return t?i.createElement(g,o(o({ref:n},c),{},{components:t})):i.createElement(g,o({ref:n},c))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var a=t.length,o=new Array(a);o[0]=u;var p={};for(var l in n)hasOwnProperty.call(n,l)&&(p[l]=n[l]);p.originalType=e,p.mdxType="string"==typeof e?e:r,o[1]=p;for(var s=2;s{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>p,toc:()=>s});var i=t(87462),r=(t(67294),t(3905));const a={},o="Upgrade Image",p={unversionedId:"user-guides/working-with-k8s/image-upgrade",id:"version-v0.10/user-guides/working-with-k8s/image-upgrade",title:"Upgrade Image",description:"You can declare the application's container image via image field of the Container schema.",source:"@site/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/4-image-upgrade.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/image-upgrade",permalink:"/docs/v0.10/user-guides/working-with-k8s/image-upgrade",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/4-image-upgrade.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:4,frontMatter:{},sidebar:"kusion",previous:{title:"Expose Service",permalink:"/docs/v0.10/user-guides/working-with-k8s/service"},next:{title:"Configure Resource Specification",permalink:"/docs/v0.10/user-guides/working-with-k8s/resource-spec"}},l={},s=[{value:"Pre-requisite",id:"pre-requisite",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Applying",id:"applying",level:2},{value:"Validation",id:"validation",level:2}],c={toc:s};function d(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,i.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"upgrade-image"},"Upgrade Image"),(0,r.kt)("p",null,"You can declare the application's container image via ",(0,r.kt)("inlineCode",{parentName:"p"},"image")," field of the ",(0,r.kt)("inlineCode",{parentName:"p"},"Container")," schema."),(0,r.kt)("p",null,"For the full ",(0,r.kt)("inlineCode",{parentName:"p"},"Container")," schema reference, please see ",(0,r.kt)("a",{parentName:"p",href:"../../reference/modules/catalog-models/workload/service#schema-container"},"here")," for more details."),(0,r.kt)("h2",{id:"pre-requisite"},"Pre-requisite"),(0,r.kt)("p",null,"Please refer to the ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,r.kt)("p",null,"The example below also requires you to have ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,r.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,r.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,r.kt)("p",null,"In the first guide in this series, we introduced a step to ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,r.kt)("h2",{id:"example"},"Example"),(0,r.kt)("p",null,"Update the image value in ",(0,r.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-py"},'import catalog.models.schema.v1 as ac\n\nhelloworld: ac.AppConfiguration {\n workload.containers.nginx: {\n ...\n # before: \n # image = "gcr.io/google-samples/gb-frontend:v4"\n # after: \n image = "gcr.io/google-samples/gb-frontend:v5"\n ...\n }\n}\n')),(0,r.kt)("p",null,"Everything else in ",(0,r.kt)("inlineCode",{parentName:"p"},"main.k")," stay the same."),(0,r.kt)("h2",{id:"applying"},"Applying"),(0,r.kt)("p",null,"Re-run steps in ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", update image is completed."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Intent in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private UnChanged\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Update\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS UnChanged v1:Service:simple-service:simple-service-dev-helloworld-private, skip \n SUCCESS Update apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \nUpdate apps/v1:Deployment:simple-service:simple-service-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,r.kt)("h2",{id:"validation"},"Validation"),(0,r.kt)("p",null,"We can verify the application container (in the deployment template) now has the updated image (v5) as defined in the container configuration:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kubectl get deployment -n simple-service -o yaml\n...\n template:\n ...\n spec:\n containers:\n - env:\n ...\n image: gcr.io/google-samples/gb-frontend:v5\n ...\n...\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ee6d0512.6863f847.js b/assets/js/ee6d0512.f0855176.js similarity index 82% rename from assets/js/ee6d0512.6863f847.js rename to assets/js/ee6d0512.f0855176.js index 2259dc26924..89751246f82 100644 --- a/assets/js/ee6d0512.6863f847.js +++ b/assets/js/ee6d0512.f0855176.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2121],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>d});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),f=l(r),d=o,m=f["".concat(s,".").concat(d)]||f[d]||u[d]||a;return r?n.createElement(m,i(i({ref:t},p),{},{components:r})):n.createElement(m,i({ref:t},p))}));function d(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:o,i[1]=c;for(var l=2;l{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:2},i="KCL",c={unversionedId:"faq/kcl",id:"faq/kcl",title:"KCL",description:"Visit the KCL website for more documents.",source:"@site/docs/kusion/7-faq/2-kcl.md",sourceDirName:"7-faq",slug:"/faq/kcl",permalink:"/docs/next/faq/kcl",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/7-faq/2-kcl.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"kusion",previous:{title:"Installation",permalink:"/docs/next/faq/install-error"}},s={},l=[],p={toc:l};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kcl"},"KCL"),(0,o.kt)("p",null,"Visit the ",(0,o.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/user_docs/support/faq-kcl"},"KCL website")," for more documents."))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2121],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>d});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},f=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),f=l(r),d=o,m=f["".concat(s,".").concat(d)]||f[d]||u[d]||a;return r?n.createElement(m,i(i({ref:t},p),{},{components:r})):n.createElement(m,i({ref:t},p))}));function d(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=f;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:o,i[1]=c;for(var l=2;l{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>c,toc:()=>l});var n=r(87462),o=(r(67294),r(3905));const a={sidebar_position:2},i="KCL",c={unversionedId:"faq/kcl",id:"faq/kcl",title:"KCL",description:"Visit the KCL website for more documents.",source:"@site/docs/kusion/7-faq/2-kcl.md",sourceDirName:"7-faq",slug:"/faq/kcl",permalink:"/docs/next/faq/kcl",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/7-faq/2-kcl.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{sidebar_position:2},sidebar:"kusion",previous:{title:"Installation",permalink:"/docs/next/faq/install-error"}},s={},l=[],p={toc:l};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kcl"},"KCL"),(0,o.kt)("p",null,"Visit the ",(0,o.kt)("a",{parentName:"p",href:"https://kcl-lang.io/docs/user_docs/support/faq-kcl"},"KCL website")," for more documents."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f0c48f07.34e650bc.js b/assets/js/f0c48f07.34e650bc.js new file mode 100644 index 00000000000..97b928f383e --- /dev/null +++ b/assets/js/f0c48f07.34e650bc.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5664],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),p=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=p(e.components);return a.createElement(s.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(t),m=r,k=u["".concat(s,".").concat(m)]||u[m]||d[m]||i;return t?a.createElement(k,o(o({ref:n},c),{},{components:t})):a.createElement(k,o({ref:n},c))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=u;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var p=2;p{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>o,default:()=>d,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var a=t(87462),r=(t(67294),t(3905));const i={},o="Configure Containers",l={unversionedId:"user-guides/working-with-k8s/container",id:"version-v0.10/user-guides/working-with-k8s/container",title:"Configure Containers",description:"You can manage container-level configurations in the AppConfiguration model via the containers field (under the workload schemas). By default, everything defined in the containers field will be treated as application containers. Sidecar containers will be supported in a future version of kusion.",source:"@site/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/2-container.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/container",permalink:"/docs/v0.10/user-guides/working-with-k8s/container",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/2-container.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{},sidebar:"kusion",previous:{title:"Deploy Application",permalink:"/docs/v0.10/user-guides/working-with-k8s/deploy-application"},next:{title:"Expose Service",permalink:"/docs/v0.10/user-guides/working-with-k8s/service"}},s={},p=[{value:"Pre-requisite",id:"pre-requisite",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Apply",id:"apply",level:2},{value:"Validation",id:"validation",level:2}],c={toc:p};function d(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"configure-containers"},"Configure Containers"),(0,r.kt)("p",null,"You can manage container-level configurations in the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model via the ",(0,r.kt)("inlineCode",{parentName:"p"},"containers")," field (under the ",(0,r.kt)("inlineCode",{parentName:"p"},"workload")," schemas). By default, everything defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"containers")," field will be treated as application containers. Sidecar containers will be supported in a future version of kusion."),(0,r.kt)("p",null,"For the full ",(0,r.kt)("inlineCode",{parentName:"p"},"Container")," schema reference, please see ",(0,r.kt)("a",{parentName:"p",href:"../../reference/modules/catalog-models/workload/service#schema-container"},"here")," for more details."),(0,r.kt)("h2",{id:"pre-requisite"},"Pre-requisite"),(0,r.kt)("p",null,"Please refer to the ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,r.kt)("p",null,"The example below also requires you to have ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,r.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,r.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,r.kt)("p",null,"In the last guide, we introduced a step to ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,r.kt)("p",null,"However, if you (or the platform team) would like to set default values for the workloads to standardize the behavior of applications in the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace, you can do so by updating the ",(0,r.kt)("inlineCode",{parentName:"p"},"~/dev.yaml"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n service:\n default:\n replicas: 3\n labels:\n label-key: label-value\n annotations:\n annotation-key: annotation-value\n type: CollaSet\n")),(0,r.kt)("p",null,"Please note that the ",(0,r.kt)("inlineCode",{parentName:"p"},"replicas")," in the workspace configuration only works as a default value and will be overridden by the value set in the application configuration."),(0,r.kt)("p",null,"The workspace configuration need to be updated with the command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace update dev -f ~/dev.yaml\n")),(0,r.kt)("p",null,"For a full reference of what can be configured in the workspace level, please see the ",(0,r.kt)("a",{parentName:"p",href:"../../reference/modules/workspace-configs/workload/service"},"workspace reference"),"."),(0,r.kt)("h2",{id:"example"},"Example"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-py"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.network as n\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "helloworld": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v4"\n env: {\n "env1": "VALUE"\n "env2": "VALUE2"\n }\n resources: {\n "cpu": "500m"\n "memory": "512M"\n }\n # Configure an HTTP readiness probe\n readinessProbe: p.Probe {\n probeHandler: p.Http {\n url: "http://localhost:80"\n }\n initialDelaySeconds: 10\n }\n }\n }\n replicas: 2\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n}\n')),(0,r.kt)("h2",{id:"apply"},"Apply"),(0,r.kt)("p",null,"Re-run steps in ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", new container configuration can be applied."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Intent in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private UnChanged\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Update\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS UnChanged v1:Service:simple-service:simple-service-dev-helloworld-private, skip \n SUCCESS Update apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \nUpdate apps/v1:Deployment:simple-service:simple-service-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,r.kt)("h2",{id:"validation"},"Validation"),(0,r.kt)("p",null,"We can verify the container (in the deployment template) now has the updated attributes as defined in the container configuration:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"$ kubectl get deployment -n simple-service -o yaml\n...\n template:\n ...\n spec:\n containers:\n - env:\n - name: env1\n value: VALUE\n - name: env2\n value: VALUE2\n image: gcr.io/google-samples/gb-frontend:v4\n imagePullPolicy: IfNotPresent\n name: helloworld\n readinessProbe:\n failureThreshold: 3\n httpGet:\n host: localhost\n path: /\n port: 80\n scheme: HTTP\n initialDelaySeconds: 10\n periodSeconds: 10\n successThreshold: 1\n timeoutSeconds: 1\n resources:\n limits:\n cpu: 500m\n memory: 512M\n...\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f0c48f07.c7c9d3c6.js b/assets/js/f0c48f07.c7c9d3c6.js deleted file mode 100644 index 62b11160134..00000000000 --- a/assets/js/f0c48f07.c7c9d3c6.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5664],{3905:(e,n,t)=>{t.d(n,{Zo:()=>c,kt:()=>m});var a=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);n&&(a=a.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,a)}return t}function o(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var s=a.createContext({}),p=function(e){var n=a.useContext(s),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},c=function(e){var n=p(e.components);return a.createElement(s.Provider,{value:n},e.children)},d={inlineCode:"code",wrapper:function(e){var n=e.children;return a.createElement(a.Fragment,{},n)}},u=a.forwardRef((function(e,n){var t=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(t),m=r,k=u["".concat(s,".").concat(m)]||u[m]||d[m]||i;return t?a.createElement(k,o(o({ref:n},c),{},{components:t})):a.createElement(k,o({ref:n},c))}));function m(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var i=t.length,o=new Array(i);o[0]=u;var l={};for(var s in n)hasOwnProperty.call(n,s)&&(l[s]=n[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,o[1]=l;for(var p=2;p{t.r(n),t.d(n,{assets:()=>s,contentTitle:()=>o,default:()=>d,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var a=t(87462),r=(t(67294),t(3905));const i={},o="Configure Containers",l={unversionedId:"user-guides/working-with-k8s/container",id:"version-v0.10/user-guides/working-with-k8s/container",title:"Configure Containers",description:"You can manage container-level configurations in the AppConfiguration model via the containers field (under the workload schemas). By default, everything defined in the containers field will be treated as application containers. Sidecar containers will be supported in a future version of kusion.",source:"@site/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/2-container.md",sourceDirName:"5-user-guides/2-working-with-k8s",slug:"/user-guides/working-with-k8s/container",permalink:"/docs/v0.10/user-guides/working-with-k8s/container",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/2-container.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:2,frontMatter:{},sidebar:"kusion",previous:{title:"Deploy Application",permalink:"/docs/v0.10/user-guides/working-with-k8s/deploy-application"},next:{title:"Expose Service",permalink:"/docs/v0.10/user-guides/working-with-k8s/service"}},s={},p=[{value:"Pre-requisite",id:"pre-requisite",level:2},{value:"Managing Workspace Configuration",id:"managing-workspace-configuration",level:2},{value:"Example",id:"example",level:2},{value:"Apply",id:"apply",level:2},{value:"Validation",id:"validation",level:2}],c={toc:p};function d(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"configure-containers"},"Configure Containers"),(0,r.kt)("p",null,"You can manage container-level configurations in the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," model via the ",(0,r.kt)("inlineCode",{parentName:"p"},"containers")," field (under the ",(0,r.kt)("inlineCode",{parentName:"p"},"workload")," schemas). By default, everything defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"containers")," field will be treated as application containers. Sidecar containers will be supported in a future version of kusion."),(0,r.kt)("p",null,"For the full ",(0,r.kt)("inlineCode",{parentName:"p"},"Container")," schema reference, please see ",(0,r.kt)("a",{parentName:"p",href:"../../reference/modules/catalog-models/workload/service#schema-container"},"here")," for more details."),(0,r.kt)("h2",{id:"pre-requisite"},"Pre-requisite"),(0,r.kt)("p",null,"Please refer to the ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#prerequisites"},"prerequisites")," in the guide for deploying an application."),(0,r.kt)("p",null,"The example below also requires you to have ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#initializing"},"initialized the project")," using the ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion workspace create")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"kusion init")," command, which will create a workspace and also generate a ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#kclmod"},(0,r.kt)("inlineCode",{parentName:"a"},"kcl.mod")," file")," under the stack directory."),(0,r.kt)("h2",{id:"managing-workspace-configuration"},"Managing Workspace Configuration"),(0,r.kt)("p",null,"In the last guide, we introduced a step to ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#initializing-workspace-configuration"},"initialize a workspace")," with an empty configuration. The same empty configuration will still work in this guide, no changes are required there."),(0,r.kt)("p",null,"However, if you (or the platform team) would like to set default values for the workloads to standardize the behavior of applications in the ",(0,r.kt)("inlineCode",{parentName:"p"},"dev")," workspace, you can do so by updating the ",(0,r.kt)("inlineCode",{parentName:"p"},"~/dev.yaml"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-yaml"},"modules:\n service:\n default:\n replicas: 3\n labels:\n label-key: label-value\n annotations:\n annotation-key: annotation-value\n type: CollaSet\n")),(0,r.kt)("p",null,"Please note that the ",(0,r.kt)("inlineCode",{parentName:"p"},"replicas")," in the workspace configuration only works as a default value and will be overridden by the value set in the application configuration."),(0,r.kt)("p",null,"The workspace configuration need to be updated with the command:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"kusion workspace update dev -f ~/dev.yaml\n")),(0,r.kt)("p",null,"For a full reference of what can be configured in the workspace level, please see the ",(0,r.kt)("a",{parentName:"p",href:"../../reference/modules/workspace-configs/workload/service"},"workspace reference"),"."),(0,r.kt)("h2",{id:"example"},"Example"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"simple-service/dev/main.k"),":"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-py"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.container.probe as p\nimport catalog.models.schema.v1.workload.network as n\n\nhelloworld: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "helloworld": c.Container {\n image: "gcr.io/google-samples/gb-frontend:v4"\n env: {\n "env1": "VALUE"\n "env2": "VALUE2"\n }\n resources: {\n "cpu": "500m"\n "memory": "512M"\n }\n # Configure an HTTP readiness probe\n readinessProbe: p.Probe {\n probeHandler: p.Http {\n url: "http://localhost:80"\n }\n initialDelaySeconds: 10\n }\n }\n }\n replicas: 2\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n}\n')),(0,r.kt)("h2",{id:"apply"},"Apply"),(0,r.kt)("p",null,"Re-run steps in ",(0,r.kt)("a",{parentName:"p",href:"deploy-application#applying"},"Applying"),", new container configuration can be applied."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"$ kusion apply\n \u2714\ufe0e Generating Intent in the Stack dev... \nStack: dev ID Action\n* \u251c\u2500 v1:Namespace:simple-service UnChanged\n* \u251c\u2500 v1:Service:simple-service:simple-service-dev-helloworld-private UnChanged\n* \u2514\u2500 apps/v1:Deployment:simple-service:simple-service-dev-helloworld Update\n\n\n? Do you want to apply these diffs? yes\nStart applying diffs ...\n SUCCESS UnChanged v1:Namespace:simple-service, skip \n SUCCESS UnChanged v1:Service:simple-service:simple-service-dev-helloworld-private, skip \n SUCCESS Update apps/v1:Deployment:simple-service:simple-service-dev-helloworld success \nUpdate apps/v1:Deployment:simple-service:simple-service-dev-helloworld success [3/3] \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100% | 0s\nApply complete! Resources: 0 created, 1 updated, 0 deleted.\n")),(0,r.kt)("h2",{id:"validation"},"Validation"),(0,r.kt)("p",null,"We can verify the container (in the deployment template) now has the updated attributes as defined in the container configuration:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"$ kubectl get deployment -n simple-service -o yaml\n...\n template:\n ...\n spec:\n containers:\n - env:\n - name: env1\n value: VALUE\n - name: env2\n value: VALUE2\n image: gcr.io/google-samples/gb-frontend:v4\n imagePullPolicy: IfNotPresent\n name: helloworld\n readinessProbe:\n failureThreshold: 3\n httpGet:\n host: localhost\n path: /\n port: 80\n scheme: HTTP\n initialDelaySeconds: 10\n periodSeconds: 10\n successThreshold: 1\n timeoutSeconds: 1\n resources:\n limits:\n cpu: 500m\n memory: 512M\n...\n")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f158ec46.0220f71a.js b/assets/js/f158ec46.0220f71a.js deleted file mode 100644 index 13ca01c87a8..00000000000 --- a/assets/js/f158ec46.0220f71a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7984],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=l(n),m=a,h=u["".concat(c,".").concat(m)]||u[m]||d[m]||s;return n?r.createElement(h,o(o({ref:t},p),{},{components:n})):r.createElement(h,o({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>d,frontMatter:()=>s,metadata:()=>i,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const s={id:"secret"},o="Secrets",i={unversionedId:"configuration-walkthrough/secret",id:"version-v0.10/configuration-walkthrough/secret",title:"Secrets",description:"Secrets are used to store sensitive data like passwords, API keys, TLS certificates, tokens, or other credentials. Kusion provides multiple secret types, and makes it easy to be consumed in containers.",source:"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/7-secret.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/secret",permalink:"/docs/v0.10/configuration-walkthrough/secret",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/7-secret.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:7,frontMatter:{id:"secret"},sidebar:"kusion",previous:{title:"Managed Databases",permalink:"/docs/v0.10/configuration-walkthrough/databse"},next:{title:"Application Monitoring",permalink:"/docs/v0.10/configuration-walkthrough/monitoring"}},c={},l=[{value:"Using secrets in workload",id:"using-secrets-in-workload",level:2},{value:"Consume secret in an environment variable",id:"consume-secret-in-an-environment-variable",level:3},{value:"Consume all secret keys as environment variables",id:"consume-all-secret-keys-as-environment-variables",level:3},{value:"Types of secrets",id:"types-of-secrets",level:2},{value:"Basic secrets",id:"basic-secrets",level:3},{value:"Token secrets",id:"token-secrets",level:3},{value:"Opaque secrets",id:"opaque-secrets",level:3},{value:"Certificate secrets",id:"certificate-secrets",level:3},{value:"External secrets",id:"external-secrets",level:3},{value:"Immutable secrets",id:"immutable-secrets",level:2}],p={toc:l};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"secrets"},"Secrets"),(0,a.kt)("p",null,"Secrets are used to store sensitive data like passwords, API keys, TLS certificates, tokens, or other credentials. Kusion provides multiple secret types, and makes it easy to be consumed in containers."),(0,a.kt)("p",null,"For application dependent cloud resources that are managed by Kusion, their credentials are automatically managed by Kusion (generated and injected into application runtime environment variable). You shouldn't have to manually create those."),(0,a.kt)("h2",{id:"using-secrets-in-workload"},"Using secrets in workload"),(0,a.kt)("p",null,"Secrets must be defined in AppConfiguration. The values can be generated by Kusion or reference existing secrets stored in third-party vault. Secrets can be consumed in containers by referencing them through the ",(0,a.kt)("inlineCode",{parentName:"p"},"secret:///")," URI syntax."),(0,a.kt)("h3",{id:"consume-secret-in-an-environment-variable"},"Consume secret in an environment variable"),(0,a.kt)("p",null,"You can consume the data in Secrets as environment variable in your container. For example the db container uses an environment variable to set the root password."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import models.schema.v1 as ac\nimport models.schema.v1.workload as wl\nimport models.schema.v1.workload.container as c\nimport models.schema.v1.workload.secret as sec\n\nsampledb: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "db": c.Container {\n image: "mysql"\n env: {\n # Consume db-root-password secret in environment\n "ROOT_PASSWORD": "secret://db-root-password/token"\n }\n }\n }\n # Secrets used to generate token\n secrets: {\n "init-info": sec.Secret {\n type: "token"\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"The example shows the secret ",(0,a.kt)("inlineCode",{parentName:"p"},"root-password")," being consumed as an environment variable in the db container. The secret is of type token and will automatically be generated at runtime by Kusion."),(0,a.kt)("h3",{id:"consume-all-secret-keys-as-environment-variables"},"Consume all secret keys as environment variables"),(0,a.kt)("p",null,"Sometimes your secret contains multiple data that need to be consumed as environment variables. The example below shows how to consume all the values in a secret as environment variables named after the keys."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import models.schema.v1 as ac\nimport models.schema.v1.workload as wl\nimport models.schema.v1.workload.container as c\nimport models.schema.v1.workload.secret as sec\n\nsampledb: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "db": c.Container {\n image: "mysql"\n env: {\n # Consume all init-info secret keys as environment variables\n "secret://init-info": ""\n }\n }\n }\n # Secrets used to init mysql instance\n secrets: {\n "init-info": sec.Secret {\n type: "opaque"\n data: {\n "ROOT_PASSWORD": "admin"\n }\n }\n }\n }\n}\n')),(0,a.kt)("p",null,'This will set the environment variable "ROOT_PASSWORD" to the value "admin" in the db container.'),(0,a.kt)("h2",{id:"types-of-secrets"},"Types of secrets"),(0,a.kt)("p",null,"Kusion provides multiple types of secrets to application developers."),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Basic: Used to generate and/or store usernames and passwords."),(0,a.kt)("li",{parentName:"ol"},"Token: Used to generate and/or store secret strings for password."),(0,a.kt)("li",{parentName:"ol"},"Opaque: A generic secret that can store arbitrary user-defined data."),(0,a.kt)("li",{parentName:"ol"},"Certificate: Used to store a certificate and its associated key that are typically used for TLS."),(0,a.kt)("li",{parentName:"ol"},"External: Used to retrieve secret form third-party vault.")),(0,a.kt)("h3",{id:"basic-secrets"},"Basic secrets"),(0,a.kt)("p",null,'Basic secrets are defined in the secrets block with the type "basic".'),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import models.schema.v1 as ac\nimport models.schema.v1.workload as wl\nimport models.schema.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "auth-info": sec.Secret {\n type: "basic"\n data: {\n "username": "admin"\n "password": "******"\n }\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"The basic secret type is typically used for basic authentication. The key names must be username and password. If one or both of the fields are defined with a non-empty string, those values will be used. If the empty string, the default value, is used Acorn will generate random values for one or both."),(0,a.kt)("h3",{id:"token-secrets"},"Token secrets"),(0,a.kt)("p",null,"Token secrets are useful for generating a password or secure string used for passwords when the user is already known or not required."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import models.schema.v1 as ac\nimport models.schema.v1.workload as wl\nimport models.schema.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "api-token": sec.Secret {\n type: "token"\n data: {\n "token": ""\n }\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"The token secret type must be defined. The ",(0,a.kt)("inlineCode",{parentName:"p"},"token")," field in the data object is optional and if left empty Kusion will generate the token, which is 54 characters in length by default. If the ",(0,a.kt)("inlineCode",{parentName:"p"},"token")," is defined that value will always be used."),(0,a.kt)("h3",{id:"opaque-secrets"},"Opaque secrets"),(0,a.kt)("p",null,"Opaque secrets have no defined structure and can have arbitrary key value pairs. "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import models.schema.v1 as ac\nimport models.schema.v1.workload as wl\nimport models.schema.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "my-secret": sec.Secret {\n type: "opaque"\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"certificate-secrets"},"Certificate secrets"),(0,a.kt)("p",null,"Certificate secrets are useful for storing a certificate and its associated key. One common use for TLS Secrets is to configure encryption in transit for an Ingress, but you can also use it with other resources or directly in your workload."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import models.schema.v1 as ac\nimport models.schema.v1.workload as wl\nimport models.schema.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "server-cert": sec.Secret {\n type: "certificate"\n data: {\n # Please do not put private keys in configuration files\n "tls.crt": "The cert file content"\n "tls.key": "The key file content"\n }\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"external-secrets"},"External secrets"),(0,a.kt)("p",null,"As a general principle, storing secrets in a plain text configuration file is highly discouraged, keeping secrets outside of Git is especially important for future-proofing, even encrypted secrets are not recommended to check into Git. The most common approach is to store secrets in a third-party vault (such as Hashicorp Vault, AWS Secrets Manager and Azure Key Vault, etc) and retrieve the secret in the runtime only. External secrets are used to retrieve sensitive data from external secret store to make it easy to be consumed in containers."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import models.schema.v1 as ac\nimport models.schema.v1.workload as wl\nimport models.schema.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "api-access-token": sec.Secret {\n type: "external"\n data: {\n # Please do not put private keys in configuration files\n "accessToken": "ref://api-auth-info/accessToken?version=1"\n }\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"The value field in data object follow ",(0,a.kt)("inlineCode",{parentName:"p"},"ref://PATH[?version=]")," URI syntax. ",(0,a.kt)("inlineCode",{parentName:"p"},"PATH")," is the provider-specific path for the secret to be retried. Kusion provides out-of-the-box integration with ",(0,a.kt)("inlineCode",{parentName:"p"},"Hashicorp Vault"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"AWS Secrets Manager"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"Azure Key Vault")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"Alicloud Secrets Manager"),"."),(0,a.kt)("h2",{id:"immutable-secrets"},"Immutable secrets"),(0,a.kt)("p",null,"You can also declare a secret as immutable to prevent it from being changed accidentally."),(0,a.kt)("p",null,"To declare a secret as immutable:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import models.schema.v1 as ac\nimport models.schema.v1.workload as wl\nimport models.schema.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "my-secret": sec.Secret {\n # ...\n immutable: True\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"You can change a secret from mutable to immutable but not the other way around. That is because the Kubelet will stop watching secrets that are immutable. As the name suggests, you can only delete and re-create immutable secrets but you cannot change them."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f158ec46.6156892f.js b/assets/js/f158ec46.6156892f.js new file mode 100644 index 00000000000..1ec464c1fe2 --- /dev/null +++ b/assets/js/f158ec46.6156892f.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[7984],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,s=e.originalType,c=e.parentName,p=i(e,["components","mdxType","originalType","parentName"]),u=l(n),m=a,h=u["".concat(c,".").concat(m)]||u[m]||d[m]||s;return n?r.createElement(h,o(o({ref:t},p),{},{components:n})):r.createElement(h,o({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var s=n.length,o=new Array(s);o[0]=u;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>o,default:()=>d,frontMatter:()=>s,metadata:()=>i,toc:()=>l});var r=n(87462),a=(n(67294),n(3905));const s={id:"secret"},o="Secrets",i={unversionedId:"configuration-walkthrough/secret",id:"version-v0.10/configuration-walkthrough/secret",title:"Secrets",description:"Secrets are used to store sensitive data like passwords, API keys, TLS certificates, tokens, or other credentials. Kusion provides multiple secret types, and makes it easy to be consumed in containers.",source:"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/7-secret.md",sourceDirName:"4-configuration-walkthrough",slug:"/configuration-walkthrough/secret",permalink:"/docs/v0.10/configuration-walkthrough/secret",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/7-secret.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:7,frontMatter:{id:"secret"},sidebar:"kusion",previous:{title:"Managed Databases",permalink:"/docs/v0.10/configuration-walkthrough/databse"},next:{title:"Application Monitoring",permalink:"/docs/v0.10/configuration-walkthrough/monitoring"}},c={},l=[{value:"Using secrets in workload",id:"using-secrets-in-workload",level:2},{value:"Consume secret in an environment variable",id:"consume-secret-in-an-environment-variable",level:3},{value:"Consume all secret keys as environment variables",id:"consume-all-secret-keys-as-environment-variables",level:3},{value:"Types of secrets",id:"types-of-secrets",level:2},{value:"Basic secrets",id:"basic-secrets",level:3},{value:"Token secrets",id:"token-secrets",level:3},{value:"Opaque secrets",id:"opaque-secrets",level:3},{value:"Certificate secrets",id:"certificate-secrets",level:3},{value:"External secrets",id:"external-secrets",level:3},{value:"Immutable secrets",id:"immutable-secrets",level:2}],p={toc:l};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"secrets"},"Secrets"),(0,a.kt)("p",null,"Secrets are used to store sensitive data like passwords, API keys, TLS certificates, tokens, or other credentials. Kusion provides multiple secret types, and makes it easy to be consumed in containers."),(0,a.kt)("p",null,"For application dependent cloud resources that are managed by Kusion, their credentials are automatically managed by Kusion (generated and injected into application runtime environment variable). You shouldn't have to manually create those."),(0,a.kt)("h2",{id:"using-secrets-in-workload"},"Using secrets in workload"),(0,a.kt)("p",null,"Secrets must be defined in AppConfiguration. The values can be generated by Kusion or reference existing secrets stored in third-party vault. Secrets can be consumed in containers by referencing them through the ",(0,a.kt)("inlineCode",{parentName:"p"},"secret:///")," URI syntax."),(0,a.kt)("h3",{id:"consume-secret-in-an-environment-variable"},"Consume secret in an environment variable"),(0,a.kt)("p",null,"You can consume the data in Secrets as environment variable in your container. For example the db container uses an environment variable to set the root password."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import models.schema.v1 as ac\nimport models.schema.v1.workload as wl\nimport models.schema.v1.workload.container as c\nimport models.schema.v1.workload.secret as sec\n\nsampledb: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "db": c.Container {\n image: "mysql"\n env: {\n # Consume db-root-password secret in environment\n "ROOT_PASSWORD": "secret://db-root-password/token"\n }\n }\n }\n # Secrets used to generate token\n secrets: {\n "init-info": sec.Secret {\n type: "token"\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"The example shows the secret ",(0,a.kt)("inlineCode",{parentName:"p"},"root-password")," being consumed as an environment variable in the db container. The secret is of type token and will automatically be generated at runtime by Kusion."),(0,a.kt)("h3",{id:"consume-all-secret-keys-as-environment-variables"},"Consume all secret keys as environment variables"),(0,a.kt)("p",null,"Sometimes your secret contains multiple data that need to be consumed as environment variables. The example below shows how to consume all the values in a secret as environment variables named after the keys."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import models.schema.v1 as ac\nimport models.schema.v1.workload as wl\nimport models.schema.v1.workload.container as c\nimport models.schema.v1.workload.secret as sec\n\nsampledb: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n "db": c.Container {\n image: "mysql"\n env: {\n # Consume all init-info secret keys as environment variables\n "secret://init-info": ""\n }\n }\n }\n # Secrets used to init mysql instance\n secrets: {\n "init-info": sec.Secret {\n type: "opaque"\n data: {\n "ROOT_PASSWORD": "admin"\n }\n }\n }\n }\n}\n')),(0,a.kt)("p",null,'This will set the environment variable "ROOT_PASSWORD" to the value "admin" in the db container.'),(0,a.kt)("h2",{id:"types-of-secrets"},"Types of secrets"),(0,a.kt)("p",null,"Kusion provides multiple types of secrets to application developers."),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},"Basic: Used to generate and/or store usernames and passwords."),(0,a.kt)("li",{parentName:"ol"},"Token: Used to generate and/or store secret strings for password."),(0,a.kt)("li",{parentName:"ol"},"Opaque: A generic secret that can store arbitrary user-defined data."),(0,a.kt)("li",{parentName:"ol"},"Certificate: Used to store a certificate and its associated key that are typically used for TLS."),(0,a.kt)("li",{parentName:"ol"},"External: Used to retrieve secret form third-party vault.")),(0,a.kt)("h3",{id:"basic-secrets"},"Basic secrets"),(0,a.kt)("p",null,'Basic secrets are defined in the secrets block with the type "basic".'),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import models.schema.v1 as ac\nimport models.schema.v1.workload as wl\nimport models.schema.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "auth-info": sec.Secret {\n type: "basic"\n data: {\n "username": "admin"\n "password": "******"\n }\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"The basic secret type is typically used for basic authentication. The key names must be username and password. If one or both of the fields are defined with a non-empty string, those values will be used. If the empty string, the default value, is used Acorn will generate random values for one or both."),(0,a.kt)("h3",{id:"token-secrets"},"Token secrets"),(0,a.kt)("p",null,"Token secrets are useful for generating a password or secure string used for passwords when the user is already known or not required."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import models.schema.v1 as ac\nimport models.schema.v1.workload as wl\nimport models.schema.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "api-token": sec.Secret {\n type: "token"\n data: {\n "token": ""\n }\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"The token secret type must be defined. The ",(0,a.kt)("inlineCode",{parentName:"p"},"token")," field in the data object is optional and if left empty Kusion will generate the token, which is 54 characters in length by default. If the ",(0,a.kt)("inlineCode",{parentName:"p"},"token")," is defined that value will always be used."),(0,a.kt)("h3",{id:"opaque-secrets"},"Opaque secrets"),(0,a.kt)("p",null,"Opaque secrets have no defined structure and can have arbitrary key value pairs. "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import models.schema.v1 as ac\nimport models.schema.v1.workload as wl\nimport models.schema.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "my-secret": sec.Secret {\n type: "opaque"\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"certificate-secrets"},"Certificate secrets"),(0,a.kt)("p",null,"Certificate secrets are useful for storing a certificate and its associated key. One common use for TLS Secrets is to configure encryption in transit for an Ingress, but you can also use it with other resources or directly in your workload."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import models.schema.v1 as ac\nimport models.schema.v1.workload as wl\nimport models.schema.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "server-cert": sec.Secret {\n type: "certificate"\n data: {\n # Please do not put private keys in configuration files\n "tls.crt": "The cert file content"\n "tls.key": "The key file content"\n }\n }\n }\n }\n}\n')),(0,a.kt)("h3",{id:"external-secrets"},"External secrets"),(0,a.kt)("p",null,"As a general principle, storing secrets in a plain text configuration file is highly discouraged, keeping secrets outside of Git is especially important for future-proofing, even encrypted secrets are not recommended to check into Git. The most common approach is to store secrets in a third-party vault (such as Hashicorp Vault, AWS Secrets Manager and Azure Key Vault, etc) and retrieve the secret in the runtime only. External secrets are used to retrieve sensitive data from external secret store to make it easy to be consumed in containers."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import models.schema.v1 as ac\nimport models.schema.v1.workload as wl\nimport models.schema.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "api-access-token": sec.Secret {\n type: "external"\n data: {\n # Please do not put private keys in configuration files\n "accessToken": "ref://api-auth-info/accessToken?version=1"\n }\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"The value field in data object follow ",(0,a.kt)("inlineCode",{parentName:"p"},"ref://PATH[?version=]")," URI syntax. ",(0,a.kt)("inlineCode",{parentName:"p"},"PATH")," is the provider-specific path for the secret to be retried. Kusion provides out-of-the-box integration with ",(0,a.kt)("inlineCode",{parentName:"p"},"Hashicorp Vault"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"AWS Secrets Manager"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"Azure Key Vault")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"Alicloud Secrets Manager"),"."),(0,a.kt)("h2",{id:"immutable-secrets"},"Immutable secrets"),(0,a.kt)("p",null,"You can also declare a secret as immutable to prevent it from being changed accidentally."),(0,a.kt)("p",null,"To declare a secret as immutable:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},'import models.schema.v1 as ac\nimport models.schema.v1.workload as wl\nimport models.schema.v1.workload.secret as sec\n\nsampleapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n secrets: {\n "my-secret": sec.Secret {\n # ...\n immutable: True\n }\n }\n }\n}\n')),(0,a.kt)("p",null,"You can change a secret from mutable to immutable but not the other way around. That is because the Kubelet will stop watching secrets that are immutable. As the name suggests, you can only delete and re-create immutable secrets but you cannot change them."))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f2140f39.aea0316d.js b/assets/js/f2140f39.2036c39d.js similarity index 70% rename from assets/js/f2140f39.aea0316d.js rename to assets/js/f2140f39.2036c39d.js index 14de0de1825..2ffcc8af7e4 100644 --- a/assets/js/f2140f39.aea0316d.js +++ b/assets/js/f2140f39.2036c39d.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1200],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>u});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),l=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},v=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),v=l(n),u=o,f=v["".concat(s,".").concat(u)]||v[u]||d[u]||a;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function u(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=v;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:o,i[1]=c;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>c,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={sidebar_label:"Overview",id:"overview"},i="Overview",c={unversionedId:"concepts/stack/overview",id:"version-v0.10/concepts/stack/overview",title:"Overview",description:"A stack in Kusion is any folder that contains a stack.yaml file within the corresponding project directory. A stack provides a mechanism to isolate multiple deployments of the same application, serving as the target workspace to which an application will be deployed. It is also the smallest operational unit that can be configured and deployed independently. Stacks are commonly used to denote different phases of the software development lifecycle, such as development, staging, and production.",source:"@site/docs_versioned_docs/version-v0.10/3-concepts/2-stack/1-overview.md",sourceDirName:"3-concepts/2-stack",slug:"/concepts/stack/overview",permalink:"/docs/v0.10/concepts/stack/overview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/3-concepts/2-stack/1-overview.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_label:"Overview",id:"overview"},sidebar:"kusion",previous:{title:"Project Configuration",permalink:"/docs/v0.10/concepts/project/configuration"},next:{title:"Stack Configuration",permalink:"/docs/v0.10/concepts/stack/configuration"}},s={},l=[{value:"High Level Schema",id:"high-level-schema",level:2}],p={toc:l};function d(e){let{components:t,...a}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"overview"},"Overview"),(0,o.kt)("p",null,"A stack in Kusion is any folder that contains a stack.yaml file within the corresponding project directory. A stack provides a mechanism to isolate multiple deployments of the same application, serving as the target workspace to which an application will be deployed. It is also the smallest operational unit that can be configured and deployed independently. Stacks are commonly used to denote different phases of the software development lifecycle, such as development, staging, and production."),(0,o.kt)("h2",{id:"high-level-schema"},"High Level Schema"),(0,o.kt)("p",null,(0,o.kt)("img",{alt:"High_Level_Schema",src:n(4994).Z,width:"2390",height:"1487"})))}d.isMDXComponent=!0},4994:(e,t,n)=>{n.d(t,{Z:()=>r});const r=n.p+"assets/images/high-level-schema-ba34668ea6879003a582f15496c3ab6e.png"}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1200],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>u});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=r.createContext({}),l=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},v=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,s=e.parentName,p=c(e,["components","mdxType","originalType","parentName"]),v=l(n),u=o,f=v["".concat(s,".").concat(u)]||v[u]||d[u]||a;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function u(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=v;var c={};for(var s in t)hasOwnProperty.call(t,s)&&(c[s]=t[s]);c.originalType=e,c.mdxType="string"==typeof e?e:o,i[1]=c;for(var l=2;l{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>a,metadata:()=>c,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={sidebar_label:"Overview",id:"overview"},i="Overview",c={unversionedId:"concepts/stack/overview",id:"version-v0.10/concepts/stack/overview",title:"Overview",description:"A stack in Kusion is any folder that contains a stack.yaml file within the corresponding project directory. A stack provides a mechanism to isolate multiple deployments of the same application, serving as the target workspace to which an application will be deployed. It is also the smallest operational unit that can be configured and deployed independently. Stacks are commonly used to denote different phases of the software development lifecycle, such as development, staging, and production.",source:"@site/docs_versioned_docs/version-v0.10/3-concepts/2-stack/1-overview.md",sourceDirName:"3-concepts/2-stack",slug:"/concepts/stack/overview",permalink:"/docs/v0.10/concepts/stack/overview",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/3-concepts/2-stack/1-overview.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:1,frontMatter:{sidebar_label:"Overview",id:"overview"},sidebar:"kusion",previous:{title:"Project Configuration",permalink:"/docs/v0.10/concepts/project/configuration"},next:{title:"Stack Configuration",permalink:"/docs/v0.10/concepts/stack/configuration"}},s={},l=[{value:"High Level Schema",id:"high-level-schema",level:2}],p={toc:l};function d(e){let{components:t,...a}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,a,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"overview"},"Overview"),(0,o.kt)("p",null,"A stack in Kusion is any folder that contains a stack.yaml file within the corresponding project directory. A stack provides a mechanism to isolate multiple deployments of the same application, serving as the target workspace to which an application will be deployed. It is also the smallest operational unit that can be configured and deployed independently. Stacks are commonly used to denote different phases of the software development lifecycle, such as development, staging, and production."),(0,o.kt)("h2",{id:"high-level-schema"},"High Level Schema"),(0,o.kt)("p",null,(0,o.kt)("img",{alt:"High_Level_Schema",src:n(4994).Z,width:"2390",height:"1487"})))}d.isMDXComponent=!0},4994:(e,t,n)=>{n.d(t,{Z:()=>r});const r=n.p+"assets/images/high-level-schema-ba34668ea6879003a582f15496c3ab6e.png"}}]); \ No newline at end of file diff --git a/assets/js/f293b4fc.55c985c1.js b/assets/js/f293b4fc.55c985c1.js new file mode 100644 index 00000000000..bfdfa53eca8 --- /dev/null +++ b/assets/js/f293b4fc.55c985c1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[155],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>h});var o=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=o.createContext({}),p=function(e){var t=o.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},c=function(e){var t=p(e.components);return o.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},u=o.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=p(n),h=i,f=u["".concat(l,".").concat(h)]||u[h]||d[h]||a;return n?o.createElement(f,r(r({ref:t},c),{},{components:n})):o.createElement(f,r({ref:t},c))}));function h(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,r=new Array(a);r[0]=u;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,r[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>d,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var o=n(87462),i=(n(67294),n(3905));const a={sidebar_position:4,sidebar_label:"AppConfiguration"},r="Declarative Application Configuration Model - AppConfiguration",s={unversionedId:"concepts/appconfiguration",id:"version-v0.9/concepts/appconfiguration",title:"Declarative Application Configuration Model - AppConfiguration",description:"Abstract",source:"@site/docs_versioned_docs/version-v0.9/concepts/appconfiguration.md",sourceDirName:"concepts",slug:"/concepts/appconfiguration",permalink:"/docs/v0.9/concepts/appconfiguration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/concepts/appconfiguration.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:4,frontMatter:{sidebar_position:4,sidebar_label:"AppConfiguration"},sidebar:"kusion",previous:{title:"How Kusion Works",permalink:"/docs/v0.9/concepts/kusion"},next:{title:"Intent",permalink:"/docs/v0.9/concepts/intent"}},l={},p=[{value:"Abstract",id:"abstract",level:2},{value:"Motivation",id:"motivation",level:2},{value:"Design",id:"design",level:2},{value:"Core Principles",id:"core-principles",level:3},{value:"Developer First",id:"developer-first",level:4},{value:"Application-Centric",id:"application-centric",level:4},{value:"Platform Agnostic",id:"platform-agnostic",level:4},{value:"Model Architecture",id:"model-architecture",level:3},{value:"Core Concepts",id:"core-concepts",level:3},{value:"Component",id:"component",level:4},{value:"Pipeline",id:"pipeline",level:4},{value:"Topologies",id:"topologies",level:4},{value:"PolicySets",id:"policysets",level:4},{value:"Dependency",id:"dependency",level:4},{value:"References",id:"references",level:2}],c={toc:p};function d(e){let{components:t,...a}=e;return(0,i.kt)("wrapper",(0,o.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"declarative-application-configuration-model---appconfiguration"},"Declarative Application Configuration Model - AppConfiguration"),(0,i.kt)("h2",{id:"abstract"},"Abstract"),(0,i.kt)("p",null,"Kusion consumes the declarative configuration that describes the application, and delivers intent to the target runtime including Kubernetes, clouds, or on-prem infrastructure. In order to do that, we need a declarative model that can best describe the intent for a given application."),(0,i.kt)("p",null,"This design document elaborates on the core design considerations and a high-level architecture of the next-generation declarative application configuration model. The AppConfiguration model is expected to continuously iterate over time, with the purpose to better encapsulate the application configuration needs declaratively in its full lifecycle and reduce cognitive complexity as much as possible for the developers."),(0,i.kt)("p",null,"AppConfiguration consists of multiple elements that each represents a significant portion in the application lifecycle, either the application workload itself, its dependencies, relevant deployment workflows or operational expectations."),(0,i.kt)("h2",{id:"motivation"},"Motivation"),(0,i.kt)("p",null,"In AntGroup, we have heavily invested in the efforts to enable application delivery on a massive scale. What we have observed in the past few years is a trend of continuous evolution of infrastructure complexity over time, as a result of the increasing business needs."),(0,i.kt)("p",null,"We are motivated to find a new paradigm that highlights collaborations between different parts of the software organizations and enables self-service ability as much as possible to get to a mature level of standardization and efficiency in application delivery."),(0,i.kt)("p",null,"The centerpiece of this paradigm is a consistent, comprehensive and declarative application model that captures the application needs in an intuitive and self-explanatory way."),(0,i.kt)("p",null,"This paradigm will also require a core workflow that KusionStack advocates, an effort of retrofitting that workflow based on different organizational needs, a golden path that represents industry best practices, and a shift in organizational culture. We won't go into those details in this document."),(0,i.kt)("h2",{id:"design"},"Design"),(0,i.kt)("h3",{id:"core-principles"},"Core Principles"),(0,i.kt)("h4",{id:"developer-first"},"Developer First"),(0,i.kt)("p",null,"The AppConfiguration model serves as the interface for the application developers. The model design should favor the perspective of application developers, rather than platform or infrastructure developers. The primary purpose of a unified and abstract application delivery model is to be able to define an application with concepts and semantics that are intuitive and easy for developers to understand, without the need for any advanced knowledge on infrastructure. The goal is to reduce the cognitive burden of application developers by hiding the increasing complexity of the underlying infrastructure, be it different clouds, runtimes, or product offerings."),(0,i.kt)("p",null,'Developers should be able to describe an application as simple as "I want a database of type X and version Y to go along my application".'),(0,i.kt)("h4",{id:"application-centric"},"Application-Centric"),(0,i.kt)("p",null,"In practice, the end-to-end delivery of a production-grade application typically involves more than provisioning the computing resource and bootstrapping the workload. It also includes managing a variety of dependent resources the application workload depends on, such as networking, storage, database, middleware, monitoring and alerting, etc."),(0,i.kt)("p",null,"AppConfiguration proposes an application-centric approach, where the dependencies of an application can be kept together along with any operational (Day2) expectations. Everything the application needs to be production-available is captured inside a single, declarative source of truth centered around the AppConfiguration model. AppConfiguration should serve as the consistent and comprehensive abstraction of the application needs through its entire lifecycle."),(0,i.kt)("h4",{id:"platform-agnostic"},"Platform Agnostic"),(0,i.kt)("p",null,"AppConfiguration should avoid locking into any specific tooling, technology stack or infrastructure providers. Kusion is built with the philosophy that benefits from an open and diverse ecosystem, where any infrastructure provider can be included in the form of plugins."),(0,i.kt)("p",null,'The design of AppConfiguration should emphasize separation of concern between the roles that write application business logic and those that manage platform level configurations. In the context of using public cloud, the AppConfiguration model should support multi-cloud deployment out-of-the-box. The configurations should be "Write Once Deploy Everywhere".'),(0,i.kt)("h3",{id:"model-architecture"},"Model Architecture"),(0,i.kt)("p",null,"The AppConfiguration model consolidates all the necessary components and their dependent accessories for the application deployment, along with any workflow, policy and operational requirements into one standardized, infrastructure-independent declarative specification. This declarative specification represents the intuitive user intent for the application, which drives a standardized and efficient application delivery and operation process in a hybrid environment. This enables application developers the ability to self-service based on concepts and semantics that are intuitive and self-explanatory."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"appconfig.png",src:n(57091).Z,width:"5512",height:"3390"})),(0,i.kt)("p",null,"AppConfiguration consists of five core concepts, namely ",(0,i.kt)("inlineCode",{parentName:"p"},"Components"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Topologies"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Pipeline"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"PolicySets"),", and ",(0,i.kt)("inlineCode",{parentName:"p"},"Dependency"),". We will walk through these concepts one by one."),(0,i.kt)("h3",{id:"core-concepts"},"Core Concepts"),(0,i.kt)("h4",{id:"component"},"Component"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Components")," defines the foundation of any application configuration. Generally speaking, we believe that a comprehensive application description should at least consist of a core deployable workload that is frequently iterated and a collection of any other core services that the workload depends on, such as databases, caches or any other cloud services."),(0,i.kt)("p",null,"Components are conceptually split into two categories, ",(0,i.kt)("inlineCode",{parentName:"p"},"Workload")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"Accessories"),". The former revolves around the configuration for the computing resource. The latter represents any third-party runtime capabilities and operational requirements that the application needs. Each AppConfiguration consists of exactly one workload and any number of accessories."),(0,i.kt)("p",null,"Simply put, we can define ",(0,i.kt)("inlineCode",{parentName:"p"},"Components")," with the following expression:"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Components = Workload + Accessories")),(0,i.kt)("p",null,"The concept of ",(0,i.kt)("inlineCode",{parentName:"p"},"Components")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"Accessories")," itself is implicit when ",(0,i.kt)("a",{parentName:"p",href:"../config-walkthrough/overview"},"authoring the configuration files"),". You can define the workload and any type of accessories (such as database or monitoring) directly under the AppConfiguration model."),(0,i.kt)("p",null,"From a collaboration perspective, platform developers and SREs are responsible for continuously adding any new schema (as abstractions for the underlying infrastructure) and implementations that can be used out-of-the-box. Application developers SREs should be able to leverage the corresponding schemas to cover the evolving application needs. This helps software organizations achieve separation of concern, so that different roles can focus on the subject matter they are an expert of."),(0,i.kt)("h4",{id:"pipeline"},"Pipeline"),(0,i.kt)("p",null,"In most of the cases, the platform is capable of providing a consistent application delivery process that can meet most application needs. In the case that an application warrants any customization in the delivery workflow, the ",(0,i.kt)("inlineCode",{parentName:"p"},"Pipeline")," section in AppConfiguration provides an approach to extend the workflow as needed. "),(0,i.kt)("p",null,"A typical delivery workflow is made of several stages, each corresponds to some logic that needs to be executed, such as manual approval, data transfer, coordinated multi-cluster release, notification, etc. Implementation-wise, the execution of each stage should be carried out with a plugin, developed and managed by the platform owners."),(0,i.kt)("h4",{id:"topologies"},"Topologies"),(0,i.kt)("p",null,"In reality, what we have observed for production-grade applications is that they usually need to be deployed to a wide range of different targets including different clouds, regions, availability zones or runtimes for availability/cost/regulation/performance or disaster recovery related reasons. The ",(0,i.kt)("inlineCode",{parentName:"p"},"Topologies")," section in AppConfiguration highlights the different deployment targets in the application delivery and provides a single pane of glass that overlooks the entire deployment topology."),(0,i.kt)("h4",{id:"policysets"},"PolicySets"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"PolicySets")," section is responsible for defining the set of rules and procedures that should be followed in the application delivery process. They generally represent the guidelines with the purpose of minimizing any technical, security or compliance risks. Some of examples include release strategies, risk management policies, and self-healing strategies. The collections of policies are expected to be managed as a joint effort from all the stakeholders, including platform owners, infrastructure owners, and security and compliance stakeholders. Some policy sets (usually security and compliance related) are expected to be mandatory. Some can be switched on and off by the application owner (self-healing strategy for instance) depending on their specific needs."),(0,i.kt)("h4",{id:"dependency"},"Dependency"),(0,i.kt)("p",null,"In a production-scale environment, there are usually intricate dependencies between multiple applications. The ",(0,i.kt)("inlineCode",{parentName:"p"},"Dependency")," section is responsible for describing the dependencies between multiple applications."),(0,i.kt)("h2",{id:"references"},"References"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Score - ",(0,i.kt)("a",{parentName:"li",href:"https://docs.score.dev/docs/overview/"},"https://docs.score.dev/docs/overview/")),(0,i.kt)("li",{parentName:"ol"},"Acornfile - ",(0,i.kt)("a",{parentName:"li",href:"https://docs.acorn.io/authoring/overview"},"https://docs.acorn.io/authoring/overview")),(0,i.kt)("li",{parentName:"ol"},"KubeVela - ",(0,i.kt)("a",{parentName:"li",href:"https://kubevela.io/docs/getting-started/core-concept"},"https://kubevela.io/docs/getting-started/core-concept"))))}d.isMDXComponent=!0},57091:(e,t,n)=>{n.d(t,{Z:()=>o});const o=n.p+"assets/images/appconfig-04e20b2e12ca7d5c3bc3992b2d602416.png"}}]); \ No newline at end of file diff --git a/assets/js/f293b4fc.bbc711c1.js b/assets/js/f293b4fc.bbc711c1.js deleted file mode 100644 index 2d0697918d1..00000000000 --- a/assets/js/f293b4fc.bbc711c1.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[155],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>h});var o=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=o.createContext({}),p=function(e){var t=o.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},c=function(e){var t=p(e.components);return o.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},u=o.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=p(n),h=i,f=u["".concat(l,".").concat(h)]||u[h]||d[h]||a;return n?o.createElement(f,r(r({ref:t},c),{},{components:n})):o.createElement(f,r({ref:t},c))}));function h(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,r=new Array(a);r[0]=u;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,r[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>d,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var o=n(87462),i=(n(67294),n(3905));const a={sidebar_position:4,sidebar_label:"AppConfiguration"},r="Declarative Application Configuration Model - AppConfiguration",s={unversionedId:"concepts/appconfiguration",id:"version-v0.9/concepts/appconfiguration",title:"Declarative Application Configuration Model - AppConfiguration",description:"Abstract",source:"@site/docs_versioned_docs/version-v0.9/concepts/appconfiguration.md",sourceDirName:"concepts",slug:"/concepts/appconfiguration",permalink:"/docs/v0.9/concepts/appconfiguration",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/concepts/appconfiguration.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:4,frontMatter:{sidebar_position:4,sidebar_label:"AppConfiguration"},sidebar:"kusion",previous:{title:"How Kusion Works",permalink:"/docs/v0.9/concepts/kusion"},next:{title:"Intent",permalink:"/docs/v0.9/concepts/intent"}},l={},p=[{value:"Abstract",id:"abstract",level:2},{value:"Motivation",id:"motivation",level:2},{value:"Design",id:"design",level:2},{value:"Core Principles",id:"core-principles",level:3},{value:"Developer First",id:"developer-first",level:4},{value:"Application-Centric",id:"application-centric",level:4},{value:"Platform Agnostic",id:"platform-agnostic",level:4},{value:"Model Architecture",id:"model-architecture",level:3},{value:"Core Concepts",id:"core-concepts",level:3},{value:"Component",id:"component",level:4},{value:"Pipeline",id:"pipeline",level:4},{value:"Topologies",id:"topologies",level:4},{value:"PolicySets",id:"policysets",level:4},{value:"Dependency",id:"dependency",level:4},{value:"References",id:"references",level:2}],c={toc:p};function d(e){let{components:t,...a}=e;return(0,i.kt)("wrapper",(0,o.Z)({},c,a,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"declarative-application-configuration-model---appconfiguration"},"Declarative Application Configuration Model - AppConfiguration"),(0,i.kt)("h2",{id:"abstract"},"Abstract"),(0,i.kt)("p",null,"Kusion consumes the declarative configuration that describes the application, and delivers intent to the target runtime including Kubernetes, clouds, or on-prem infrastructure. In order to do that, we need a declarative model that can best describe the intent for a given application."),(0,i.kt)("p",null,"This design document elaborates on the core design considerations and a high-level architecture of the next-generation declarative application configuration model. The AppConfiguration model is expected to continuously iterate over time, with the purpose to better encapsulate the application configuration needs declaratively in its full lifecycle and reduce cognitive complexity as much as possible for the developers."),(0,i.kt)("p",null,"AppConfiguration consists of multiple elements that each represents a significant portion in the application lifecycle, either the application workload itself, its dependencies, relevant deployment workflows or operational expectations."),(0,i.kt)("h2",{id:"motivation"},"Motivation"),(0,i.kt)("p",null,"In AntGroup, we have heavily invested in the efforts to enable application delivery on a massive scale. What we have observed in the past few years is a trend of continuous evolution of infrastructure complexity over time, as a result of the increasing business needs."),(0,i.kt)("p",null,"We are motivated to find a new paradigm that highlights collaborations between different parts of the software organizations and enables self-service ability as much as possible to get to a mature level of standardization and efficiency in application delivery."),(0,i.kt)("p",null,"The centerpiece of this paradigm is a consistent, comprehensive and declarative application model that captures the application needs in an intuitive and self-explanatory way."),(0,i.kt)("p",null,"This paradigm will also require a core workflow that KusionStack advocates, an effort of retrofitting that workflow based on different organizational needs, a golden path that represents industry best practices, and a shift in organizational culture. We won't go into those details in this document."),(0,i.kt)("h2",{id:"design"},"Design"),(0,i.kt)("h3",{id:"core-principles"},"Core Principles"),(0,i.kt)("h4",{id:"developer-first"},"Developer First"),(0,i.kt)("p",null,"The AppConfiguration model serves as the interface for the application developers. The model design should favor the perspective of application developers, rather than platform or infrastructure developers. The primary purpose of a unified and abstract application delivery model is to be able to define an application with concepts and semantics that are intuitive and easy for developers to understand, without the need for any advanced knowledge on infrastructure. The goal is to reduce the cognitive burden of application developers by hiding the increasing complexity of the underlying infrastructure, be it different clouds, runtimes, or product offerings."),(0,i.kt)("p",null,'Developers should be able to describe an application as simple as "I want a database of type X and version Y to go along my application".'),(0,i.kt)("h4",{id:"application-centric"},"Application-Centric"),(0,i.kt)("p",null,"In practice, the end-to-end delivery of a production-grade application typically involves more than provisioning the computing resource and bootstrapping the workload. It also includes managing a variety of dependent resources the application workload depends on, such as networking, storage, database, middleware, monitoring and alerting, etc."),(0,i.kt)("p",null,"AppConfiguration proposes an application-centric approach, where the dependencies of an application can be kept together along with any operational (Day2) expectations. Everything the application needs to be production-available is captured inside a single, declarative source of truth centered around the AppConfiguration model. AppConfiguration should serve as the consistent and comprehensive abstraction of the application needs through its entire lifecycle."),(0,i.kt)("h4",{id:"platform-agnostic"},"Platform Agnostic"),(0,i.kt)("p",null,"AppConfiguration should avoid locking into any specific tooling, technology stack or infrastructure providers. Kusion is built with the philosophy that benefits from an open and diverse ecosystem, where any infrastructure provider can be included in the form of plugins."),(0,i.kt)("p",null,'The design of AppConfiguration should emphasize separation of concern between the roles that write application business logic and those that manage platform level configurations. In the context of using public cloud, the AppConfiguration model should support multi-cloud deployment out-of-the-box. The configurations should be "Write Once Deploy Everywhere".'),(0,i.kt)("h3",{id:"model-architecture"},"Model Architecture"),(0,i.kt)("p",null,"The AppConfiguration model consolidates all the necessary components and their dependent accessories for the application deployment, along with any workflow, policy and operational requirements into one standardized, infrastructure-independent declarative specification. This declarative specification represents the intuitive user intent for the application, which drives a standardized and efficient application delivery and operation process in a hybrid environment. This enables application developers the ability to self-service based on concepts and semantics that are intuitive and self-explanatory."),(0,i.kt)("p",null,(0,i.kt)("img",{alt:"appconfig.png",src:n(57091).Z,width:"5512",height:"3390"})),(0,i.kt)("p",null,"AppConfiguration consists of five core concepts, namely ",(0,i.kt)("inlineCode",{parentName:"p"},"Components"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Topologies"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"Pipeline"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"PolicySets"),", and ",(0,i.kt)("inlineCode",{parentName:"p"},"Dependency"),". We will walk through these concepts one by one."),(0,i.kt)("h3",{id:"core-concepts"},"Core Concepts"),(0,i.kt)("h4",{id:"component"},"Component"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Components")," defines the foundation of any application configuration. Generally speaking, we believe that a comprehensive application description should at least consist of a core deployable workload that is frequently iterated and a collection of any other core services that the workload depends on, such as databases, caches or any other cloud services."),(0,i.kt)("p",null,"Components are conceptually split into two categories, ",(0,i.kt)("inlineCode",{parentName:"p"},"Workload")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"Accessories"),". The former revolves around the configuration for the computing resource. The latter represents any third-party runtime capabilities and operational requirements that the application needs. Each AppConfiguration consists of exactly one workload and any number of accessories."),(0,i.kt)("p",null,"Simply put, we can define ",(0,i.kt)("inlineCode",{parentName:"p"},"Components")," with the following expression:"),(0,i.kt)("p",null,(0,i.kt)("inlineCode",{parentName:"p"},"Components = Workload + Accessories")),(0,i.kt)("p",null,"The concept of ",(0,i.kt)("inlineCode",{parentName:"p"},"Components")," and ",(0,i.kt)("inlineCode",{parentName:"p"},"Accessories")," itself is implicit when ",(0,i.kt)("a",{parentName:"p",href:"../config-walkthrough/overview"},"authoring the configuration files"),". You can define the workload and any type of accessories (such as database or monitoring) directly under the AppConfiguration model."),(0,i.kt)("p",null,"From a collaboration perspective, platform developers and SREs are responsible for continuously adding any new schema (as abstractions for the underlying infrastructure) and implementations that can be used out-of-the-box. Application developers SREs should be able to leverage the corresponding schemas to cover the evolving application needs. This helps software organizations achieve separation of concern, so that different roles can focus on the subject matter they are an expert of."),(0,i.kt)("h4",{id:"pipeline"},"Pipeline"),(0,i.kt)("p",null,"In most of the cases, the platform is capable of providing a consistent application delivery process that can meet most application needs. In the case that an application warrants any customization in the delivery workflow, the ",(0,i.kt)("inlineCode",{parentName:"p"},"Pipeline")," section in AppConfiguration provides an approach to extend the workflow as needed. "),(0,i.kt)("p",null,"A typical delivery workflow is made of several stages, each corresponds to some logic that needs to be executed, such as manual approval, data transfer, coordinated multi-cluster release, notification, etc. Implementation-wise, the execution of each stage should be carried out with a plugin, developed and managed by the platform owners."),(0,i.kt)("h4",{id:"topologies"},"Topologies"),(0,i.kt)("p",null,"In reality, what we have observed for production-grade applications is that they usually need to be deployed to a wide range of different targets including different clouds, regions, availability zones or runtimes for availability/cost/regulation/performance or disaster recovery related reasons. The ",(0,i.kt)("inlineCode",{parentName:"p"},"Topologies")," section in AppConfiguration highlights the different deployment targets in the application delivery and provides a single pane of glass that overlooks the entire deployment topology."),(0,i.kt)("h4",{id:"policysets"},"PolicySets"),(0,i.kt)("p",null,"The ",(0,i.kt)("inlineCode",{parentName:"p"},"PolicySets")," section is responsible for defining the set of rules and procedures that should be followed in the application delivery process. They generally represent the guidelines with the purpose of minimizing any technical, security or compliance risks. Some of examples include release strategies, risk management policies, and self-healing strategies. The collections of policies are expected to be managed as a joint effort from all the stakeholders, including platform owners, infrastructure owners, and security and compliance stakeholders. Some policy sets (usually security and compliance related) are expected to be mandatory. Some can be switched on and off by the application owner (self-healing strategy for instance) depending on their specific needs."),(0,i.kt)("h4",{id:"dependency"},"Dependency"),(0,i.kt)("p",null,"In a production-scale environment, there are usually intricate dependencies between multiple applications. The ",(0,i.kt)("inlineCode",{parentName:"p"},"Dependency")," section is responsible for describing the dependencies between multiple applications."),(0,i.kt)("h2",{id:"references"},"References"),(0,i.kt)("ol",null,(0,i.kt)("li",{parentName:"ol"},"Score - ",(0,i.kt)("a",{parentName:"li",href:"https://docs.score.dev/docs/overview/"},"https://docs.score.dev/docs/overview/")),(0,i.kt)("li",{parentName:"ol"},"Acornfile - ",(0,i.kt)("a",{parentName:"li",href:"https://docs.acorn.io/authoring/overview"},"https://docs.acorn.io/authoring/overview")),(0,i.kt)("li",{parentName:"ol"},"KubeVela - ",(0,i.kt)("a",{parentName:"li",href:"https://kubevela.io/docs/getting-started/core-concept"},"https://kubevela.io/docs/getting-started/core-concept"))))}d.isMDXComponent=!0},57091:(e,t,n)=>{n.d(t,{Z:()=>o});const o=n.p+"assets/images/appconfig-04e20b2e12ca7d5c3bc3992b2d602416.png"}}]); \ No newline at end of file diff --git a/assets/js/f3facea8.ae53abab.js b/assets/js/f3facea8.2cf09d7b.js similarity index 50% rename from assets/js/f3facea8.ae53abab.js rename to assets/js/f3facea8.2cf09d7b.js index 7f04311567c..222fdbecfa3 100644 --- a/assets/js/f3facea8.ae53abab.js +++ b/assets/js/f3facea8.2cf09d7b.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2769],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>u});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),c=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),m=c(r),u=a,f=m["".concat(i,".").concat(u)]||m[u]||d[u]||l;return r?n.createElement(f,o(o({ref:t},p),{},{components:r})):n.createElement(f,o({ref:t},p))}));function u(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=m;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var c=2;c{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>d,frontMatter:()=>l,metadata:()=>s,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const l={},o="secret",s={unversionedId:"reference/modules/developer-schemas/internal/secret/secret",id:"version-v0.11/reference/modules/developer-schemas/internal/secret/secret",title:"secret",description:"Schema Secret",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/internal/secret/secret.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/internal/secret",slug:"/reference/modules/developer-schemas/internal/secret/",permalink:"/docs/reference/modules/developer-schemas/internal/secret/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/internal/secret/secret.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"probe",permalink:"/docs/reference/modules/developer-schemas/internal/container/probe/"},next:{title:"prometheus",permalink:"/docs/reference/modules/developer-schemas/monitoring/prometheus"}},i={},c=[{value:"Schema Secret",id:"schema-secret",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:c};function d(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"secret"},"secret"),(0,a.kt)("h2",{id:"schema-secret"},"Schema Secret"),(0,a.kt)("p",null,"Secrets are used to provide data that is considered sensitive like passwords, API keys,",(0,a.kt)("br",null),"TLS certificates, tokens or other credentials."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"data")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Data contains the non-binary secret data in string form."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"immutable")),(0,a.kt)("td",{parentName:"tr",align:null},"bool"),(0,a.kt)("td",{parentName:"tr",align:null},"Immutable, if set to true, ensures that data stored in the Secret cannot be updated."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"params")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Collection of parameters used to facilitate programmatic handling of secret data."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"type")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},'"basic"'),(0,a.kt)("td",{parentName:"tr",align:null},'"token"'),(0,a.kt)("td",{parentName:"tr",align:null},'"opaque"')))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.secret as sec\n\nbasicAuth = sec.Secret {\n type: "basic"\n data: {\n "username": ""\n "password": ""\n }\n}\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2769],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>u});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),c=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(i.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),m=c(r),u=a,f=m["".concat(i,".").concat(u)]||m[u]||d[u]||l;return r?n.createElement(f,o(o({ref:t},p),{},{components:r})):n.createElement(f,o({ref:t},p))}));function u(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=m;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var c=2;c{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>d,frontMatter:()=>l,metadata:()=>s,toc:()=>c});var n=r(87462),a=(r(67294),r(3905));const l={},o="secret",s={unversionedId:"reference/modules/developer-schemas/internal/secret/secret",id:"version-v0.11/reference/modules/developer-schemas/internal/secret/secret",title:"secret",description:"Schema Secret",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/internal/secret/secret.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/internal/secret",slug:"/reference/modules/developer-schemas/internal/secret/",permalink:"/docs/reference/modules/developer-schemas/internal/secret/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/internal/secret/secret.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"probe",permalink:"/docs/reference/modules/developer-schemas/internal/container/probe/"},next:{title:"prometheus",permalink:"/docs/reference/modules/developer-schemas/monitoring/prometheus"}},i={},c=[{value:"Schema Secret",id:"schema-secret",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:c};function d(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"secret"},"secret"),(0,a.kt)("h2",{id:"schema-secret"},"Schema Secret"),(0,a.kt)("p",null,"Secrets are used to provide data that is considered sensitive like passwords, API keys,",(0,a.kt)("br",null),"TLS certificates, tokens or other credentials."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"data")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Data contains the non-binary secret data in string form."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"immutable")),(0,a.kt)("td",{parentName:"tr",align:null},"bool"),(0,a.kt)("td",{parentName:"tr",align:null},"Immutable, if set to true, ensures that data stored in the Secret cannot be updated."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"params")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Collection of parameters used to facilitate programmatic handling of secret data."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"type")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},'"basic"'),(0,a.kt)("td",{parentName:"tr",align:null},'"token"'),(0,a.kt)("td",{parentName:"tr",align:null},'"opaque"')))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.secret as sec\n\nbasicAuth = sec.Secret {\n type: "basic"\n data: {\n "username": ""\n "password": ""\n }\n}\n')))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f4dc87f8.2ceeae98.js b/assets/js/f4dc87f8.2ceeae98.js new file mode 100644 index 00000000000..9a7b0c14214 --- /dev/null +++ b/assets/js/f4dc87f8.2ceeae98.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1731],{3905:(e,n,t)=>{t.d(n,{Zo:()=>l,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),p=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},l=function(e){var n=p(e.components);return r.createElement(c.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,l=s(e,["components","mdxType","originalType","parentName"]),f=p(t),m=o,d=f["".concat(c,".").concat(m)]||f[m]||u[m]||i;return t?r.createElement(d,a(a({ref:n},l),{},{components:t})):r.createElement(d,a({ref:n},l))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,a=new Array(i);a[0]=f;var s={};for(var c in n)hasOwnProperty.call(n,c)&&(s[c]=n[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var p=2;p{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>p});var r=t(87462),o=(t(67294),t(3905));const i={},a="kusion version",s={unversionedId:"reference/commands/kusion-version",id:"version-v0.10/reference/commands/kusion-version",title:"kusion version",description:"Print the Kusion version information for the current context",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-version.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-version",permalink:"/docs/v0.10/reference/commands/kusion-version",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-version.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion preview",permalink:"/docs/v0.10/reference/commands/kusion-preview"},next:{title:"kusion workspace create",permalink:"/docs/v0.10/reference/commands/kusion-workspace-create"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],l={toc:p};function u(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},l,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-version"},"kusion version"),(0,o.kt)("p",null,"Print the Kusion version information for the current context"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Print the Kusion version information for the current context"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion version [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Print the Kusion version\n kusion version\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for version\n -o, --output string Output format. Only json format is supported for now\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of KusionStack")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f4dc87f8.6783e1d2.js b/assets/js/f4dc87f8.6783e1d2.js deleted file mode 100644 index d4a3b274b9c..00000000000 --- a/assets/js/f4dc87f8.6783e1d2.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[1731],{3905:(e,n,t)=>{t.d(n,{Zo:()=>l,kt:()=>m});var r=t(67294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function i(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function s(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=r.createContext({}),p=function(e){var n=r.useContext(c),t=n;return e&&(t="function"==typeof e?e(n):s(s({},n),e)),t},l=function(e){var n=p(e.components);return r.createElement(c.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},f=r.forwardRef((function(e,n){var t=e.components,o=e.mdxType,i=e.originalType,c=e.parentName,l=a(e,["components","mdxType","originalType","parentName"]),f=p(t),m=o,d=f["".concat(c,".").concat(m)]||f[m]||u[m]||i;return t?r.createElement(d,s(s({ref:n},l),{},{components:t})):r.createElement(d,s({ref:n},l))}));function m(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var i=t.length,s=new Array(i);s[0]=f;var a={};for(var c in n)hasOwnProperty.call(n,c)&&(a[c]=n[c]);a.originalType=e,a.mdxType="string"==typeof e?e:o,s[1]=a;for(var p=2;p{t.r(n),t.d(n,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>i,metadata:()=>a,toc:()=>p});var r=t(87462),o=(t(67294),t(3905));const i={},s="kusion version",a={unversionedId:"reference/commands/kusion-version",id:"version-v0.10/reference/commands/kusion-version",title:"kusion version",description:"Print the Kusion version information for the current context",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-version.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-version",permalink:"/docs/v0.10/reference/commands/kusion-version",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-version.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion preview",permalink:"/docs/v0.10/reference/commands/kusion-preview"},next:{title:"kusion workspace create",permalink:"/docs/v0.10/reference/commands/kusion-workspace-create"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],l={toc:p};function u(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,r.Z)({},l,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-version"},"kusion version"),(0,o.kt)("p",null,"Print the Kusion version information for the current context"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Print the Kusion version information for the current context"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion version [flags]\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Print the Kusion version\n kusion version\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for version\n -o, --output string Output format. Only json format is supported for now\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of KusionStack")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f72402e6.4a6909ca.js b/assets/js/f72402e6.4a6909ca.js new file mode 100644 index 00000000000..f3c1c104f7f --- /dev/null +++ b/assets/js/f72402e6.4a6909ca.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6300],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var u=o.createContext({}),c=function(e){var t=o.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=c(e.components);return o.createElement(u.Provider,{value:t},e.children)},l={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,u=e.parentName,p=a(e,["components","mdxType","originalType","parentName"]),d=c(n),m=r,h=d["".concat(u,".").concat(m)]||d[m]||l[m]||s;return n?o.createElement(h,i(i({ref:t},p),{},{components:n})):o.createElement(h,i({ref:t},p))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,i=new Array(s);i[0]=d;var a={};for(var u in t)hasOwnProperty.call(t,u)&&(a[u]=t[u]);a.originalType=e,a.mdxType="string"==typeof e?e:r,i[1]=a;for(var c=2;c{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>l,frontMatter:()=>s,metadata:()=>a,toc:()=>c});var o=n(87462),r=(n(67294),n(3905));const s={},i="kusion mod push",a={unversionedId:"reference/commands/kusion-mod-push",id:"reference/commands/kusion-mod-push",title:"kusion mod push",description:"Push a module to OCI registry",source:"@site/docs/kusion/6-reference/1-commands/kusion-mod-push.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-mod-push",permalink:"/docs/next/reference/commands/kusion-mod-push",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-mod-push.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion mod init",permalink:"/docs/next/reference/commands/kusion-mod-init"},next:{title:"kusion mod",permalink:"/docs/next/reference/commands/kusion-mod"}},u={},c=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:c};function l(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,o.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"kusion-mod-push"},"kusion mod push"),(0,r.kt)("p",null,"Push a module to OCI registry"),(0,r.kt)("h3",{id:"synopsis"},"Synopsis"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"}," The push command packages the module as an OCI artifact and pushes it to the\n OCI registry using the version as the image tag.\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kusion mod push [MODULE PATH] [OCI REPOSITORY URL]\n")),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"\n # Push a module of current OS arch to an OCI Registry using a token\n kusion mod push /path/to/my-module oci://ghcr.io/org --creds \n\n # Push a module of specific OS arch to an OCI Registry using a token\n kusion mod push /path/to/my-module oci://ghcr.io/org --os-arch==darwin/arm64 --creds \n \n # Push a module to an OCI Registry using a credentials in : format. \n kusion mod push /path/to/my-module oci://ghcr.io/org --creds :\n\n # Push a release candidate without marking it as the latest stable\n kusion mod push /path/to/my-module oci://ghcr.io/org --latest=false\n\n # Push a module with custom OCI annotations\n kusion mod push /path/to/my-module oci://ghcr.io/org \\\n --annotation='org.opencontainers.image.documentation=https://app.org/docs'\n\n # Push and sign a module with Cosign (the cosign binary must be present in PATH)\n export COSIGN_PASSWORD=password\n kusion mod push /path/to/my-module oci://ghcr.io/org \\\n --sign=cosign --cosign-key=/path/to/cosign.key\n")),(0,r.kt)("h3",{id:"options"},"Options"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"}," -a, --annotations strings Set custom OCI annotations in '=' format.\n --cosign-key string The Cosign private key for signing the module.\n --creds string The credentials token for the OCI registry in or : format.\n -h, --help help for push\n --insecure-registry If true, allows connecting to a OCI registry without TLS or with self-signed certificates.\n --latest Tags the current version as the latest stable module version. (default true)\n --os-arch string The os arch of the module e.g. 'darwin/arm64', 'linux/amd64'.\n --sign string Signs the module with the specified provider.\n")),(0,r.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,r.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-mod"},"kusion mod"),"\t - Manage Kusion modules")),(0,r.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}l.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f72402e6.ac257c96.js b/assets/js/f72402e6.ac257c96.js deleted file mode 100644 index 5ec377c5c10..00000000000 --- a/assets/js/f72402e6.ac257c96.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6300],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>d});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var u=o.createContext({}),c=function(e){var t=o.useContext(u),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=c(e.components);return o.createElement(u.Provider,{value:t},e.children)},l={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},m=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,u=e.parentName,p=a(e,["components","mdxType","originalType","parentName"]),m=c(n),d=r,h=m["".concat(u,".").concat(d)]||m[d]||l[d]||s;return n?o.createElement(h,i(i({ref:t},p),{},{components:n})):o.createElement(h,i({ref:t},p))}));function d(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,i=new Array(s);i[0]=m;var a={};for(var u in t)hasOwnProperty.call(t,u)&&(a[u]=t[u]);a.originalType=e,a.mdxType="string"==typeof e?e:r,i[1]=a;for(var c=2;c{n.r(t),n.d(t,{assets:()=>u,contentTitle:()=>i,default:()=>l,frontMatter:()=>s,metadata:()=>a,toc:()=>c});var o=n(87462),r=(n(67294),n(3905));const s={},i="kusion mod push",a={unversionedId:"reference/commands/kusion-mod-push",id:"reference/commands/kusion-mod-push",title:"kusion mod push",description:"Push a module to OCI registry",source:"@site/docs/kusion/6-reference/1-commands/kusion-mod-push.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-mod-push",permalink:"/docs/next/reference/commands/kusion-mod-push",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-mod-push.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion mod init",permalink:"/docs/next/reference/commands/kusion-mod-init"},next:{title:"kusion mod",permalink:"/docs/next/reference/commands/kusion-mod"}},u={},c=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:c};function l(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,o.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"kusion-mod-push"},"kusion mod push"),(0,r.kt)("p",null,"Push a module to OCI registry"),(0,r.kt)("h3",{id:"synopsis"},"Synopsis"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"}," The push command packages the module as an OCI artifact and pushes it to the\n OCI registry using the version as the image tag.\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"kusion mod push [MODULE PATH] [OCI REPOSITORY URL]\n")),(0,r.kt)("h3",{id:"examples"},"Examples"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"\n # Push a module of current OS arch to an OCI Registry using a token\n kusion mod push /path/to/my-module oci://ghcr.io/org --creds \n\n # Push a module of specific OS arch to an OCI Registry using a token\n kusion mod push /path/to/my-module oci://ghcr.io/org --os-arch==darwin/arm64 --creds \n \n # Push a module to an OCI Registry using a credentials in : format. \n kusion mod push /path/to/my-module oci://ghcr.io/org --creds :\n\n # Push a release candidate without marking it as the latest stable\n kusion mod push /path/to/my-module oci://ghcr.io/org --latest=false\n\n # Push a module with custom OCI annotations\n kusion mod push /path/to/my-module oci://ghcr.io/org \\\n --annotation='org.opencontainers.image.documentation=https://app.org/docs'\n\n # Push and sign a module with Cosign (the cosign binary must be present in PATH)\n export COSIGN_PASSWORD=password\n kusion mod push /path/to/my-module oci://ghcr.io/org \\\n --sign=cosign --cosign-key=/path/to/cosign.key\n")),(0,r.kt)("h3",{id:"options"},"Options"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"}," -a, --annotations strings Set custom OCI annotations in '=' format.\n --cosign-key string The Cosign private key for signing the module.\n --creds string The credentials token for the OCI registry in or : format.\n -h, --help help for push\n --insecure-registry If true, allows connecting to a OCI registry without TLS or with self-signed certificates.\n --latest Tags the current version as the latest stable module version. (default true)\n --os-arch string The os arch of the module e.g. 'darwin/arm64', 'linux/amd64'.\n --sign string Signs the module with the specified provider.\n")),(0,r.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,r.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-mod"},"kusion mod"),"\t - Manage Kusion modules")),(0,r.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}l.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f7cb8cb3.d23819bc.js b/assets/js/f7cb8cb3.d4399452.js similarity index 56% rename from assets/js/f7cb8cb3.d23819bc.js rename to assets/js/f7cb8cb3.d4399452.js index aa73e9d0581..5a626369db2 100644 --- a/assets/js/f7cb8cb3.d23819bc.js +++ b/assets/js/f7cb8cb3.d4399452.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8741],{3905:(e,r,t)=>{t.d(r,{Zo:()=>l,kt:()=>m});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function s(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=n.createContext({}),p=function(e){var r=n.useContext(c),t=r;return e&&(t="function"==typeof e?e(r):s(s({},r),e)),t},l=function(e){var r=p(e.components);return n.createElement(c.Provider,{value:r},e.children)},u={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},d=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=p(t),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||a;return t?n.createElement(f,s(s({ref:r},l),{},{components:t})):n.createElement(f,s({ref:r},l))}));function m(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=t.length,s=new Array(a);s[0]=d;var i={};for(var c in r)hasOwnProperty.call(r,c)&&(i[c]=r[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var p=2;p{t.r(r),t.d(r,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=t(87462),o=(t(67294),t(3905));const a={},s="kusion workspace show",i={unversionedId:"reference/commands/kusion-workspace-show",id:"version-v0.10/reference/commands/kusion-workspace-show",title:"kusion workspace show",description:"Show a workspace configuration",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace-show.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-show",permalink:"/docs/v0.10/reference/commands/kusion-workspace-show",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace-show.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace list",permalink:"/docs/v0.10/reference/commands/kusion-workspace-list"},next:{title:"kusion workspace update",permalink:"/docs/v0.10/reference/commands/kusion-workspace-update"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],l={toc:p};function u(e){let{components:r,...t}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-show"},"kusion workspace show"),(0,o.kt)("p",null,"Show a workspace configuration"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command gets a specified workspace configuration."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace show\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Show a workspace configuration\n kusion workspace show dev\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for show\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8741],{3905:(e,r,t)=>{t.d(r,{Zo:()=>l,kt:()=>m});var n=t(67294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function s(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=n.createContext({}),p=function(e){var r=n.useContext(c),t=r;return e&&(t="function"==typeof e?e(r):s(s({},r),e)),t},l=function(e){var r=p(e.components);return n.createElement(c.Provider,{value:r},e.children)},u={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},d=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=p(t),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||a;return t?n.createElement(f,s(s({ref:r},l),{},{components:t})):n.createElement(f,s({ref:r},l))}));function m(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=t.length,s=new Array(a);s[0]=d;var i={};for(var c in r)hasOwnProperty.call(r,c)&&(i[c]=r[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var p=2;p{t.r(r),t.d(r,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=t(87462),o=(t(67294),t(3905));const a={},s="kusion workspace show",i={unversionedId:"reference/commands/kusion-workspace-show",id:"version-v0.10/reference/commands/kusion-workspace-show",title:"kusion workspace show",description:"Show a workspace configuration",source:"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace-show.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace-show",permalink:"/docs/v0.10/reference/commands/kusion-workspace-show",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace-show.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace list",permalink:"/docs/v0.10/reference/commands/kusion-workspace-list"},next:{title:"kusion workspace update",permalink:"/docs/v0.10/reference/commands/kusion-workspace-update"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Examples",id:"examples",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 4-Jan-2024",id:"auto-generated-by-spf13cobra-on-4-jan-2024",level:6}],l={toc:p};function u(e){let{components:r,...t}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace-show"},"kusion workspace show"),(0,o.kt)("p",null,"Show a workspace configuration"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"This command gets a specified workspace configuration."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace show\n")),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," # Show a workspace configuration\n kusion workspace show dev\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for show\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/v0.10/reference/commands/kusion-workspace"},"kusion workspace"),"\t - Workspace is a logical concept representing a target that stacks will be deployed to")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-4-jan-2024"},"Auto generated by spf13/cobra on 4-Jan-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f7f2164e.72299f2a.js b/assets/js/f7f2164e.72299f2a.js new file mode 100644 index 00000000000..edfa836dc92 --- /dev/null +++ b/assets/js/f7f2164e.72299f2a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9095],{3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var o=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function i(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var l=o.createContext({}),p=function(e){var n=o.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},u=function(e){var n=p(e.components);return o.createElement(l.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},d=o.forwardRef((function(e,n){var t=e.components,a=e.mdxType,r=e.originalType,l=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=p(t),m=a,f=d["".concat(l,".").concat(m)]||d[m]||c[m]||r;return t?o.createElement(f,i(i({ref:n},u),{},{components:t})):o.createElement(f,i({ref:n},u))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var r=t.length,i=new Array(r);i[0]=d;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var p=2;p{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>i,default:()=>c,frontMatter:()=>r,metadata:()=>s,toc:()=>p});var o=t(87462),a=(t(67294),t(3905));const r={id:"how-kusion-works",sidebar_label:"How Kusion Works?"},i="How Kusion Works?",s={unversionedId:"concepts/how-kusion-works",id:"concepts/how-kusion-works",title:"How Kusion Works?",description:"Kusion is the platform engineering engine of KusionStack. It delivers intentions described with Kusion Modules defined in Catalog to Kubernetes, Clouds and On-Prem infrastructures.",source:"@site/docs/kusion/3-concepts/9-how-kusion-works.md",sourceDirName:"3-concepts",slug:"/concepts/how-kusion-works",permalink:"/docs/next/concepts/how-kusion-works",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/3-concepts/9-how-kusion-works.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:9,frontMatter:{id:"how-kusion-works",sidebar_label:"How Kusion Works?"},sidebar:"kusion",previous:{title:"Configuration",permalink:"/docs/next/concepts/configuration"},next:{title:"Configuration File Overview",permalink:"/docs/next/configuration-walkthrough/overview"}},l={},p=[{value:"Overview",id:"overview",level:2},{value:"Platform Developer\u2019s Workflow",id:"platform-developers-workflow",level:2},{value:"Design Kusion Modules",id:"design-kusion-modules",level:3},{value:"Instantiate and Set Up Workspaces",id:"instantiate-and-set-up-workspaces",level:3},{value:"Application Developer\u2019s Workflow",id:"application-developers-workflow",level:2},{value:"Instantiate AppConfiguration and Apply",id:"instantiate-appconfiguration-and-apply",level:3}],u={toc:p};function c(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,o.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"how-kusion-works"},"How Kusion Works?"),(0,a.kt)("p",null,"Kusion is the platform engineering engine of ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack"},"KusionStack"),". It delivers intentions described with Kusion Modules defined in ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"Catalog")," to Kubernetes, Clouds and On-Prem infrastructures."),(0,a.kt)("p",null,(0,a.kt)("img",{parentName:"p",src:"https://raw.githubusercontent.com/KusionStack/kusion/main/docs/workflow.png",alt:"arch"})),(0,a.kt)("h2",{id:"overview"},"Overview"),(0,a.kt)("p",null,"The workflow of KusionStack is illustrated in the diagram above, and it consists of three steps. The first step is ",(0,a.kt)("inlineCode",{parentName:"p"},"Write"),", where platform engineers provide Kusion Modules and application developers write AppConfigurations based on the Kusion Modules to describe their operational intent."),(0,a.kt)("p",null,"The second step is the ",(0,a.kt)("inlineCode",{parentName:"p"},"Build")," process, which results in the creation of the SSoT (Single Source of Truth), also known as the ",(0,a.kt)("a",{parentName:"p",href:"spec"},"Intent")," of the current operational task. If you need version management of the SSoT, we recommend you manage the Intent with a VCS (Version Control System) tool like git."),(0,a.kt)("p",null,"The third step is ",(0,a.kt)("inlineCode",{parentName:"p"},"Apply")," which makes the Intent effective. Kusion parses the operational intent based on the Intent produced in the previous step. Before applying the intent, Kusion will execute the Preview command (you can also execute this command manually) which will use a three-way diff algorithm to preview changes and prompt users to make sure all changes meet expectations; the Apply command will then actualize the operational intent onto various infrastructure platforms. Currently, it supports three runtimes: Terraform, Kubernetes, and on-prem infrastructures."),(0,a.kt)("p",null,"As a user of Kusion, if you prefer not to be conscious of so many steps, you can simply use ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion apply"),", and Kusion will automatically execute all the aforementioned steps for you."),(0,a.kt)("h2",{id:"platform-developers-workflow"},"Platform Developer\u2019s Workflow"),(0,a.kt)("h3",{id:"design-kusion-modules"},"Design Kusion Modules"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"kusion-module/overview"},"Kusion Module")," is a reusable building block designed by platform engineers and contains two components: an application developer-oriented schema and a Kusion module generator. When platform engineers have developed a Kusion module, they can push it to a ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"catalog")," repository to make it into a KCL package."),(0,a.kt)("p",null,"Given a database Kusion module as an example, the schema definition is shown below and the generator logic can be found ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/pkg/modules/generators/accessories/database_generator.go"},"here"),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'schema MySQL: \n """ MySQL describes the attributes to locally deploy or create a cloud provider\n managed mysql database instance for the workload. \n\n Attributes\n ----------\n type: "local" | "cloud", defaults to Undefined, required. \n Type defines whether the mysql database is deployed locally or provided by \n cloud vendor. \n version: str, defaults to Undefined, required. \n Version defines the mysql version to use. \n\n Examples\n --------\n Instantiate a local mysql database with version of 5.7. \n\n import models.schema.v1.accessories.mysql\n\n mysql: mysql.MySQL {\n type: "local"\n version: "5.7"\n }\n """\n\n # The deployment mode of the mysql database. \n type: "local" | "cloud"\n\n # The mysql database version to use. \n version: str\n')),(0,a.kt)("h3",{id:"instantiate-and-set-up-workspaces"},"Instantiate and Set Up Workspaces"),(0,a.kt)("p",null,"Each ",(0,a.kt)("a",{parentName:"p",href:"workspace"},"workspace")," includes a corresponding Platform config file maintained by platform engineers.\nPlatform engineers should instantiate all workspaces and fulfill all fields with platform default values. Kusion will merge the workspace configuration with AppConfiguration in the Stack of the same name. An example is as follows."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n # your kubeconfig file path\n kubernetes:\n kubeConfig: /etc/kubeconfig.yaml\n # metadat of used terraform providers\n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n aws: \n version: 5.0.1\n source: hashicorp/aws\n region: us-east-1\n\nmodules: \n # platform configuration of AWS RDS MySQL\n mysql: \n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n privateRouting: false\n suffix: "-mysql"\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"mysql")," block represents a Kusion module. The fields inside are parts of the inputs for the Kusion module generator. For more details about the workspace, please refer to the ",(0,a.kt)("a",{parentName:"p",href:"workspace"},"workspace")," section."),(0,a.kt)("h2",{id:"application-developers-workflow"},"Application Developer\u2019s Workflow"),(0,a.kt)("h3",{id:"instantiate-appconfiguration-and-apply"},"Instantiate AppConfiguration and Apply"),(0,a.kt)("p",null,"Application developers choose Kusion modules they need and instantiate them in the AppConfiguration to describe their operation intentions. We have built some built-in Kusion modules in the repository ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"Catalog")," and we warmly welcome you to join us in building this ecosystem together."),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"main.k")," is the ",(0,a.kt)("strong",{parentName:"p"},"only")," configuration maintained by application developers and schemas in this file are defined from the application developer's perspective to reduce their cognitive load. An example is as follows."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-pthyon"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.network as n\nimport catalog.models.schema.v1.accessories.mysql\n\n# main.k declares customized configurations for dev stacks.\nwordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n wordpress: c.Container {\n image: "wordpress:6.3"\n env: {\n "WORDPRESS_DB_HOST": "$(KUSION_DB_HOST_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_NAME": "mysql"\n }\n ......\n }\n }\n ......\n }\n database: {\n wordpress: mysql.MySQL {\n type: "cloud"\n version: "8.0"\n }\n }\n}\n')),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"workload")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"database")," are both Kusion modules provided by platform engineers and Kusion will convert them into actual infrastructure API calls eventually."),(0,a.kt)("p",null,"Finally, application developers can deliver their operational intent to infrastructures with one command ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion apply"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f7f2164e.c81197c7.js b/assets/js/f7f2164e.c81197c7.js deleted file mode 100644 index 61b8cd9f359..00000000000 --- a/assets/js/f7f2164e.c81197c7.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9095],{3905:(e,n,t)=>{t.d(n,{Zo:()=>u,kt:()=>m});var o=t(67294);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function r(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function i(e){for(var n=1;n=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var l=o.createContext({}),p=function(e){var n=o.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},u=function(e){var n=p(e.components);return o.createElement(l.Provider,{value:n},e.children)},c={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},d=o.forwardRef((function(e,n){var t=e.components,a=e.mdxType,r=e.originalType,l=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=p(t),m=a,f=d["".concat(l,".").concat(m)]||d[m]||c[m]||r;return t?o.createElement(f,i(i({ref:n},u),{},{components:t})):o.createElement(f,i({ref:n},u))}));function m(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var r=t.length,i=new Array(r);i[0]=d;var s={};for(var l in n)hasOwnProperty.call(n,l)&&(s[l]=n[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var p=2;p{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>i,default:()=>c,frontMatter:()=>r,metadata:()=>s,toc:()=>p});var o=t(87462),a=(t(67294),t(3905));const r={id:"how-kusion-works",sidebar_label:"How Kusion Works?"},i="How Kusion Works?",s={unversionedId:"concepts/how-kusion-works",id:"concepts/how-kusion-works",title:"How Kusion Works?",description:"Kusion is the platform engineering engine of KusionStack. It delivers intentions described with Kusion Modules defined in Catalog to Kubernetes, Clouds and On-Prem infrastructures.",source:"@site/docs/kusion/3-concepts/9-how-kusion-works.md",sourceDirName:"3-concepts",slug:"/concepts/how-kusion-works",permalink:"/docs/next/concepts/how-kusion-works",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/3-concepts/9-how-kusion-works.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:9,frontMatter:{id:"how-kusion-works",sidebar_label:"How Kusion Works?"},sidebar:"kusion",previous:{title:"Configuration",permalink:"/docs/next/concepts/configuration"},next:{title:"Configuration File Overview",permalink:"/docs/next/configuration-walkthrough/overview"}},l={},p=[{value:"Overview",id:"overview",level:2},{value:"Platform Developer\u2019s Workflow",id:"platform-developers-workflow",level:2},{value:"Design Kusion Modules",id:"design-kusion-modules",level:3},{value:"Instantiate and Set Up Workspaces",id:"instantiate-and-set-up-workspaces",level:3},{value:"Application Developer\u2019s Workflow",id:"application-developers-workflow",level:2},{value:"Instantiate AppConfiguration and Apply",id:"instantiate-appconfiguration-and-apply",level:3}],u={toc:p};function c(e){let{components:n,...t}=e;return(0,a.kt)("wrapper",(0,o.Z)({},u,t,{components:n,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"how-kusion-works"},"How Kusion Works?"),(0,a.kt)("p",null,"Kusion is the platform engineering engine of ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack"},"KusionStack"),". It delivers intentions described with Kusion Modules defined in ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"Catalog")," to Kubernetes, Clouds and On-Prem infrastructures."),(0,a.kt)("p",null,(0,a.kt)("img",{parentName:"p",src:"https://raw.githubusercontent.com/KusionStack/kusion/main/docs/workflow.png",alt:"arch"})),(0,a.kt)("h2",{id:"overview"},"Overview"),(0,a.kt)("p",null,"The workflow of KusionStack is illustrated in the diagram above, and it consists of three steps. The first step is ",(0,a.kt)("inlineCode",{parentName:"p"},"Write"),", where platform engineers provide Kusion Modules and application developers write AppConfigurations based on the Kusion Modules to describe their operational intent."),(0,a.kt)("p",null,"The second step is the ",(0,a.kt)("inlineCode",{parentName:"p"},"Build")," process, which results in the creation of the SSoT (Single Source of Truth), also known as the ",(0,a.kt)("a",{parentName:"p",href:"spec"},"Intent")," of the current operational task. If you need version management of the SSoT, we recommend you manage the Intent with a VCS (Version Control System) tool like git."),(0,a.kt)("p",null,"The third step is ",(0,a.kt)("inlineCode",{parentName:"p"},"Apply")," which makes the Intent effective. Kusion parses the operational intent based on the Intent produced in the previous step. Before applying the intent, Kusion will execute the Preview command (you can also execute this command manually) which will use a three-way diff algorithm to preview changes and prompt users to make sure all changes meet expectations; the Apply command will then actualize the operational intent onto various infrastructure platforms. Currently, it supports three runtimes: Terraform, Kubernetes, and on-prem infrastructures."),(0,a.kt)("p",null,"As a user of Kusion, if you prefer not to be conscious of so many steps, you can simply use ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion apply"),", and Kusion will automatically execute all the aforementioned steps for you."),(0,a.kt)("h2",{id:"platform-developers-workflow"},"Platform Developer\u2019s Workflow"),(0,a.kt)("h3",{id:"design-kusion-modules"},"Design Kusion Modules"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"kusion-module/overview"},"Kusion Module")," is a reusable building block designed by platform engineers and contains two components: an application developer-oriented schema and a Kusion module generator. When platform engineers have developed a Kusion module, they can push it to a ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"catalog")," repository to make it into a KCL package."),(0,a.kt)("p",null,"Given a database Kusion module as an example, the schema definition is shown below and the generator logic can be found ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/kusion/blob/main/pkg/modules/generators/accessories/database_generator.go"},"here"),"."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'schema MySQL: \n """ MySQL describes the attributes to locally deploy or create a cloud provider\n managed mysql database instance for the workload. \n\n Attributes\n ----------\n type: "local" | "cloud", defaults to Undefined, required. \n Type defines whether the mysql database is deployed locally or provided by \n cloud vendor. \n version: str, defaults to Undefined, required. \n Version defines the mysql version to use. \n\n Examples\n --------\n Instantiate a local mysql database with version of 5.7. \n\n import models.schema.v1.accessories.mysql\n\n mysql: mysql.MySQL {\n type: "local"\n version: "5.7"\n }\n """\n\n # The deployment mode of the mysql database. \n type: "local" | "cloud"\n\n # The mysql database version to use. \n version: str\n')),(0,a.kt)("h3",{id:"instantiate-and-set-up-workspaces"},"Instantiate and Set Up Workspaces"),(0,a.kt)("p",null,"Each ",(0,a.kt)("a",{parentName:"p",href:"workspace"},"workspace")," includes a corresponding Platform config file maintained by platform engineers.\nPlatform engineers should instantiate all workspaces and fulfill all fields with platform default values. Kusion will merge the workspace configuration with AppConfiguration in the Stack of the same name. An example is as follows."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-yaml"},'runtimes: \n # your kubeconfig file path\n kubernetes:\n kubeConfig: /etc/kubeconfig.yaml\n # metadat of used terraform providers\n terraform: \n random: \n version: 3.5.1\n source: hashicorp/random\n aws: \n version: 5.0.1\n source: hashicorp/aws\n region: us-east-1\n\nmodules: \n # platform configuration of AWS RDS MySQL\n mysql: \n default: \n cloud: aws\n size: 20\n instanceType: db.t3.micro\n privateRouting: false\n suffix: "-mysql"\n')),(0,a.kt)("p",null,"The ",(0,a.kt)("inlineCode",{parentName:"p"},"mysql")," block represents a Kusion module. The fields inside are parts of the inputs for the Kusion module generator. For more details about the workspace, please refer to the ",(0,a.kt)("a",{parentName:"p",href:"workspace"},"workspace")," section."),(0,a.kt)("h2",{id:"application-developers-workflow"},"Application Developer\u2019s Workflow"),(0,a.kt)("h3",{id:"instantiate-appconfiguration-and-apply"},"Instantiate AppConfiguration and Apply"),(0,a.kt)("p",null,"Application developers choose Kusion modules they need and instantiate them in the AppConfiguration to describe their operation intentions. We have built some built-in Kusion modules in the repository ",(0,a.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/catalog"},"Catalog")," and we warmly welcome you to join us in building this ecosystem together."),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"main.k")," is the ",(0,a.kt)("strong",{parentName:"p"},"only")," configuration maintained by application developers and schemas in this file are defined from the application developer's perspective to reduce their cognitive load. An example is as follows."),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-pthyon"},'import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.container as c\nimport catalog.models.schema.v1.workload.network as n\nimport catalog.models.schema.v1.accessories.mysql\n\n# main.k declares customized configurations for dev stacks.\nwordpress: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n wordpress: c.Container {\n image: "wordpress:6.3"\n env: {\n "WORDPRESS_DB_HOST": "$(KUSION_DB_HOST_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_USER": "$(KUSION_DB_USERNAME_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_PASSWORD": "$(KUSION_DB_PASSWORD_WORDPRESS_MYSQL)"\n "WORDPRESS_DB_NAME": "mysql"\n }\n ......\n }\n }\n ......\n }\n database: {\n wordpress: mysql.MySQL {\n type: "cloud"\n version: "8.0"\n }\n }\n}\n')),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"workload")," and ",(0,a.kt)("inlineCode",{parentName:"p"},"database")," are both Kusion modules provided by platform engineers and Kusion will convert them into actual infrastructure API calls eventually."),(0,a.kt)("p",null,"Finally, application developers can deliver their operational intent to infrastructures with one command ",(0,a.kt)("inlineCode",{parentName:"p"},"kusion apply"),"."))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f8e6c3d7.4bbd2653.js b/assets/js/f8e6c3d7.4bbd2653.js new file mode 100644 index 00000000000..34a517250e4 --- /dev/null +++ b/assets/js/f8e6c3d7.4bbd2653.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6064],{3905:(e,n,t)=>{t.d(n,{Zo:()=>s,kt:()=>g});var o=t(67294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function i(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var l=o.createContext({}),c=function(e){var n=o.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):i(i({},n),e)),t},s=function(e){var n=c(e.components);return o.createElement(l.Provider,{value:n},e.children)},u={inlineCode:"code",wrapper:function(e){var n=e.children;return o.createElement(o.Fragment,{},n)}},d=o.forwardRef((function(e,n){var t=e.components,r=e.mdxType,a=e.originalType,l=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),d=c(t),g=r,m=d["".concat(l,".").concat(g)]||d[g]||u[g]||a;return t?o.createElement(m,i(i({ref:n},s),{},{components:t})):o.createElement(m,i({ref:n},s))}));function g(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var a=t.length,i=new Array(a);i[0]=d;var p={};for(var l in n)hasOwnProperty.call(n,l)&&(p[l]=n[l]);p.originalType=e,p.mdxType="string"==typeof e?e:r,i[1]=p;for(var c=2;c{t.r(n),t.d(n,{assets:()=>l,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>p,toc:()=>c});var o=t(87462),r=(t(67294),t(3905));const a={sidebar_position:5},i="Application Networking",p={unversionedId:"config-walkthrough/networking",id:"version-v0.9/config-walkthrough/networking",title:"Application Networking",description:"In addition to configuring application's container specifications, you can also configure its networking behaviors, including how to expose the application and how it can be accessed.",source:"@site/docs_versioned_docs/version-v0.9/config-walkthrough/networking.md",sourceDirName:"config-walkthrough",slug:"/config-walkthrough/networking",permalink:"/docs/v0.9/config-walkthrough/networking",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/config-walkthrough/networking.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:5,frontMatter:{sidebar_position:5},sidebar:"kusion",previous:{title:"Workload",permalink:"/docs/v0.9/config-walkthrough/workload"},next:{title:"Managed Databases",permalink:"/docs/v0.9/config-walkthrough/database"}},l={},c=[{value:"Import",id:"import",level:2},{value:"Private vs Public Access",id:"private-vs-public-access",level:2},{value:"Mapping ports",id:"mapping-ports",level:2},{value:"Exposing multiple ports",id:"exposing-multiple-ports",level:2},{value:"Choosing protocol",id:"choosing-protocol",level:2}],s={toc:c};function u(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,o.Z)({},s,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"application-networking"},"Application Networking"),(0,r.kt)("p",null,"In addition to configuring application's ",(0,r.kt)("a",{parentName:"p",href:"workload#configure-containers"},"container specifications"),", you can also configure its networking behaviors, including how to expose the application and how it can be accessed."),(0,r.kt)("p",null,"In future versions, this will also include ingress-based routing strategy and DNS configurations."),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"catalog")," package. For more details on KCL package import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.network as n\n")),(0,r.kt)("h2",{id:"private-vs-public-access"},"Private vs Public Access"),(0,r.kt)("p",null,"Private network access means the service can only be access from within the target cluster."),(0,r.kt)("p",null,"Public access is implemented using public load balancers on the cloud as of v0.9.0. This generally requires a Kubernetes cluster that is running on the cloud with a vendor-specific service controller."),(0,r.kt)("p",null,"Any ports defined default to private access unless explicitly specified."),(0,r.kt)("p",null,"To expose port 80 to be accessed privately:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n}\n")),(0,r.kt)("p",null,"To expose port 80 to be accessed publicly on AWS using an AWS Load Balancer:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n ports: [\n n.Port {\n type: "aws"\n port: 80\n public: True\n }\n ]\n }\n}\n')),(0,r.kt)("h2",{id:"mapping-ports"},"Mapping ports"),(0,r.kt)("p",null,"To expose a port ",(0,r.kt)("inlineCode",{parentName:"p"},"80")," that maps to a different port ",(0,r.kt)("inlineCode",{parentName:"p"},"8088")," on the container:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n ports: [\n n.Port {\n port: 80\n targetPort: 8088\n }\n ]\n }\n}\n")),(0,r.kt)("h2",{id:"exposing-multiple-ports"},"Exposing multiple ports"),(0,r.kt)("p",null,"You can also expose multiple ports and configure them separately. "),(0,r.kt)("p",null,"To expose port 80 to be accessed publicly on an AliCloud load balancer, and port 9099 for private access (to be scraped by Prometheus, for example):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n ports: [\n n.Port {\n type: "aliyun"\n port: 80\n public: True\n }\n n.Port {\n port: 9099\n }\n ]\n }\n}\n')),(0,r.kt)("h2",{id:"choosing-protocol"},"Choosing protocol"),(0,r.kt)("p",null,"To expose a port using the ",(0,r.kt)("inlineCode",{parentName:"p"},"UDP")," protocol:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n ports: [\n n.Port {\n port: 80\n targetPort: 8088\n protocol: "UDP"\n }\n ]\n }\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f8e6c3d7.fe66a94a.js b/assets/js/f8e6c3d7.fe66a94a.js deleted file mode 100644 index 833bd94fe54..00000000000 --- a/assets/js/f8e6c3d7.fe66a94a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6064],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>g});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=o.createContext({}),c=function(e){var t=o.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},s=function(e){var t=c(e.components);return o.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,l=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),d=c(n),g=r,m=d["".concat(l,".").concat(g)]||d[g]||u[g]||a;return n?o.createElement(m,i(i({ref:t},s),{},{components:n})):o.createElement(m,i({ref:t},s))}));function g(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,i=new Array(a);i[0]=d;var p={};for(var l in t)hasOwnProperty.call(t,l)&&(p[l]=t[l]);p.originalType=e,p.mdxType="string"==typeof e?e:r,i[1]=p;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>p,toc:()=>c});var o=n(87462),r=(n(67294),n(3905));const a={sidebar_position:5},i="Application Networking",p={unversionedId:"config-walkthrough/networking",id:"version-v0.9/config-walkthrough/networking",title:"Application Networking",description:"In addition to configuring application's container specifications, you can also configure its networking behaviors, including how to expose the application and how it can be accessed.",source:"@site/docs_versioned_docs/version-v0.9/config-walkthrough/networking.md",sourceDirName:"config-walkthrough",slug:"/config-walkthrough/networking",permalink:"/docs/v0.9/config-walkthrough/networking",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/config-walkthrough/networking.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:5,frontMatter:{sidebar_position:5},sidebar:"kusion",previous:{title:"Workload",permalink:"/docs/v0.9/config-walkthrough/workload"},next:{title:"Managed Databases",permalink:"/docs/v0.9/config-walkthrough/database"}},l={},c=[{value:"Import",id:"import",level:2},{value:"Private vs Public Access",id:"private-vs-public-access",level:2},{value:"Mapping ports",id:"mapping-ports",level:2},{value:"Exposing multiple ports",id:"exposing-multiple-ports",level:2},{value:"Choosing protocol",id:"choosing-protocol",level:2}],s={toc:c};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,o.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"application-networking"},"Application Networking"),(0,r.kt)("p",null,"In addition to configuring application's ",(0,r.kt)("a",{parentName:"p",href:"workload#configure-containers"},"container specifications"),", you can also configure its networking behaviors, including how to expose the application and how it can be accessed."),(0,r.kt)("p",null,"In future versions, this will also include ingress-based routing strategy and DNS configurations."),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"catalog")," package. For more details on KCL package import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport catalog.models.schema.v1.workload.network as n\n")),(0,r.kt)("h2",{id:"private-vs-public-access"},"Private vs Public Access"),(0,r.kt)("p",null,"Private network access means the service can only be access from within the target cluster."),(0,r.kt)("p",null,"Public access is implemented using public load balancers on the cloud as of v0.9.0. This generally requires a Kubernetes cluster that is running on the cloud with a vendor-specific service controller."),(0,r.kt)("p",null,"Any ports defined default to private access unless explicitly specified."),(0,r.kt)("p",null,"To expose port 80 to be accessed privately:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n ports: [\n n.Port {\n port: 80\n }\n ]\n }\n}\n")),(0,r.kt)("p",null,"To expose port 80 to be accessed publicly on AWS using an AWS Load Balancer:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n ports: [\n n.Port {\n type: "aws"\n port: 80\n public: True\n }\n ]\n }\n}\n')),(0,r.kt)("h2",{id:"mapping-ports"},"Mapping ports"),(0,r.kt)("p",null,"To expose a port ",(0,r.kt)("inlineCode",{parentName:"p"},"80")," that maps to a different port ",(0,r.kt)("inlineCode",{parentName:"p"},"8088")," on the container:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n ports: [\n n.Port {\n port: 80\n targetPort: 8088\n }\n ]\n }\n}\n")),(0,r.kt)("h2",{id:"exposing-multiple-ports"},"Exposing multiple ports"),(0,r.kt)("p",null,"You can also expose multiple ports and configure them separately. "),(0,r.kt)("p",null,"To expose port 80 to be accessed publicly on an AliCloud load balancer, and port 9099 for private access (to be scraped by Prometheus, for example):"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n ports: [\n n.Port {\n type: "aliyun"\n port: 80\n public: True\n }\n n.Port {\n port: 9099\n }\n ]\n }\n}\n')),(0,r.kt)("h2",{id:"choosing-protocol"},"Choosing protocol"),(0,r.kt)("p",null,"To expose a port using the ",(0,r.kt)("inlineCode",{parentName:"p"},"UDP")," protocol:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n ports: [\n n.Port {\n port: 80\n targetPort: 8088\n protocol: "UDP"\n }\n ]\n }\n}\n')))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/faf6f2db.401c99df.js b/assets/js/faf6f2db.401c99df.js deleted file mode 100644 index c45640cfbd8..00000000000 --- a/assets/js/faf6f2db.401c99df.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9505],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>k});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=p(r),k=o,m=d["".concat(c,".").concat(k)]||d[k]||u[k]||a;return r?n.createElement(m,s(s({ref:t},l),{},{components:r})):n.createElement(m,s({ref:t},l))}));function k(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion workspace",i={unversionedId:"reference/commands/kusion-workspace",id:"version-v0.11/reference/commands/kusion-workspace",title:"kusion workspace",description:"Workspace is a logical concept representing a target that stacks will be deployed to",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace",permalink:"/docs/reference/commands/kusion-workspace",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace update",permalink:"/docs/reference/commands/kusion-workspace-update"},next:{title:"Kusion Modules",permalink:"/docs/reference/modules/"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace"},"kusion workspace"),(0,o.kt)("p",null,"Workspace is a logical concept representing a target that stacks will be deployed to"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Workspace is a logical concept representing a target that stacks will be deployed to."),(0,o.kt)("p",null," Workspace is managed by platform engineers, which contains a set of configurations that application developers do not want or should not concern, and is reused by multiple stacks belonging to different projects."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace [flags]\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for workspace\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-workspace-create"},"kusion workspace create"),"\t - Create a new workspace"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-workspace-delete"},"kusion workspace delete"),"\t - Delete a workspace"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-workspace-list"},"kusion workspace list"),"\t - List all workspace names"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-workspace-show"},"kusion workspace show"),"\t - Show a workspace configuration"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-workspace-switch"},"kusion workspace switch"),"\t - Switch the current workspace"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-workspace-update"},"kusion workspace update"),"\t - Update a workspace configuration")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/faf6f2db.bae87dc3.js b/assets/js/faf6f2db.bae87dc3.js new file mode 100644 index 00000000000..e89b4c1a1bd --- /dev/null +++ b/assets/js/faf6f2db.bae87dc3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[9505],{3905:(e,t,r)=>{r.d(t,{Zo:()=>l,kt:()=>k});var n=r(67294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),p=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):s(s({},t),e)),r},l=function(e){var t=p(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,l=i(e,["components","mdxType","originalType","parentName"]),d=p(r),k=o,m=d["".concat(c,".").concat(k)]||d[k]||u[k]||a;return r?n.createElement(m,s(s({ref:t},l),{},{components:r})):n.createElement(m,s({ref:t},l))}));function k(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,s=new Array(a);s[0]=d;var i={};for(var c in t)hasOwnProperty.call(t,c)&&(i[c]=t[c]);i.originalType=e,i.mdxType="string"==typeof e?e:o,s[1]=i;for(var p=2;p{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>s,default:()=>u,frontMatter:()=>a,metadata:()=>i,toc:()=>p});var n=r(87462),o=(r(67294),r(3905));const a={},s="kusion workspace",i={unversionedId:"reference/commands/kusion-workspace",id:"version-v0.11/reference/commands/kusion-workspace",title:"kusion workspace",description:"Workspace is a logical concept representing a target that stacks will be deployed to",source:"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-workspace",permalink:"/docs/reference/commands/kusion-workspace",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion workspace update",permalink:"/docs/reference/commands/kusion-workspace-update"},next:{title:"Kusion Modules",permalink:"/docs/reference/modules/"}},c={},p=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],l={toc:p};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},l,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-workspace"},"kusion workspace"),(0,o.kt)("p",null,"Workspace is a logical concept representing a target that stacks will be deployed to"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Workspace is a logical concept representing a target that stacks will be deployed to."),(0,o.kt)("p",null," Workspace is managed by platform engineers, which contains a set of configurations that application developers do not want or should not concern, and is reused by multiple stacks belonging to different projects."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion workspace [flags]\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for workspace\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-workspace-create"},"kusion workspace create"),"\t - Create a new workspace"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-workspace-delete"},"kusion workspace delete"),"\t - Delete a workspace"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-workspace-list"},"kusion workspace list"),"\t - List all workspace names"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-workspace-show"},"kusion workspace show"),"\t - Show a workspace configuration"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-workspace-switch"},"kusion workspace switch"),"\t - Switch the current workspace"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/reference/commands/kusion-workspace-update"},"kusion workspace update"),"\t - Update a workspace configuration")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/fb3f88b1.bfb726f8.js b/assets/js/fb3f88b1.bfb726f8.js deleted file mode 100644 index 5d60a9a1a9a..00000000000 --- a/assets/js/fb3f88b1.bfb726f8.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4370],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>d});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),u=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=u(e.components);return n.createElement(i.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,l=e.originalType,i=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),m=u(r),d=a,f=m["".concat(i,".").concat(d)]||m[d]||c[d]||l;return r?n.createElement(f,o(o({ref:t},p),{},{components:r})):n.createElement(f,o({ref:t},p))}));function d(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=r.length,o=new Array(l);o[0]=m;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var u=2;u{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>o,default:()=>c,frontMatter:()=>l,metadata:()=>s,toc:()=>u});var n=r(87462),a=(r(67294),r(3905));const l={},o="opsrule",s={unversionedId:"reference/modules/catalog-models/trait/opsrule",id:"version-v0.10/reference/modules/catalog-models/trait/opsrule",title:"opsrule",description:"Schema OpsRule",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/trait/opsrule.md",sourceDirName:"6-reference/2-modules/1-catalog-models/trait",slug:"/reference/modules/catalog-models/trait/opsrule",permalink:"/docs/v0.10/reference/modules/catalog-models/trait/opsrule",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/trait/opsrule.md",tags:[],version:"v0.10",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"prometheus",permalink:"/docs/v0.10/reference/modules/catalog-models/monitoring/prometheus"},next:{title:"job",permalink:"/docs/v0.10/reference/modules/catalog-models/workload/job"}},i={},u=[{value:"Schema OpsRule",id:"schema-opsrule",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:u};function c(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"opsrule"},"opsrule"),(0,a.kt)("h2",{id:"schema-opsrule"},"Schema OpsRule"),(0,a.kt)("p",null,"OpsRule describes operation rules for various Day-2 Operations. Once declared, these",(0,a.kt)("br",null),"operation rules will be checked before any Day-2 operations."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"maxUnavailable"),(0,a.kt)("br",null),"The maximum percentage of the total pod instances in the component that can be",(0,a.kt)("br",null),"simultaneously unhealthy."),(0,a.kt)("td",{parentName:"tr",align:null},"int ","|"," str"),(0,a.kt)("td",{parentName:"tr",align:null},'"25%"'),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.trait as t\n\nopsRule : t.OpsRule {\n maxUnavailable: "30%"\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/fb3f88b1.fea87c31.js b/assets/js/fb3f88b1.fea87c31.js new file mode 100644 index 00000000000..271dbc9656f --- /dev/null +++ b/assets/js/fb3f88b1.fea87c31.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4370],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>d});var n=r(67294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var i=n.createContext({}),u=function(e){var t=n.useContext(i),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},p=function(e){var t=u(e.components);return n.createElement(i.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},m=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,i=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),m=u(r),d=a,f=m["".concat(i,".").concat(d)]||m[d]||c[d]||o;return r?n.createElement(f,l(l({ref:t},p),{},{components:r})):n.createElement(f,l({ref:t},p))}));function d(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,l=new Array(o);l[0]=m;var s={};for(var i in t)hasOwnProperty.call(t,i)&&(s[i]=t[i]);s.originalType=e,s.mdxType="string"==typeof e?e:a,l[1]=s;for(var u=2;u{r.r(t),r.d(t,{assets:()=>i,contentTitle:()=>l,default:()=>c,frontMatter:()=>o,metadata:()=>s,toc:()=>u});var n=r(87462),a=(r(67294),r(3905));const o={},l="opsrule",s={unversionedId:"reference/modules/catalog-models/trait/opsrule",id:"version-v0.10/reference/modules/catalog-models/trait/opsrule",title:"opsrule",description:"Schema OpsRule",source:"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/trait/opsrule.md",sourceDirName:"6-reference/2-modules/1-catalog-models/trait",slug:"/reference/modules/catalog-models/trait/opsrule",permalink:"/docs/v0.10/reference/modules/catalog-models/trait/opsrule",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/trait/opsrule.md",tags:[],version:"v0.10",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"prometheus",permalink:"/docs/v0.10/reference/modules/catalog-models/monitoring/prometheus"},next:{title:"job",permalink:"/docs/v0.10/reference/modules/catalog-models/workload/job"}},i={},u=[{value:"Schema OpsRule",id:"schema-opsrule",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3}],p={toc:u};function c(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"opsrule"},"opsrule"),(0,a.kt)("h2",{id:"schema-opsrule"},"Schema OpsRule"),(0,a.kt)("p",null,"OpsRule describes operation rules for various Day-2 Operations. Once declared, these",(0,a.kt)("br",null),"operation rules will be checked before any Day-2 operations."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"Name and Description"),(0,a.kt)("th",{parentName:"tr",align:null},"Type"),(0,a.kt)("th",{parentName:"tr",align:null},"Default Value"),(0,a.kt)("th",{parentName:"tr",align:null},"Required"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"maxUnavailable"),(0,a.kt)("br",null),"The maximum percentage of the total pod instances in the component that can be",(0,a.kt)("br",null),"simultaneously unhealthy."),(0,a.kt)("td",{parentName:"tr",align:null},"int ","|"," str"),(0,a.kt)("td",{parentName:"tr",align:null},'"25%"'),(0,a.kt)("td",{parentName:"tr",align:null},"optional")))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import catalog.models.schema.v1.trait as t\n\nopsRule : t.OpsRule {\n maxUnavailable: "30%"\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/fb634d25.27100a36.js b/assets/js/fb634d25.27100a36.js deleted file mode 100644 index 1bf7767a401..00000000000 --- a/assets/js/fb634d25.27100a36.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3934],{3905:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>u});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},m=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),d=p(n),u=a,k=d["".concat(s,".").concat(u)]||d[u]||c[u]||l;return n?r.createElement(k,i(i({ref:t},m),{},{components:n})):r.createElement(k,i({ref:t},m))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,i=new Array(l);i[0]=d;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o.mdxType="string"==typeof e?e:a,i[1]=o;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>c,frontMatter:()=>l,metadata:()=>o,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const l={},i="container",o={unversionedId:"reference/modules/developer-schemas/internal/container/container",id:"version-v0.11/reference/modules/developer-schemas/internal/container/container",title:"container",description:"Schema Container",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/internal/container/container.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/internal/container",slug:"/reference/modules/developer-schemas/internal/container/",permalink:"/docs/reference/modules/developer-schemas/internal/container/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/internal/container/container.md",tags:[],version:"v0.11",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"common",permalink:"/docs/reference/modules/developer-schemas/internal/common"},next:{title:"lifecycle",permalink:"/docs/reference/modules/developer-schemas/internal/container/lifecycle/"}},s={},p=[{value:"Schema Container",id:"schema-container",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Schema FileSpec",id:"schema-filespec",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3}],m={toc:p};function c(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"container"},"container"),(0,a.kt)("h2",{id:"schema-container"},"Schema Container"),(0,a.kt)("p",null,"Container describes how the Application's tasks are expected to be run. Depending on",(0,a.kt)("br",null),"the replicas parameter 1 or more containers can be created from each template."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"args")),(0,a.kt)("td",{parentName:"tr",align:null},"[str]"),(0,a.kt)("td",{parentName:"tr",align:null},"Arguments to the entrypoint.",(0,a.kt)("br",null),"Args will overwrite the CMD value set in the Dockfile, otherwise the Docker",(0,a.kt)("br",null),"image's CMD is used if this is not provided."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"command")),(0,a.kt)("td",{parentName:"tr",align:null},"[str]"),(0,a.kt)("td",{parentName:"tr",align:null},"Entrypoint array. Not executed within a shell.",(0,a.kt)("br",null),"Command will overwrite the ENTRYPOINT value set in the Dockfile, otherwise the Docker",(0,a.kt)("br",null),"image's ENTRYPOINT is used if this is not provided."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"dirs")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Collection of volumes mount into the container's filesystem.",(0,a.kt)("br",null),"The dirs parameter is a dict with the key being the folder name in the container and the value",(0,a.kt)("br",null),"being the referenced volume."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"env")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"List of environment variables to set in the container.",(0,a.kt)("br",null),"The value of the environment variable may be static text or a value from a secret."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"files")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:",(0,a.kt)("a",{parentName:"td",href:"#filespec"},"FileSpec"),"}"),(0,a.kt)("td",{parentName:"tr",align:null},"List of files to create in the container.",(0,a.kt)("br",null),"The files parameter is a dict with the key being the file name in the container and the value",(0,a.kt)("br",null),"being the target file specification."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"image")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Image refers to the Docker image name to run for this container.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/images"},"https://kubernetes.io/docs/concepts/containers/images")),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"lifecycle")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/container/lifecycle/#schema-lifecycle"},"lc.Lifecycle")),(0,a.kt)("td",{parentName:"tr",align:null},"Lifecycle refers to actions that the management system should take in response to container lifecycle events."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"livenessProbe")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,a.kt)("td",{parentName:"tr",align:null},"LivenessProbe indicates if a running process is healthy.",(0,a.kt)("br",null),"Container will be restarted if the probe fails."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"readinessProbe")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,a.kt)("td",{parentName:"tr",align:null},"ReadinessProbe indicates whether an application is available to handle requests."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"resources")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Map of resource requirements the container should run with.",(0,a.kt)("br",null),"The resources parameter is a dict with the key being the resource name and the value being",(0,a.kt)("br",null),"the resource value."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"startupProbe")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,a.kt)("td",{parentName:"tr",align:null},"StartupProbe indicates that the container has started for the first time.",(0,a.kt)("br",null),"Container will be restarted if the probe fails."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"workingDir")),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"The working directory of the running process defined in entrypoint.",(0,a.kt)("br",null),"Default container runtime will be used if this is not specified."),(0,a.kt)("td",{parentName:"tr",align:null})))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container as c\n\nweb = c.Container {\n image: "nginx:latest"\n command: ["/bin/sh", "-c", "echo hi"]\n env: {\n "name": "value"\n }\n resources: {\n "cpu": "2"\n "memory": "4Gi"\n }\n}\n')),(0,a.kt)("h2",{id:"schema-filespec"},"Schema FileSpec"),(0,a.kt)("p",null,"FileSpec defines the target file in a Container."),(0,a.kt)("h3",{id:"attributes-1"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"content")),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"File content in plain text."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"contentFrom")),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Source for the file content, reference to a secret of configmap value."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"mode")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Mode bits used to set permissions on this file, must be an octal value",(0,a.kt)("br",null),"between 0000 and 0777 or a decimal value between 0 and 511"),(0,a.kt)("td",{parentName:"tr",align:null},'"0644"')))),(0,a.kt)("h3",{id:"examples-1"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container as c\n\ntmpFile = c.FileSpec {\n content: "some file contents"\n mode: "0777"\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/fb634d25.bd5a7df9.js b/assets/js/fb634d25.bd5a7df9.js new file mode 100644 index 00000000000..634e1bb65ad --- /dev/null +++ b/assets/js/fb634d25.bd5a7df9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3934],{3905:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>u});var r=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},m=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,s=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),d=p(n),u=a,k=d["".concat(s,".").concat(u)]||d[u]||c[u]||l;return n?r.createElement(k,i(i({ref:t},m),{},{components:n})):r.createElement(k,i({ref:t},m))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,i=new Array(l);i[0]=d;var o={};for(var s in t)hasOwnProperty.call(t,s)&&(o[s]=t[s]);o.originalType=e,o.mdxType="string"==typeof e?e:a,i[1]=o;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>c,frontMatter:()=>l,metadata:()=>o,toc:()=>p});var r=n(87462),a=(n(67294),n(3905));const l={},i="container",o={unversionedId:"reference/modules/developer-schemas/internal/container/container",id:"version-v0.11/reference/modules/developer-schemas/internal/container/container",title:"container",description:"Schema Container",source:"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/internal/container/container.md",sourceDirName:"6-reference/2-modules/1-developer-schemas/internal/container",slug:"/reference/modules/developer-schemas/internal/container/",permalink:"/docs/reference/modules/developer-schemas/internal/container/",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/internal/container/container.md",tags:[],version:"v0.11",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"common",permalink:"/docs/reference/modules/developer-schemas/internal/common"},next:{title:"lifecycle",permalink:"/docs/reference/modules/developer-schemas/internal/container/lifecycle/"}},s={},p=[{value:"Schema Container",id:"schema-container",level:2},{value:"Attributes",id:"attributes",level:3},{value:"Examples",id:"examples",level:3},{value:"Schema FileSpec",id:"schema-filespec",level:2},{value:"Attributes",id:"attributes-1",level:3},{value:"Examples",id:"examples-1",level:3}],m={toc:p};function c(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"container"},"container"),(0,a.kt)("h2",{id:"schema-container"},"Schema Container"),(0,a.kt)("p",null,"Container describes how the Application's tasks are expected to be run. Depending on",(0,a.kt)("br",null),"the replicas parameter 1 or more containers can be created from each template."),(0,a.kt)("h3",{id:"attributes"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"args")),(0,a.kt)("td",{parentName:"tr",align:null},"[str]"),(0,a.kt)("td",{parentName:"tr",align:null},"Arguments to the entrypoint.",(0,a.kt)("br",null),"Args will overwrite the CMD value set in the Dockfile, otherwise the Docker",(0,a.kt)("br",null),"image's CMD is used if this is not provided."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"command")),(0,a.kt)("td",{parentName:"tr",align:null},"[str]"),(0,a.kt)("td",{parentName:"tr",align:null},"Entrypoint array. Not executed within a shell.",(0,a.kt)("br",null),"Command will overwrite the ENTRYPOINT value set in the Dockfile, otherwise the Docker",(0,a.kt)("br",null),"image's ENTRYPOINT is used if this is not provided."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"dirs")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Collection of volumes mount into the container's filesystem.",(0,a.kt)("br",null),"The dirs parameter is a dict with the key being the folder name in the container and the value",(0,a.kt)("br",null),"being the referenced volume."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"env")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"List of environment variables to set in the container.",(0,a.kt)("br",null),"The value of the environment variable may be static text or a value from a secret."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"files")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:",(0,a.kt)("a",{parentName:"td",href:"#filespec"},"FileSpec"),"}"),(0,a.kt)("td",{parentName:"tr",align:null},"List of files to create in the container.",(0,a.kt)("br",null),"The files parameter is a dict with the key being the file name in the container and the value",(0,a.kt)("br",null),"being the target file specification."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"image")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Image refers to the Docker image name to run for this container.",(0,a.kt)("br",null),"More info: ",(0,a.kt)("a",{parentName:"td",href:"https://kubernetes.io/docs/concepts/containers/images"},"https://kubernetes.io/docs/concepts/containers/images")),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"lifecycle")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/container/lifecycle/#schema-lifecycle"},"lc.Lifecycle")),(0,a.kt)("td",{parentName:"tr",align:null},"Lifecycle refers to actions that the management system should take in response to container lifecycle events."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"livenessProbe")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,a.kt)("td",{parentName:"tr",align:null},"LivenessProbe indicates if a running process is healthy.",(0,a.kt)("br",null),"Container will be restarted if the probe fails."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"readinessProbe")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,a.kt)("td",{parentName:"tr",align:null},"ReadinessProbe indicates whether an application is available to handle requests."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"resources")),(0,a.kt)("td",{parentName:"tr",align:null},"{str:str}"),(0,a.kt)("td",{parentName:"tr",align:null},"Map of resource requirements the container should run with.",(0,a.kt)("br",null),"The resources parameter is a dict with the key being the resource name and the value being",(0,a.kt)("br",null),"the resource value."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"startupProbe")),(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("a",{parentName:"td",href:"/docs/reference/modules/developer-schemas/internal/container/probe/#schema-probe"},"p.Probe")),(0,a.kt)("td",{parentName:"tr",align:null},"StartupProbe indicates that the container has started for the first time.",(0,a.kt)("br",null),"Container will be restarted if the probe fails."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"workingDir")),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"The working directory of the running process defined in entrypoint.",(0,a.kt)("br",null),"Default container runtime will be used if this is not specified."),(0,a.kt)("td",{parentName:"tr",align:null})))),(0,a.kt)("h3",{id:"examples"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container as c\n\nweb = c.Container {\n image: "nginx:latest"\n command: ["/bin/sh", "-c", "echo hi"]\n env: {\n "name": "value"\n }\n resources: {\n "cpu": "2"\n "memory": "4Gi"\n }\n}\n')),(0,a.kt)("h2",{id:"schema-filespec"},"Schema FileSpec"),(0,a.kt)("p",null,"FileSpec defines the target file in a Container."),(0,a.kt)("h3",{id:"attributes-1"},"Attributes"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:null},"name"),(0,a.kt)("th",{parentName:"tr",align:null},"type"),(0,a.kt)("th",{parentName:"tr",align:null},"description"),(0,a.kt)("th",{parentName:"tr",align:null},"default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"content")),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"File content in plain text."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"contentFrom")),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Source for the file content, reference to a secret of configmap value."),(0,a.kt)("td",{parentName:"tr",align:null})),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:null},(0,a.kt)("strong",{parentName:"td"},"mode")," ",(0,a.kt)("inlineCode",{parentName:"td"},"required")),(0,a.kt)("td",{parentName:"tr",align:null},"str"),(0,a.kt)("td",{parentName:"tr",align:null},"Mode bits used to set permissions on this file, must be an octal value",(0,a.kt)("br",null),"between 0000 and 0777 or a decimal value between 0 and 511"),(0,a.kt)("td",{parentName:"tr",align:null},'"0644"')))),(0,a.kt)("h3",{id:"examples-1"},"Examples"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-python"},'import kam.workload.container as c\n\ntmpFile = c.FileSpec {\n content: "some file contents"\n mode: "0777"\n}\n')))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/fd1fdd14.b6d76bd7.js b/assets/js/fd1fdd14.b6d76bd7.js deleted file mode 100644 index e1f205dc1f0..00000000000 --- a/assets/js/fd1fdd14.b6d76bd7.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3438],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>k});var n=a(67294);function o(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function r(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(o[a]=e[a]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(o[a]=e[a])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var a=e.components,o=e.mdxType,r=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=p(a),k=o,h=u["".concat(l,".").concat(k)]||u[k]||d[k]||r;return a?n.createElement(h,i(i({ref:t},c),{},{components:a})):n.createElement(h,i({ref:t},c))}));function k(e,t){var a=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=a.length,i=new Array(r);i[0]=u;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var p=2;p{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>r,metadata:()=>s,toc:()=>p});var n=a(87462),o=(a(67294),a(3905));const r={id:"workspace",sidebar_label:"Workspace"},i="Workspace",s={unversionedId:"concepts/workspace",id:"concepts/workspace",title:"Workspace",description:"Workspace is a logical concept that maps to an actual target environment to deploy a stack to. In today's context, this usually represents a Kubernetes cluster for the application workload and an optional cloud account to provision infrastructure resources that the workload depends on (A database, for example). Aside from the deployment destination, workspaces are also designed to be associated with a series of platform configurations that are used by all the stacks deployed to said workspace.",source:"@site/docs/kusion/3-concepts/4-workspace.md",sourceDirName:"3-concepts",slug:"/concepts/workspace",permalink:"/docs/next/concepts/workspace",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/3-concepts/4-workspace.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:4,frontMatter:{id:"workspace",sidebar_label:"Workspace"},sidebar:"kusion",previous:{title:"Application Developer User Guide",permalink:"/docs/next/concepts/kusion-module/app-dev-guide"},next:{title:"AppConfiguration",permalink:"/docs/next/concepts/app-configuration"}},l={},p=[{value:"Workspace Configuration",id:"workspace-configuration",level:2},{value:"modules",id:"modules",level:3},{value:"runtimes",id:"runtimes",level:3},{value:"Managing Workspace",id:"managing-workspace",level:2},{value:"Creating Workspace",id:"creating-workspace",level:3},{value:"Listing Workspace",id:"listing-workspace",level:3},{value:"Switching Workspace",id:"switching-workspace",level:3},{value:"Showing Workspace",id:"showing-workspace",level:3},{value:"Updating Workspace",id:"updating-workspace",level:3},{value:"Deleting Workspace",id:"deleting-workspace",level:3},{value:"Using Workspace",id:"using-workspace",level:2}],c={toc:p};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"workspace"},"Workspace"),(0,o.kt)("p",null,"Workspace is a logical concept that maps to an actual target environment to deploy a stack to. In today's context, this ",(0,o.kt)("em",{parentName:"p"},"usually")," represents a Kubernetes cluster for the application workload and an optional cloud account to provision infrastructure resources that the workload depends on (A database, for example). Aside from the deployment destination, workspaces are also designed to be associated with a series of platform configurations that are used by all the stacks deployed to said workspace."),(0,o.kt)("p",null,"When executing the command ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion generate"),', Kusion will "match" the AppConfiguration and the approriate workspace configuration to dynamically generate the ',(0,o.kt)("inlineCode",{parentName:"p"},"Spec"),", which contains the complete manifest to describe the resources in the stack. The relationship of the Project, Stack and Workspace is shown as below. Notice that all three ways to organize stacks are valid."),(0,o.kt)("p",null,(0,o.kt)("img",{alt:"project-stack-workspace",src:a(3682).Z,width:"1572",height:"1006"})),(0,o.kt)("p",null,'Workspace is designed to address separation of concerns. As opposed to the development-time concept of a "stack", a workspace is a deploy-time concept that represents a deployment target, a.k.a an actual runtime environment. Workspaces should be entirely managed by Platform Engineers to alleviate the burden on developers to understand environment-specific details.'),(0,o.kt)("p",null,"To dig a little deeper, a workspace represents the need for a distinct set of \"platform opinions\". That includes things that application developer either don't want to or shouldn't need to worry about, such as which Kubernetes cluster to deploy to, the credentials to deploy to said clusters, and other infrastructure details like what database instance to provision."),(0,o.kt)("p",null,"Workspace is intended to be flexible so you can map them as your see fit to the boundaries that are relevant to your use case. For example, you can map a workspace to a cloud region (aws-us-east-1), provided that regional isolation is sufficient for you (this is an extreme case). Alternatively, a workspace can be map to the combination of a cloud region and an SDLC phase (aws-dev-us-east-1), provided that it represents the right boundary from a platform perspective."),(0,o.kt)("p",null,"The workspace configuration is in a deterministic format and currently written in YAML. The subcommands of ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace")," are provided to manage the workspaces. When using ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace"),", the workspace configuration will be saved as YAML file in local file system. To avoid the possible risks, the environment variables are provided to hold the sensitive data such as Access Keys and Secret keys."),(0,o.kt)("h2",{id:"workspace-configuration"},"Workspace Configuration"),(0,o.kt)("p",null,"The configuration of a Workspace is stored in a single YAML file, which consists of ",(0,o.kt)("inlineCode",{parentName:"p"},"modules")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"runtimes"),". An example of Workspace configuration is shown as below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-yaml"},"# The platform configuration for Modules or KAMs.\n# For each Module or KAM, the configuration format is as below. \n# # ${module_identifier} or ${KAM_name}:\n# # default: # default configuration, applied to all projects\n# # ${field1}: ${value1}\n# # #{field2}: ${value2}\n# # ...\n# # ${patcher_name}: #patcher configuration, applied to the projects assigned in projectSelector\n# # ${field1}: ${value1_override}\n# # ...\n# # projectSelector:\n# # - ${project1_name}\n# # - ${project2_name}\n# # ...\nmodules:\n kusionstack/mysql@0.1.0:\n default:\n cloud: alicloud\n size: 20\n instanceType: mysql.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: ${mysql_subnet_id}\n databaseName: kusion\n largeSize:\n size: 50\n projectSelector:\n - foo\n - bar\n \n# The configuration of Runtimes, support Kubernetes and Terraform.\n# For each Runtime, the configuration format is as below.\n# # ${runtime_name}:\n# # ${field1}: ${value1}\n# # ${field2}: ${value2}\n# # ...\nruntimes:\n kubernetes:\n kubeConfig: /etc/kubeconfig.yaml\n terraform:\n aws:\n version: 1.0.4\n source: hashicorp/aws\n region: us-east-1\n")),(0,o.kt)("h3",{id:"modules"},"modules"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"modules")," are the platform-part configurations of Modules and KAMs, where the identifier of them are ",(0,o.kt)("inlineCode",{parentName:"p"},"${namespace}/${module_name}@${module_tag}")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"${kam_name}"),". For each Module or KAM configuration, it is composed of a ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," and several ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher")," blocks. The ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," block contains the universal configuration of the Workspace, and can be applied to all Stacks in the Workspace, which is composed of the values of the Module's or KAM's fields. The ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher")," block contains the exclusive configuration for certain Stacks, which includes not only the fields' values, but also the applied Projects."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher")," block is designed to increase the flexibility for platform engineers managing Workspaces. Cause the Workspace should map to the real physical environment, in the actual production practice, it's almost impossible that all the Stacks share the same platform configuration, although we want them the same. "),(0,o.kt)("p",null,"The values of the same fields in ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher")," will override the ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", and one field in multiple patchers is forbidden to assign to the same Project. That is, if there are more than one ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher")," declaring the same field with different values, the applied Projects are prohibited to overlap. And, The name of ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher")," must not be ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),"."),(0,o.kt)("p",null,"In the ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher"),", the applied Projects are assigned by the field ",(0,o.kt)("inlineCode",{parentName:"p"},"ProjectSelector"),", which is an array of the Project names. The ",(0,o.kt)("inlineCode",{parentName:"p"},"ProjectSelector")," is provided rather than something may like ",(0,o.kt)("inlineCode",{parentName:"p"},"StackSelector"),', which specifies the applied Stacks. Here are the reasons. Explaining from the perspective of using Workspace, the mapping of Workspace and Stack is specified by the Kusion operation commands\' users. While explaining from the perspective of the relationship among Project, Stack and Workspace, Workspace is designed for the reuse of platform-level configuration among multiple Projects. When a Project "encounters" a Workspace, it becomes a "Stack instance", which can be applied to a series of real resources. If using something like ',(0,o.kt)("inlineCode",{parentName:"p"},"StackSelector"),", the reuse would not get realized, and Workspace would also lose its relevance. For more information of the relationship, please refer to ",(0,o.kt)("a",{parentName:"p",href:"project/overview"},"Project")," and ",(0,o.kt)("a",{parentName:"p",href:"stack/overview"},"Stack"),". "),(0,o.kt)("p",null,"Different Module and KAM has different name, fields, and corresponding format and restrictions. When writing the configuration, check the corresponding Module's or KAM's description, and make sure all the requisite Modules and KAMs have correctly configured. Please refer to ",(0,o.kt)("a",{parentName:"p",href:"kusion-module/overview"},"Kuiosn Module")," and find more information. The example above gives a sample of the Module ",(0,o.kt)("inlineCode",{parentName:"p"},"mysql"),"."),(0,o.kt)("h3",{id:"runtimes"},"runtimes"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"runtimes")," are the interface that Kusion interacts with the real infrastructure, which are only configured by the platform engineers in Workspace. Kusion supports the runtimes ",(0,o.kt)("inlineCode",{parentName:"p"},"Kubernetes")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Terraform")," for now."),(0,o.kt)("p",null,"For ",(0,o.kt)("inlineCode",{parentName:"p"},"Kubernetes")," runtime, the path of the KubeConfig file is provided to configure, which is specified by the filed ",(0,o.kt)("inlineCode",{parentName:"p"},"kubeConfig"),". Besides, the environment variable ",(0,o.kt)("inlineCode",{parentName:"p"},"KUBECONFIG")," is also supported with higher priority. If both not set, the default path ",(0,o.kt)("inlineCode",{parentName:"p"},"$HOME/.kube/config")," will be used. For the example above, the ",(0,o.kt)("inlineCode",{parentName:"p"},"kubeConfig")," is set in the workspace configuration."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"Terraform")," runtime is composed of multiple Terraform providers' configurations, where the key is the provider name, and the values varies across different providers. For the configuration fields, Kusion keeps the same with Terraform, including the supported environment variables. Please refer to ",(0,o.kt)("a",{parentName:"p",href:"https://registry.terraform.io/"},"Terraform Registry")," and find more information. For the example above, a sample of aws runtime configuration is given, while the ",(0,o.kt)("inlineCode",{parentName:"p"},"access_key")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"access_secret")," is not set in the Workspace file, and expected setting by the environment variables ",(0,o.kt)("inlineCode",{parentName:"p"},"AWS_ACCESS_KEY_ID")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"AWS_SECRET_ACCESS_KEY"),"."),(0,o.kt)("h2",{id:"managing-workspace"},"Managing Workspace"),(0,o.kt)("p",null,"The subcommands of ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace")," are used to manage Workspaces, including ",(0,o.kt)("inlineCode",{parentName:"p"},"create"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"show"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"list"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"switch"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"update")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"delete"),". Cause the Workspace configurations are stored persistently, the current or a specified Backend will be used. For more information of Backend, please refer to ",(0,o.kt)("a",{parentName:"p",href:"backend"},"Backend"),"."),(0,o.kt)("p",null,"Kusion will create a ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," Workspace with empty configuration in every Backend automatically, and set it as the current. When first using Kusion, or no configuration of Workspace, the ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," Workspace will be used. "),(0,o.kt)("h3",{id:"creating-workspace"},"Creating Workspace"),(0,o.kt)("p",null,"Use ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace create ${name} -f ${configuration_file_path}")," to create a new Workspace with the configuration in a YAML file. The Workspace is identified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"name"),", and must be a new one, while the configuration must be written in a YAML file with correct format. "),(0,o.kt)("p",null,"The command above will create the Workspace in current Backend. If to create a Workspace in another backend, please use flag ",(0,o.kt)("inlineCode",{parentName:"p"},"--backend")," to specify. The Workspace names in a Backend must be different, but allow the same in different Backends."),(0,o.kt)("p",null,"In some scenarios, when a Workspace is created, it is expected to be the current. For simplification, the flag ",(0,o.kt)("inlineCode",{parentName:"p"},"--current")," is provided to set the Workspace current alongside the creation."),(0,o.kt)("p",null,"Be attention, creating ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," Workspace is not allowed, because it's created by Kusion automatically."),(0,o.kt)("p",null,"The example is shown as below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"# create a workspace in current backend\nkusion workspace create dev -f dev.yaml\n\n# create a workspace in current backend ans set it as current\nkusion workspace create dev -f dev.yaml --current\n\n# create a workspace in specified backend\nkusion workspace create dev -f dev.yaml --backend oss-pre\n")),(0,o.kt)("p",null,"The Workspaces to create are decided by the platform engineers. We recommend that they are organized by the following rules:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"SDLC phases"),", such as ",(0,o.kt)("inlineCode",{parentName:"li"},"dev"),", ",(0,o.kt)("inlineCode",{parentName:"li"},"pre"),", ",(0,o.kt)("inlineCode",{parentName:"li"},"prod"),";"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"cloud vendors"),", such as ",(0,o.kt)("inlineCode",{parentName:"li"},"aws"),", ",(0,o.kt)("inlineCode",{parentName:"li"},"alicloud"),";"),(0,o.kt)("li",{parentName:"ul"},"combination of the two above, such as ",(0,o.kt)("inlineCode",{parentName:"li"},"dev-aws"),", ",(0,o.kt)("inlineCode",{parentName:"li"},"prod-alicloud"),".")),(0,o.kt)("p",null,"In design, Kusion does not support deploying Stack to multiple clouds or regions within a single Workspace. While users can technically define a Module that provisions resources across multiple clouds or regions, Kusion does not recommend this practice, and will not provide technical support for such configuration. If the platform engineers need to manage resources across multiple clouds or regions, they should create separate Workspaces."),(0,o.kt)("h3",{id:"listing-workspace"},"Listing Workspace"),(0,o.kt)("p",null,"Use ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace list")," to get all the workspace names."),(0,o.kt)("p",null,"The example is shown as below. In order to simplify, The following examples will not give using specified backend, which is supported by ",(0,o.kt)("inlineCode",{parentName:"p"},"--backend")," flag."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"# list all the workspace names\nkusion workspace list\n")),(0,o.kt)("h3",{id:"switching-workspace"},"Switching Workspace"),(0,o.kt)("p",null,"In order not to specify the Workspace name for each Kusion operation command, ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace switch ${name}")," is provided to switch the current Workspace. Then when executing ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion generate"),", the current Workspace will be used. The to-switch Workspace must be created."),(0,o.kt)("p",null,"The example is shown as below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"# switch workspace\nkusion workspace switch dev\n")),(0,o.kt)("h3",{id:"showing-workspace"},"Showing Workspace"),(0,o.kt)("p",null,"Use ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace show ${name}")," to get the Workspace configuration. If the ",(0,o.kt)("inlineCode",{parentName:"p"},"name")," is not specified, the configuration of current Workspace will get returned."),(0,o.kt)("p",null,"The example is shown as below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"# show a specified workspace configuration\nkusion workspace show dev\n\n# show the current workspace configuration\nkusion workspace show\n")),(0,o.kt)("h3",{id:"updating-workspace"},"Updating Workspace"),(0,o.kt)("p",null,"When the Workspace needs to update, use ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace update ${name} -f ${configuration_file_path}")," to update with the new configuration file. The whole updated configuration is asked to provide, and the Workspace must be created. Get the Workspace configuration first, then refresh the configuration and execute the command, which are the recommended steps. If the ",(0,o.kt)("inlineCode",{parentName:"p"},"name")," is not specified, the current Workspace will be used."),(0,o.kt)("p",null,"Updating the ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," Workspace is allowed. And the flag ",(0,o.kt)("inlineCode",{parentName:"p"},"--current")," is also supported to set it as the current."),(0,o.kt)("p",null,"The example is shown as below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"# update a specified workspace\nkusion workspace update dev -f dev_new.yaml\n\n# update a specified workspace and set it as current\nkusion workspace update dev -f dev_new.yaml --current\n\n# update the current workspace\nkusion workspace update -f dev_new.yaml\n")),(0,o.kt)("h3",{id:"deleting-workspace"},"Deleting Workspace"),(0,o.kt)("p",null,"When a Workspace is not in use anymore, use ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace delete ${name}")," to delete a Workspace. If the ",(0,o.kt)("inlineCode",{parentName:"p"},"name")," is not specified, the current Workspace will get deleted, and the ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," Workspace will be set as the current Workspace. Therefore, deleting the ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," Workspace is not allowed. "),(0,o.kt)("p",null,"The example is shown as below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"# delete a specified workspace\nkusion workspace delete dev \n\n# delete the current workspace\nkusion workspace delete\n")),(0,o.kt)("h2",{id:"using-workspace"},"Using Workspace"),(0,o.kt)("p",null,"Workspace is used in the command ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion generate"),", the following steps help smooth the operation process."),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"Write the Workspace configuration file with the format shown above, and fulfill all the necessary fields;"),(0,o.kt)("li",{parentName:"ol"},"Create the workspace with ",(0,o.kt)("inlineCode",{parentName:"li"},"kusion workspace create"),", then Kusion perceives the Workspace. The flag ",(0,o.kt)("inlineCode",{parentName:"li"},"--current")," can be used to set it as the current."),(0,o.kt)("li",{parentName:"ol"},"Execute ",(0,o.kt)("inlineCode",{parentName:"li"},"kusion generate")," in a Stack to generate the whole Spec, the AppConfiguration and Workspace configuration get rendered automatically, and can be applied to the real infrastructure. If the appointed Workspace or Backend is asked, the flags ",(0,o.kt)("inlineCode",{parentName:"li"},"--workspace")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"--backend")," will help achieve that. "),(0,o.kt)("li",{parentName:"ol"},"If the Workspace needs to update, delete, switch, etc. Use the above commands to achieve that.")))}d.isMDXComponent=!0},3682:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/project-stack-workspace-565b997b82d65f1f62a943184916c510.png"}}]); \ No newline at end of file diff --git a/assets/js/fd1fdd14.f3f7fdc6.js b/assets/js/fd1fdd14.f3f7fdc6.js new file mode 100644 index 00000000000..b0ad70dd7f6 --- /dev/null +++ b/assets/js/fd1fdd14.f3f7fdc6.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3438],{3905:(e,t,a)=>{a.d(t,{Zo:()=>c,kt:()=>k});var n=a(67294);function o(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function r(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(o[a]=e[a]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(o[a]=e[a])}return o}var l=n.createContext({}),p=function(e){var t=n.useContext(l),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},c=function(e){var t=p(e.components);return n.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var a=e.components,o=e.mdxType,r=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=p(a),k=o,h=u["".concat(l,".").concat(k)]||u[k]||d[k]||r;return a?n.createElement(h,i(i({ref:t},c),{},{components:a})):n.createElement(h,i({ref:t},c))}));function k(e,t){var a=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=a.length,i=new Array(r);i[0]=u;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var p=2;p{a.r(t),a.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>r,metadata:()=>s,toc:()=>p});var n=a(87462),o=(a(67294),a(3905));const r={id:"workspace",sidebar_label:"Workspace"},i="Workspace",s={unversionedId:"concepts/workspace",id:"concepts/workspace",title:"Workspace",description:"Workspace is a logical concept that maps to an actual target environment to deploy a stack to. In today's context, this usually represents a Kubernetes cluster for the application workload and an optional cloud account to provision infrastructure resources that the workload depends on (A database, for example). Aside from the deployment destination, workspaces are also designed to be associated with a series of platform configurations that are used by all the stacks deployed to said workspace.",source:"@site/docs/kusion/3-concepts/4-workspace.md",sourceDirName:"3-concepts",slug:"/concepts/workspace",permalink:"/docs/next/concepts/workspace",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/3-concepts/4-workspace.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:4,frontMatter:{id:"workspace",sidebar_label:"Workspace"},sidebar:"kusion",previous:{title:"Application Developer User Guide",permalink:"/docs/next/concepts/kusion-module/app-dev-guide"},next:{title:"AppConfiguration",permalink:"/docs/next/concepts/app-configuration"}},l={},p=[{value:"Workspace Configuration",id:"workspace-configuration",level:2},{value:"modules",id:"modules",level:3},{value:"runtimes",id:"runtimes",level:3},{value:"Managing Workspace",id:"managing-workspace",level:2},{value:"Creating Workspace",id:"creating-workspace",level:3},{value:"Listing Workspace",id:"listing-workspace",level:3},{value:"Switching Workspace",id:"switching-workspace",level:3},{value:"Showing Workspace",id:"showing-workspace",level:3},{value:"Updating Workspace",id:"updating-workspace",level:3},{value:"Deleting Workspace",id:"deleting-workspace",level:3},{value:"Using Workspace",id:"using-workspace",level:2}],c={toc:p};function d(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"workspace"},"Workspace"),(0,o.kt)("p",null,"Workspace is a logical concept that maps to an actual target environment to deploy a stack to. In today's context, this ",(0,o.kt)("em",{parentName:"p"},"usually")," represents a Kubernetes cluster for the application workload and an optional cloud account to provision infrastructure resources that the workload depends on (A database, for example). Aside from the deployment destination, workspaces are also designed to be associated with a series of platform configurations that are used by all the stacks deployed to said workspace."),(0,o.kt)("p",null,"When executing the command ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion generate"),', Kusion will "match" the AppConfiguration and the approriate workspace configuration to dynamically generate the ',(0,o.kt)("inlineCode",{parentName:"p"},"Spec"),", which contains the complete manifest to describe the resources in the stack. The relationship of the Project, Stack and Workspace is shown as below. Notice that all three ways to organize stacks are valid."),(0,o.kt)("p",null,(0,o.kt)("img",{alt:"project-stack-workspace",src:a(3682).Z,width:"1572",height:"1006"})),(0,o.kt)("p",null,'Workspace is designed to address separation of concerns. As opposed to the development-time concept of a "stack", a workspace is a deploy-time concept that represents a deployment target, a.k.a an actual runtime environment. Workspaces should be entirely managed by Platform Engineers to alleviate the burden on developers to understand environment-specific details.'),(0,o.kt)("p",null,"To dig a little deeper, a workspace represents the need for a distinct set of \"platform opinions\". That includes things that application developer either don't want to or shouldn't need to worry about, such as which Kubernetes cluster to deploy to, the credentials to deploy to said clusters, and other infrastructure details like what database instance to provision."),(0,o.kt)("p",null,"Workspace is intended to be flexible so you can map them as your see fit to the boundaries that are relevant to your use case. For example, you can map a workspace to a cloud region (aws-us-east-1), provided that regional isolation is sufficient for you (this is an extreme case). Alternatively, a workspace can be map to the combination of a cloud region and an SDLC phase (aws-dev-us-east-1), provided that it represents the right boundary from a platform perspective."),(0,o.kt)("p",null,"The workspace configuration is in a deterministic format and currently written in YAML. The subcommands of ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace")," are provided to manage the workspaces. When using ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace"),", the workspace configuration will be saved as YAML file in local file system. To avoid the possible risks, the environment variables are provided to hold the sensitive data such as Access Keys and Secret keys."),(0,o.kt)("h2",{id:"workspace-configuration"},"Workspace Configuration"),(0,o.kt)("p",null,"The configuration of a Workspace is stored in a single YAML file, which consists of ",(0,o.kt)("inlineCode",{parentName:"p"},"modules")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"runtimes"),". An example of Workspace configuration is shown as below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-yaml"},"# The platform configuration for Modules or KAMs.\n# For each Module or KAM, the configuration format is as below. \n# # ${module_identifier} or ${KAM_name}:\n# # default: # default configuration, applied to all projects\n# # ${field1}: ${value1}\n# # #{field2}: ${value2}\n# # ...\n# # ${patcher_name}: #patcher configuration, applied to the projects assigned in projectSelector\n# # ${field1}: ${value1_override}\n# # ...\n# # projectSelector:\n# # - ${project1_name}\n# # - ${project2_name}\n# # ...\nmodules:\n kusionstack/mysql@0.1.0:\n default:\n cloud: alicloud\n size: 20\n instanceType: mysql.n2.serverless.1c\n category: serverless_basic\n privateRouting: false\n subnetID: ${mysql_subnet_id}\n databaseName: kusion\n largeSize:\n size: 50\n projectSelector:\n - foo\n - bar\n \n# The configuration of Runtimes, support Kubernetes and Terraform.\n# For each Runtime, the configuration format is as below.\n# # ${runtime_name}:\n# # ${field1}: ${value1}\n# # ${field2}: ${value2}\n# # ...\nruntimes:\n kubernetes:\n kubeConfig: /etc/kubeconfig.yaml\n terraform:\n aws:\n version: 1.0.4\n source: hashicorp/aws\n region: us-east-1\n")),(0,o.kt)("h3",{id:"modules"},"modules"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"modules")," are the platform-part configurations of Modules and KAMs, where the identifier of them are ",(0,o.kt)("inlineCode",{parentName:"p"},"${namespace}/${module_name}@${module_tag}")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"${kam_name}"),". For each Module or KAM configuration, it is composed of a ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," and several ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher")," blocks. The ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," block contains the universal configuration of the Workspace, and can be applied to all Stacks in the Workspace, which is composed of the values of the Module's or KAM's fields. The ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher")," block contains the exclusive configuration for certain Stacks, which includes not only the fields' values, but also the applied Projects."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher")," block is designed to increase the flexibility for platform engineers managing Workspaces. Cause the Workspace should map to the real physical environment, in the actual production practice, it's almost impossible that all the Stacks share the same platform configuration, although we want them the same. "),(0,o.kt)("p",null,"The values of the same fields in ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher")," will override the ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),", and one field in multiple patchers is forbidden to assign to the same Project. That is, if there are more than one ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher")," declaring the same field with different values, the applied Projects are prohibited to overlap. And, The name of ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher")," must not be ",(0,o.kt)("inlineCode",{parentName:"p"},"default"),"."),(0,o.kt)("p",null,"In the ",(0,o.kt)("inlineCode",{parentName:"p"},"patcher"),", the applied Projects are assigned by the field ",(0,o.kt)("inlineCode",{parentName:"p"},"ProjectSelector"),", which is an array of the Project names. The ",(0,o.kt)("inlineCode",{parentName:"p"},"ProjectSelector")," is provided rather than something may like ",(0,o.kt)("inlineCode",{parentName:"p"},"StackSelector"),', which specifies the applied Stacks. Here are the reasons. Explaining from the perspective of using Workspace, the mapping of Workspace and Stack is specified by the Kusion operation commands\' users. While explaining from the perspective of the relationship among Project, Stack and Workspace, Workspace is designed for the reuse of platform-level configuration among multiple Projects. When a Project "encounters" a Workspace, it becomes a "Stack instance", which can be applied to a series of real resources. If using something like ',(0,o.kt)("inlineCode",{parentName:"p"},"StackSelector"),", the reuse would not get realized, and Workspace would also lose its relevance. For more information of the relationship, please refer to ",(0,o.kt)("a",{parentName:"p",href:"project/overview"},"Project")," and ",(0,o.kt)("a",{parentName:"p",href:"stack/overview"},"Stack"),". "),(0,o.kt)("p",null,"Different Module and KAM has different name, fields, and corresponding format and restrictions. When writing the configuration, check the corresponding Module's or KAM's description, and make sure all the requisite Modules and KAMs have correctly configured. Please refer to ",(0,o.kt)("a",{parentName:"p",href:"kusion-module/overview"},"Kuiosn Module")," and find more information. The example above gives a sample of the Module ",(0,o.kt)("inlineCode",{parentName:"p"},"mysql"),"."),(0,o.kt)("h3",{id:"runtimes"},"runtimes"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"runtimes")," are the interface that Kusion interacts with the real infrastructure, which are only configured by the platform engineers in Workspace. Kusion supports the runtimes ",(0,o.kt)("inlineCode",{parentName:"p"},"Kubernetes")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"Terraform")," for now."),(0,o.kt)("p",null,"For ",(0,o.kt)("inlineCode",{parentName:"p"},"Kubernetes")," runtime, the path of the KubeConfig file is provided to configure, which is specified by the filed ",(0,o.kt)("inlineCode",{parentName:"p"},"kubeConfig"),". Besides, the environment variable ",(0,o.kt)("inlineCode",{parentName:"p"},"KUBECONFIG")," is also supported with higher priority. If both not set, the default path ",(0,o.kt)("inlineCode",{parentName:"p"},"$HOME/.kube/config")," will be used. For the example above, the ",(0,o.kt)("inlineCode",{parentName:"p"},"kubeConfig")," is set in the workspace configuration."),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"Terraform")," runtime is composed of multiple Terraform providers' configurations, where the key is the provider name, and the values varies across different providers. For the configuration fields, Kusion keeps the same with Terraform, including the supported environment variables. Please refer to ",(0,o.kt)("a",{parentName:"p",href:"https://registry.terraform.io/"},"Terraform Registry")," and find more information. For the example above, a sample of aws runtime configuration is given, while the ",(0,o.kt)("inlineCode",{parentName:"p"},"access_key")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"access_secret")," is not set in the Workspace file, and expected setting by the environment variables ",(0,o.kt)("inlineCode",{parentName:"p"},"AWS_ACCESS_KEY_ID")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"AWS_SECRET_ACCESS_KEY"),"."),(0,o.kt)("h2",{id:"managing-workspace"},"Managing Workspace"),(0,o.kt)("p",null,"The subcommands of ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace")," are used to manage Workspaces, including ",(0,o.kt)("inlineCode",{parentName:"p"},"create"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"show"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"list"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"switch"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"update")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"delete"),". Cause the Workspace configurations are stored persistently, the current or a specified Backend will be used. For more information of Backend, please refer to ",(0,o.kt)("a",{parentName:"p",href:"backend"},"Backend"),"."),(0,o.kt)("p",null,"Kusion will create a ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," Workspace with empty configuration in every Backend automatically, and set it as the current. When first using Kusion, or no configuration of Workspace, the ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," Workspace will be used. "),(0,o.kt)("h3",{id:"creating-workspace"},"Creating Workspace"),(0,o.kt)("p",null,"Use ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace create ${name} -f ${configuration_file_path}")," to create a new Workspace with the configuration in a YAML file. The Workspace is identified by the ",(0,o.kt)("inlineCode",{parentName:"p"},"name"),", and must be a new one, while the configuration must be written in a YAML file with correct format. "),(0,o.kt)("p",null,"The command above will create the Workspace in current Backend. If to create a Workspace in another backend, please use flag ",(0,o.kt)("inlineCode",{parentName:"p"},"--backend")," to specify. The Workspace names in a Backend must be different, but allow the same in different Backends."),(0,o.kt)("p",null,"In some scenarios, when a Workspace is created, it is expected to be the current. For simplification, the flag ",(0,o.kt)("inlineCode",{parentName:"p"},"--current")," is provided to set the Workspace current alongside the creation."),(0,o.kt)("p",null,"Be attention, creating ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," Workspace is not allowed, because it's created by Kusion automatically."),(0,o.kt)("p",null,"The example is shown as below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"# create a workspace in current backend\nkusion workspace create dev -f dev.yaml\n\n# create a workspace in current backend ans set it as current\nkusion workspace create dev -f dev.yaml --current\n\n# create a workspace in specified backend\nkusion workspace create dev -f dev.yaml --backend oss-pre\n")),(0,o.kt)("p",null,"The Workspaces to create are decided by the platform engineers. We recommend that they are organized by the following rules:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"SDLC phases"),", such as ",(0,o.kt)("inlineCode",{parentName:"li"},"dev"),", ",(0,o.kt)("inlineCode",{parentName:"li"},"pre"),", ",(0,o.kt)("inlineCode",{parentName:"li"},"prod"),";"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("strong",{parentName:"li"},"cloud vendors"),", such as ",(0,o.kt)("inlineCode",{parentName:"li"},"aws"),", ",(0,o.kt)("inlineCode",{parentName:"li"},"alicloud"),";"),(0,o.kt)("li",{parentName:"ul"},"combination of the two above, such as ",(0,o.kt)("inlineCode",{parentName:"li"},"dev-aws"),", ",(0,o.kt)("inlineCode",{parentName:"li"},"prod-alicloud"),".")),(0,o.kt)("p",null,"In design, Kusion does not support deploying Stack to multiple clouds or regions within a single Workspace. While users can technically define a Module that provisions resources across multiple clouds or regions, Kusion does not recommend this practice, and will not provide technical support for such configuration. If the platform engineers need to manage resources across multiple clouds or regions, they should create separate Workspaces."),(0,o.kt)("h3",{id:"listing-workspace"},"Listing Workspace"),(0,o.kt)("p",null,"Use ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace list")," to get all the workspace names."),(0,o.kt)("p",null,"The example is shown as below. In order to simplify, The following examples will not give using specified backend, which is supported by ",(0,o.kt)("inlineCode",{parentName:"p"},"--backend")," flag."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"# list all the workspace names\nkusion workspace list\n")),(0,o.kt)("h3",{id:"switching-workspace"},"Switching Workspace"),(0,o.kt)("p",null,"In order not to specify the Workspace name for each Kusion operation command, ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace switch ${name}")," is provided to switch the current Workspace. Then when executing ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion generate"),", the current Workspace will be used. The to-switch Workspace must be created."),(0,o.kt)("p",null,"The example is shown as below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"# switch workspace\nkusion workspace switch dev\n")),(0,o.kt)("h3",{id:"showing-workspace"},"Showing Workspace"),(0,o.kt)("p",null,"Use ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace show ${name}")," to get the Workspace configuration. If the ",(0,o.kt)("inlineCode",{parentName:"p"},"name")," is not specified, the configuration of current Workspace will get returned."),(0,o.kt)("p",null,"The example is shown as below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"# show a specified workspace configuration\nkusion workspace show dev\n\n# show the current workspace configuration\nkusion workspace show\n")),(0,o.kt)("h3",{id:"updating-workspace"},"Updating Workspace"),(0,o.kt)("p",null,"When the Workspace needs to update, use ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace update ${name} -f ${configuration_file_path}")," to update with the new configuration file. The whole updated configuration is asked to provide, and the Workspace must be created. Get the Workspace configuration first, then refresh the configuration and execute the command, which are the recommended steps. If the ",(0,o.kt)("inlineCode",{parentName:"p"},"name")," is not specified, the current Workspace will be used."),(0,o.kt)("p",null,"Updating the ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," Workspace is allowed. And the flag ",(0,o.kt)("inlineCode",{parentName:"p"},"--current")," is also supported to set it as the current."),(0,o.kt)("p",null,"The example is shown as below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"# update a specified workspace\nkusion workspace update dev -f dev_new.yaml\n\n# update a specified workspace and set it as current\nkusion workspace update dev -f dev_new.yaml --current\n\n# update the current workspace\nkusion workspace update -f dev_new.yaml\n")),(0,o.kt)("h3",{id:"deleting-workspace"},"Deleting Workspace"),(0,o.kt)("p",null,"When a Workspace is not in use anymore, use ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion workspace delete ${name}")," to delete a Workspace. If the ",(0,o.kt)("inlineCode",{parentName:"p"},"name")," is not specified, the current Workspace will get deleted, and the ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," Workspace will be set as the current Workspace. Therefore, deleting the ",(0,o.kt)("inlineCode",{parentName:"p"},"default")," Workspace is not allowed. "),(0,o.kt)("p",null,"The example is shown as below."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-shell"},"# delete a specified workspace\nkusion workspace delete dev \n\n# delete the current workspace\nkusion workspace delete\n")),(0,o.kt)("h2",{id:"using-workspace"},"Using Workspace"),(0,o.kt)("p",null,"Workspace is used in the command ",(0,o.kt)("inlineCode",{parentName:"p"},"kusion generate"),", the following steps help smooth the operation process."),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"Write the Workspace configuration file with the format shown above, and fulfill all the necessary fields;"),(0,o.kt)("li",{parentName:"ol"},"Create the workspace with ",(0,o.kt)("inlineCode",{parentName:"li"},"kusion workspace create"),", then Kusion perceives the Workspace. The flag ",(0,o.kt)("inlineCode",{parentName:"li"},"--current")," can be used to set it as the current."),(0,o.kt)("li",{parentName:"ol"},"Execute ",(0,o.kt)("inlineCode",{parentName:"li"},"kusion generate")," in a Stack to generate the whole Spec, the AppConfiguration and Workspace configuration get rendered automatically, and can be applied to the real infrastructure. If the appointed Workspace or Backend is asked, the flags ",(0,o.kt)("inlineCode",{parentName:"li"},"--workspace")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"--backend")," will help achieve that. "),(0,o.kt)("li",{parentName:"ol"},"If the Workspace needs to update, delete, switch, etc. Use the above commands to achieve that.")))}d.isMDXComponent=!0},3682:(e,t,a)=>{a.d(t,{Z:()=>n});const n=a.p+"assets/images/project-stack-workspace-565b997b82d65f1f62a943184916c510.png"}}]); \ No newline at end of file diff --git a/assets/js/fd8fca12.d31b2cf4.js b/assets/js/fd8fca12.a37baf25.js similarity index 50% rename from assets/js/fd8fca12.d31b2cf4.js rename to assets/js/fd8fca12.a37baf25.js index fc371606420..d019a703f74 100644 --- a/assets/js/fd8fca12.d31b2cf4.js +++ b/assets/js/fd8fca12.a37baf25.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6383],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=l(n),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||a;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function m(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={},i="kusion stack",s={unversionedId:"reference/commands/kusion-stack",id:"reference/commands/kusion-stack",title:"kusion stack",description:"Stack is a folder that contains a stack.yaml file within the corresponding project directory",source:"@site/docs/kusion/6-reference/1-commands/kusion-stack.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-stack",permalink:"/docs/next/reference/commands/kusion-stack",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-stack.md",tags:[],version:"current",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion stack create",permalink:"/docs/next/reference/commands/kusion-stack-create"},next:{title:"kusion version",permalink:"/docs/next/reference/commands/kusion-version"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-stack"},"kusion stack"),(0,o.kt)("p",null,"Stack is a folder that contains a stack.yaml file within the corresponding project directory"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Stack in Kusion is defined as any folder that contains a stack.yaml file within the corresponding project directory."),(0,o.kt)("p",null," A stack provides a mechanism to isolate multiple deployments of the same application, serving with the target workspace to which an application will be deployed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion stack [flags]\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for stack\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-stack-create"},"kusion stack create"),"\t - Create a new stack")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[6383],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>f});var r=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var c=r.createContext({}),l=function(e){var t=r.useContext(c),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=l(e.components);return r.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=l(n),f=o,m=d["".concat(c,".").concat(f)]||d[f]||u[f]||a;return n?r.createElement(m,i(i({ref:t},p),{},{components:n})):r.createElement(m,i({ref:t},p))}));function f(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,i=new Array(a);i[0]=d;var s={};for(var c in t)hasOwnProperty.call(t,c)&&(s[c]=t[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var l=2;l{n.r(t),n.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>l});var r=n(87462),o=(n(67294),n(3905));const a={},i="kusion stack",s={unversionedId:"reference/commands/kusion-stack",id:"reference/commands/kusion-stack",title:"kusion stack",description:"Stack is a folder that contains a stack.yaml file within the corresponding project directory",source:"@site/docs/kusion/6-reference/1-commands/kusion-stack.md",sourceDirName:"6-reference/1-commands",slug:"/reference/commands/kusion-stack",permalink:"/docs/next/reference/commands/kusion-stack",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs/kusion/6-reference/1-commands/kusion-stack.md",tags:[],version:"current",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",frontMatter:{},sidebar:"kusion",previous:{title:"kusion stack create",permalink:"/docs/next/reference/commands/kusion-stack-create"},next:{title:"kusion version",permalink:"/docs/next/reference/commands/kusion-version"}},c={},l=[{value:"Synopsis",id:"synopsis",level:3},{value:"Options",id:"options",level:3},{value:"Options inherited from parent commands",id:"options-inherited-from-parent-commands",level:3},{value:"SEE ALSO",id:"see-also",level:3},{value:"Auto generated by spf13/cobra on 29-Apr-2024",id:"auto-generated-by-spf13cobra-on-29-apr-2024",level:6}],p={toc:l};function u(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"kusion-stack"},"kusion stack"),(0,o.kt)("p",null,"Stack is a folder that contains a stack.yaml file within the corresponding project directory"),(0,o.kt)("h3",{id:"synopsis"},"Synopsis"),(0,o.kt)("p",null,"Stack in Kusion is defined as any folder that contains a stack.yaml file within the corresponding project directory."),(0,o.kt)("p",null," A stack provides a mechanism to isolate multiple deployments of the same application, serving with the target workspace to which an application will be deployed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"kusion stack [flags]\n")),(0,o.kt)("h3",{id:"options"},"Options"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"}," -h, --help help for stack\n")),(0,o.kt)("h3",{id:"options-inherited-from-parent-commands"},"Options inherited from parent commands"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},' --profile string Name of profile to capture. One of (none|cpu|heap|goroutine|threadcreate|block|mutex) (default "none")\n --profile-output string Name of the file to write the profile to (default "profile.pprof")\n')),(0,o.kt)("h3",{id:"see-also"},"SEE ALSO"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/"},"kusion"),"\t - Kusion is the Platform Orchestrator of Internal Developer Platform"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/next/reference/commands/kusion-stack-create"},"kusion stack create"),"\t - Create a new stack")),(0,o.kt)("h6",{id:"auto-generated-by-spf13cobra-on-29-apr-2024"},"Auto generated by spf13/cobra on 29-Apr-2024"))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ff1602b7.3e795999.js b/assets/js/ff1602b7.3e795999.js new file mode 100644 index 00000000000..299f8de9484 --- /dev/null +++ b/assets/js/ff1602b7.3e795999.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5458],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=s(n),m=r,f=d["".concat(p,".").concat(m)]||d[m]||c[m]||o;return n?a.createElement(f,i(i({ref:t},u),{},{components:n})):a.createElement(f,i({ref:t},u))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>c,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:9},i="Operational Rules",l={unversionedId:"config-walkthrough/operational_rules",id:"version-v0.9/config-walkthrough/operational_rules",title:"Operational Rules",description:"The opsRule attribute in the AppConfiguration instance is used to describe the specification for the collection of operational rule requirements for the application. Operational rules are used as a preemptive measure to police and stop any unwanted changes.",source:"@site/docs_versioned_docs/version-v0.9/config-walkthrough/operational_rules.md",sourceDirName:"config-walkthrough",slug:"/config-walkthrough/operational_rules",permalink:"/docs/v0.9/config-walkthrough/operational_rules",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/config-walkthrough/operational_rules.md",tags:[],version:"v0.9",lastUpdatedBy:"Dayuan",lastUpdatedAt:1714463068,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:9,frontMatter:{sidebar_position:9},sidebar:"kusion",previous:{title:"Application Monitoring",permalink:"/docs/v0.9/config-walkthrough/monitoring"},next:{title:"User Guide",permalink:"/docs/v0.9/guides/"}},p={},s=[{value:"Import",id:"import",level:2},{value:"Max Unavailable Replicas",id:"max-unavailable-replicas",level:2}],u={toc:s};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"operational-rules"},"Operational Rules"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"opsRule")," attribute in the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance is used to describe the specification for the collection of operational rule requirements for the application. Operational rules are used as a preemptive measure to police and stop any unwanted changes."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"The ",(0,r.kt)("inlineCode",{parentName:"p"},"opsRules")," attribute requires the target cluster to have installed the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/operating"},"KusionStack-operating")," controllers properly.")),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"catalog")," package. For more details on KCL package import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"../config-walkthrough/overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport models.schema.v1.trait as t\n")),(0,r.kt)("h2",{id:"max-unavailable-replicas"},"Max Unavailable Replicas"),(0,r.kt)("p",null,"Currently, ",(0,r.kt)("inlineCode",{parentName:"p"},"OpsRule")," supports setting a ",(0,r.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," parameter, which specifies the maximum number of pods that can be rendered unavailable at any time. It can be either a fraction of the total pods for the current application or a fixed number. This operational rule is particularly helpful against unexpected changes or deletes to the workloads. It can also prevents too many workloads from going down during an application upgrade."),(0,r.kt)("p",null,"More rules will be available in future versions of Kusion."),(0,r.kt)("p",null,"To set ",(0,r.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," to a percentage of pods:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n # ...\n }\n }\n opsRule: t.OpsRule {\n maxUnavailable: "30%"\n }\n}\n')),(0,r.kt)("p",null,"To set ",(0,r.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," to a fixed number of pods:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n opsRule: t.OpsRule {\n maxUnavailable: 2\n }\n}\n")))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ff1602b7.e9c1b048.js b/assets/js/ff1602b7.e9c1b048.js deleted file mode 100644 index e170eb00c3c..00000000000 --- a/assets/js/ff1602b7.e9c1b048.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[5458],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var a=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),s=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=s(e.components);return a.createElement(p.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,p=e.parentName,u=l(e,["components","mdxType","originalType","parentName"]),d=s(n),m=r,f=d["".concat(p,".").concat(m)]||d[m]||c[m]||o;return n?a.createElement(f,i(i({ref:t},u),{},{components:n})):a.createElement(f,i({ref:t},u))}));function m(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=d;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>c,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var a=n(87462),r=(n(67294),n(3905));const o={sidebar_position:9},i="Operational Rules",l={unversionedId:"config-walkthrough/operational_rules",id:"version-v0.9/config-walkthrough/operational_rules",title:"Operational Rules",description:"The opsRule attribute in the AppConfiguration instance is used to describe the specification for the collection of operational rule requirements for the application. Operational rules are used as a preemptive measure to police and stop any unwanted changes.",source:"@site/docs_versioned_docs/version-v0.9/config-walkthrough/operational_rules.md",sourceDirName:"config-walkthrough",slug:"/config-walkthrough/operational_rules",permalink:"/docs/v0.9/config-walkthrough/operational_rules",draft:!1,editUrl:"https://github.com/KusionStack/kusionstack.io/blob/main/docs_versioned_docs/version-v0.9/config-walkthrough/operational_rules.md",tags:[],version:"v0.9",lastUpdatedBy:"liu-hm19",lastUpdatedAt:1714463011,formattedLastUpdatedAt:"Apr 30, 2024",sidebarPosition:9,frontMatter:{sidebar_position:9},sidebar:"kusion",previous:{title:"Application Monitoring",permalink:"/docs/v0.9/config-walkthrough/monitoring"},next:{title:"User Guide",permalink:"/docs/v0.9/guides/"}},p={},s=[{value:"Import",id:"import",level:2},{value:"Max Unavailable Replicas",id:"max-unavailable-replicas",level:2}],u={toc:s};function c(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"operational-rules"},"Operational Rules"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"opsRule")," attribute in the ",(0,r.kt)("inlineCode",{parentName:"p"},"AppConfiguration")," instance is used to describe the specification for the collection of operational rule requirements for the application. Operational rules are used as a preemptive measure to police and stop any unwanted changes."),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"The ",(0,r.kt)("inlineCode",{parentName:"p"},"opsRules")," attribute requires the target cluster to have installed the ",(0,r.kt)("a",{parentName:"p",href:"https://github.com/KusionStack/operating"},"KusionStack-operating")," controllers properly.")),(0,r.kt)("h2",{id:"import"},"Import"),(0,r.kt)("p",null,"In the examples below, we are using schemas defined in the ",(0,r.kt)("inlineCode",{parentName:"p"},"catalog")," package. For more details on KCL package import, please refer to the ",(0,r.kt)("a",{parentName:"p",href:"../config-walkthrough/overview"},"Configuration File Overview"),"."),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"import")," statements needed for the following walkthrough:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"import catalog.models.schema.v1 as ac\nimport catalog.models.schema.v1.workload as wl\nimport models.schema.v1.trait as t\n")),(0,r.kt)("h2",{id:"max-unavailable-replicas"},"Max Unavailable Replicas"),(0,r.kt)("p",null,"Currently, ",(0,r.kt)("inlineCode",{parentName:"p"},"OpsRule")," supports setting a ",(0,r.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," parameter, which specifies the maximum number of pods that can be rendered unavailable at any time. It can be either a fraction of the total pods for the current application or a fixed number. This operational rule is particularly helpful against unexpected changes or deletes to the workloads. It can also prevents too many workloads from going down during an application upgrade."),(0,r.kt)("p",null,"More rules will be available in future versions of Kusion."),(0,r.kt)("p",null,"To set ",(0,r.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," to a percentage of pods:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},'myapp: ac.AppConfiguration {\n workload: wl.Service {\n containers: {\n # ...\n }\n }\n opsRule: t.OpsRule {\n maxUnavailable: "30%"\n }\n}\n')),(0,r.kt)("p",null,"To set ",(0,r.kt)("inlineCode",{parentName:"p"},"maxUnavailable")," to a fixed number of pods:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"myapp: ac.AppConfiguration {\n workload: wl.Service {\n # ...\n }\n opsRule: t.OpsRule {\n maxUnavailable: 2\n }\n}\n")))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/main.5fb7170a.js b/assets/js/main.195c2ab4.js similarity index 99% rename from assets/js/main.5fb7170a.js rename to assets/js/main.195c2ab4.js index 96a0b885c9a..a06f0409c3c 100644 --- a/assets/js/main.5fb7170a.js +++ b/assets/js/main.195c2ab4.js @@ -1,2 +1,2 @@ -/*! For license information please see main.5fb7170a.js.LICENSE.txt */ -(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[179],{20830:(e,n,t)=>{"use strict";t.d(n,{W:()=>r});var o=t(67294);function r(){return o.createElement("svg",{width:"20",height:"20",className:"DocSearch-Search-Icon",viewBox:"0 0 20 20"},o.createElement("path",{d:"M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z",stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"}))}},38726:(e,n,t)=>{"use strict";function o(e,n){e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.__proto__=n}function r(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function s(){return s=Object.assign||function(e){for(var n=1;n{"use strict";t.d(n,{Z:()=>f});var o=t(67294),r=t(87462),a=t(38726),s=t.n(a),i=t(16887);const c={"00ba420c":[()=>t.e(2170).then(t.t.bind(t,31911,19)),"~blog/default/blog-tags-kusion-page-4-da4-list.json",31911],"01439c8e":[()=>t.e(6504).then(t.bind(t,96344)),"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/index.md",96344],"01a85c17":[()=>Promise.all([t.e(532),t.e(4013)]).then(t.bind(t,91223)),"@theme/BlogTagsListPage",91223],"030b8d03":[()=>t.e(5822).then(t.bind(t,58742)),"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/7-secret.md",58742],"03253e12":[()=>t.e(2623).then(t.bind(t,97402)),"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/3-naming-conventions.md",97402],"0400c277":[()=>t.e(1372).then(t.bind(t,70209)),"@site/docs_versioned_docs/version-v0.10/3-concepts/1-project/1-overview.md",70209],"043680c6":[()=>t.e(1753).then(t.bind(t,50404)),"@site/docs/kusion/4-configuration-walkthrough/7-secret.md",50404],"045fa4ba":[()=>t.e(5517).then(t.bind(t,50800)),"@site/docs_versioned_docs/version-v0.10/3-concepts/4-workspace.md",50800],"051b6848":[()=>t.e(1160).then(t.t.bind(t,32936,19)),"~blog/default/blog-tags-kusion-stack-1cb-list.json",32936],"05e2121e":[()=>t.e(1750).then(t.bind(t,56245)),"@site/docs/kusion/6-reference/1-commands/kusion-version.md",56245],"064aa373":[()=>t.e(4867).then(t.bind(t,13e3)),"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/app-configuration.md",13e3],"082d3c28":[()=>t.e(8245).then(t.bind(t,65992)),"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/workload/service.md",65992],"091a426a":[()=>Promise.all([t.e(532),t.e(3334)]).then(t.bind(t,45413)),"@site/docs/kusion/5-user-guides/1-cloud-resources/1-database.md",45413],"0a185701":[()=>t.e(535).then(t.bind(t,32937)),"@site/docs/kusion/3-concepts/7-backend.md",32937],"0a57f7df":[()=>t.e(1369).then(t.bind(t,61155)),"@site/docs_versioned_docs/version-v0.11/3-concepts/3-kusion-module/3-app-dev-guide.md",61155],"0a8d339f":[()=>t.e(5163).then(t.bind(t,4861)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-list.md",4861],"0a99afe0":[()=>t.e(2261).then(t.bind(t,98373)),"@site/docs_versioned_docs/version-v0.9/support/install-error.md",98373],"0b387740":[()=>t.e(8467).then(t.t.bind(t,69676,19)),"~docs/docs/version-current-metadata-prop-751.json",69676],"0b498124":[()=>t.e(8922).then(t.t.bind(t,99874,19)),"~docs/operating/version-v-0-3-metadata-prop-a0d.json",99874],"0b745da3":[()=>t.e(5498).then(t.bind(t,82429)),"@site/docs/kusion/4-configuration-walkthrough/9-operational-rules.md",82429],"0d383345":[()=>Promise.all([t.e(532),t.e(1678)]).then(t.bind(t,17173)),"@site/docs_versioned_docs/version-v0.10/5-user-guides/1-cloud-resources/1-database.md",17173],"0d662946":[()=>t.e(9435).then(t.bind(t,72111)),"@site/docs/kusion/3-concepts/3-kusion-module/3-app-dev-guide.md",72111],"0ed14211":[()=>t.e(53).then(t.bind(t,54571)),"@site/docs_versioned_docs/version-v0.10/5-user-guides/3-observability/1-prometheus.md",54571],"0feba5eb":[()=>t.e(927).then(t.bind(t,63550)),"@site/docs_versioned_docs/version-v0.9/guides/github-actions/deploy-application-securely-and-efficiently-via-github-actions.md",63550],"104b2cd6":[()=>t.e(2673).then(t.bind(t,34735)),"@site/blog/2021-05-18-kusion-intro/index.md?truncated=true",34735],10669232:[()=>t.e(2301).then(t.bind(t,48522)),"@site/docs/kusion/3-concepts/3-kusion-module/2-develop-guide.md",48522],"11ce4159":[()=>t.e(1531).then(t.t.bind(t,75034,19)),"~blog/default/blog-page-5-c6b.json",75034],12216004:[()=>t.e(6524).then(t.bind(t,62297)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-version.md",62297],"13e25c40":[()=>t.e(2306).then(t.bind(t,49442)),"@site/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_build.md",49442],"145f4e6a":[()=>t.e(7665).then(t.bind(t,92013)),"@site/blog/2022-12-12-post-cloud-native-era-operation/index.md",92013],"163cf949":[()=>t.e(6534).then(t.bind(t,70220)),"@site/docs_versioned_docs/version-v0.9/guides/working-with-k8s/4-image-upgrade.md",70220],"16a19535":[()=>t.e(9906).then(t.bind(t,86297)),"@site/docs_versioned_docs/version-v0.10/3-concepts/5-appconfiguration.md",86297],"16bff117":[()=>t.e(4300).then(t.bind(t,52735)),"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/internal/secret/secret.md",52735],"17658ce1":[()=>t.e(1209).then(t.bind(t,49599)),"@site/docs_versioned_docs/version-v0.9/guides/working-with-k8s/index.md",49599],17896441:[()=>Promise.all([t.e(532),t.e(8718),t.e(7918)]).then(t.bind(t,74458)),"@theme/DocItem",74458],"17a1e8ae":[()=>t.e(8071).then(t.bind(t,57979)),"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace-list.md",57979],"180ff8b9":[()=>t.e(7057).then(t.bind(t,48894)),"@site/docs/kusion/6-reference/1-commands/kusion-config-set.md",48894],"18d9b529":[()=>t.e(2218).then(t.bind(t,5422)),"@site/docs/kusion/5-user-guides/4-secrets-management/1-using-cloud-secrets.md",5422],"18fa340a":[()=>Promise.all([t.e(532),t.e(440)]).then(t.bind(t,59118)),"@site/docs_versioned_docs/version-v0.11/5-user-guides/1-cloud-resources/1-database.md",59118],"194f885d":[()=>t.e(9315).then(t.bind(t,94749)),"@site/docs_versioned_docs/version-v0.9/config-walkthrough/workload.md",94749],"19556a9e":[()=>t.e(5870).then(t.bind(t,97085)),"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/database/postgres.md",97085],"1961a063":[()=>t.e(8025).then(t.bind(t,73161)),"@site/docs/kusion/4-configuration-walkthrough/4-workload.md",73161],"1a4e3797":[()=>Promise.all([t.e(532),t.e(7920)]).then(t.bind(t,39172)),"@theme/SearchPage",39172],"1aa0cc2e":[()=>t.e(38).then(t.bind(t,37242)),"@site/docs/kusion/5-user-guides/2-working-with-k8s/1-deploy-application.md",37242],"1b95d76e":[()=>t.e(7651).then(t.bind(t,54427)),"@site/docs_versioned_docs/version-v0.9/reference/model/project-stack-config-items.md",54427],"1b9ff86e":[()=>t.e(340).then(t.bind(t,13152)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/index.md",13152],"1bd21934":[()=>t.e(2530).then(t.bind(t,2450)),"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/network/doc_port.md",2450],"1be78505":[()=>Promise.all([t.e(532),t.e(9514)]).then(t.bind(t,19963)),"@theme/DocPage",19963],"1ec179f1":[()=>t.e(6814).then(t.bind(t,42756)),"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-apply.md",42756],"1efb9d39":[()=>t.e(3046).then(t.bind(t,6729)),"@site/docs_versioned_docs/version-v0.10/6-reference/3-roadmap.md",6729],"1f391b9e":[()=>Promise.all([t.e(532),t.e(8718),t.e(3085)]).then(t.bind(t,14247)),"@theme/MDXPage",14247],"1f997fd4":[()=>t.e(7717).then(t.bind(t,46161)),"@site/docs_versioned_docs/version-v0.9/reference/cli/kusion/index.md",46161],"1fe4756a":[()=>t.e(4147).then(t.bind(t,90600)),"@site/docs_versioned_docs/version-v0.11/3-concepts/2-stack/1-overview.md",90600],"20db72b2":[()=>t.e(8037).then(t.bind(t,13322)),"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/doc_common.md",13322],"2115f1af":[()=>t.e(8989).then(t.bind(t,93390)),"@site/docs/kusion/6-reference/1-commands/kusion-workspace-update.md",93390],21746641:[()=>t.e(3571).then(t.bind(t,90372)),"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/4-workload.md",90372],"21778a34":[()=>t.e(7921).then(t.bind(t,65197)),"@site/docs_versioned_docs/version-v0.9/guides/working-with-k8s/2-container.md",65197],"2326e64e":[()=>t.e(9556).then(t.bind(t,18816)),"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/monitoring/prometheus.md",18816],"235dd62f":[()=>t.e(362).then(t.t.bind(t,22042,19)),"~blog/default/blog-tags-kclvm-31a.json",22042],"24657d42":[()=>t.e(8018).then(t.bind(t,9557)),"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/3-base-override.md",9557],"252357e3":[()=>t.e(6349).then(t.bind(t,60418)),"@site/docs_versioned_docs/version-v0.11/7-faq/2-kcl.md",60418],"26acf368":[()=>t.e(7858).then(t.t.bind(t,65052,19)),"~blog/default/blog-tags-large-scale-0df.json",65052],"27e25305":[()=>t.e(7234).then(t.bind(t,36133)),"@site/docs_versioned_docs/version-v0.9/guides/working-with-k8s/1-deploy-application.md",36133],"28530a7a":[()=>t.e(1222).then(t.bind(t,30733)),"@site/docs/kusion/6-reference/1-commands/kusion-options.md",30733],"2871ff48":[()=>t.e(5004).then(t.bind(t,8190)),"@site/docs_versioned_docs/version-v0.10/3-concepts/2-stack/2-configuration.md",8190],"2879b44b":[()=>t.e(5783).then(t.bind(t,62545)),"@site/ctrlmesh_versioned_docs/version-v0.1/started/install.md",62545],"2a719713":[()=>t.e(8468).then(t.bind(t,61510)),"@site/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/1-deploy-application.md",61510],"2b0acc78":[()=>t.e(5102).then(t.bind(t,51274)),"@site/docs_versioned_docs/version-v0.9/intro/kusion-vs-x.md",51274],"2be338c6":[()=>t.e(7412).then(t.bind(t,38942)),"@site/docs_versioned_docs/version-v0.11/3-concepts/5-appconfiguration.md",38942],"2bf7c981":[()=>t.e(6646).then(t.bind(t,57851)),"@site/docs/kusion/6-reference/1-commands/kusion-generate.md",57851],"2e408e18":[()=>t.e(5681).then(t.bind(t,97120)),"@site/docs_versioned_docs/version-v0.9/reference/cli/backend/backend-configuration.md",97120],"2e7a9059":[()=>t.e(271).then(t.bind(t,81210)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-stack.md",81210],"2e999f74":[()=>t.e(9470).then(t.bind(t,11676)),"@site/docs/ctrlmesh/started/try.md",11676],"2ed6f3e5":[()=>t.e(3350).then(t.bind(t,64235)),"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-compile.md",64235],"2fec9cb7":[()=>t.e(6138).then(t.bind(t,42080)),"@site/docs_versioned_docs/version-v0.11/2-getting-started/2-deliver-quickstart.md",42080],"306a8c6c":[()=>t.e(7616).then(t.t.bind(t,59479,19)),"~docs/community/version-current-metadata-prop-751.json",59479],"30ab2121":[()=>t.e(9376).then(t.bind(t,31193)),"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/opsrule/opsrule.md",31193],"312696f8":[()=>t.e(3546).then(t.bind(t,583)),"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/networking/port.md",583],"32773aa2":[()=>t.e(8665).then(t.bind(t,48073)),"@site/docs/kusion/6-reference/1-commands/kusion-config-list.md",48073],"32956a74":[()=>t.e(2842).then(t.bind(t,55054)),"@site/docs/kusion/6-reference/2-modules/2-workspace-configs/database/mysql.md",55054],"33052e91":[()=>t.e(8901).then(t.bind(t,10547)),"@site/blog/2023-05-26-qcon-guangzhou/index.md",10547],"33b38546":[()=>t.e(6286).then(t.bind(t,21953)),"@site/docs_versioned_docs/version-v0.9/intro/overview.md",21953],"35b126a7":[()=>t.e(1322).then(t.t.bind(t,41888,19)),"~blog/default/blog-tags-kusion-stack-page-4-3a4.json",41888],"35b54083":[()=>t.e(7860).then(t.bind(t,57653)),"@site/docs_versioned_docs/version-v0.9/guides/cloud-resources/expose-service.md",57653],"35ecf87f":[()=>t.e(6659).then(t.bind(t,39306)),"@site/ctrlmesh_versioned_docs/version-v0.1/faq/faq.md",39306],"3777d550":[()=>t.e(5420).then(t.bind(t,85605)),"@site/docs_versioned_docs/version-v0.10/3-concepts/7-backend-configuration.md",85605],"385397a2":[()=>t.e(995).then(t.bind(t,94529)),"@site/docs/kusion/6-reference/2-modules/2-workspace-configs/opsrule/opsrule.md",94529],"386fece6":[()=>t.e(5195).then(t.bind(t,53626)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-config-set.md",53626],38900147:[()=>t.e(5601).then(t.bind(t,19211)),"@site/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_preview.md",19211],"389ba035":[()=>t.e(7386).then(t.bind(t,1737)),"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/workload/service.md",1737],"393be207":[()=>t.e(7414).then(t.bind(t,53123)),"@site/src/pages/markdown-page.md",53123],"3ab8bb90":[()=>t.e(3257).then(t.bind(t,52946)),"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/network/network.md",52946],"3c3bc024":[()=>t.e(617).then(t.bind(t,30972)),"@site/docs/kusion/6-reference/2-modules/2-workspace-configs/workload/service.md",30972],"3de1edc5":[()=>t.e(3190).then(t.bind(t,22699)),"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/container/container.md",22699],"3de240dc":[()=>t.e(6791).then(t.bind(t,78148)),"@site/docs/ctrlmesh/intro/intro.md",78148],"3f78da0c":[()=>t.e(8356).then(t.bind(t,2206)),"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/database/postgres.md",2206],"3ff7cb20":[()=>t.e(3356).then(t.bind(t,26219)),"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/database/mysql.md",26219],"4032a3e5":[()=>t.e(9450).then(t.bind(t,73912)),"@site/docs/operating/started/install.md",73912],"40870e5b":[()=>t.e(4671).then(t.bind(t,5244)),"@site/docs_versioned_docs/version-v0.9/config-walkthrough/secret.md",5244],"426f7ee9":[()=>t.e(9175).then(t.bind(t,44401)),"@site/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/5-resource-spec.md",44401],"42dede29":[()=>t.e(8986).then(t.bind(t,82873)),"@site/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/7-job.md",82873],"434d80d9":[()=>t.e(1132).then(t.bind(t,13703)),"@site/docs/kusion/6-reference/1-commands/kusion-preview.md",13703],"43b9b491":[()=>t.e(9190).then(t.t.bind(t,39784,19)),"~blog/default/blog-tags-kusion-page-3-d9b-list.json",39784],"43d0ee92":[()=>t.e(5466).then(t.bind(t,9992)),"@site/blog/2021-05-18-kusion-intro/index.md",9992],"443d39de":[()=>t.e(4669).then(t.bind(t,76654)),"@site/operating_versioned_docs/version-v0.3/manuals/poddecoration.md",76654],"44691bc0":[()=>t.e(6166).then(t.bind(t,14)),"@site/ctrlmesh_versioned_docs/version-v0.1/started/try.md",14],"44a7a3de":[()=>Promise.all([t.e(532),t.e(5911)]).then(t.bind(t,58748)),"@site/docs/kusion/2-getting-started/1-install-kusion.md",58748],"44deffd7":[()=>t.e(6418).then(t.bind(t,34418)),"@site/blog/2022-05-28-open-day/index.md?truncated=true",34418],"44e1074c":[()=>t.e(8909).then(t.t.bind(t,15107,19)),"/home/runner/work/kusionstack.io/kusionstack.io/.docusaurus/docusaurus-plugin-content-docs/ctrlmesh/plugin-route-context-module-100.json",15107],"44ecec25":[()=>t.e(2508).then(t.bind(t,74503)),"@site/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/3-service.md",74503],"45584c0f":[()=>t.e(7147).then(t.t.bind(t,11027,19)),"~blog/default/blog-tags-kusion-stack-page-2-b1d-list.json",11027],"4559f654":[()=>t.e(6873).then(t.bind(t,42831)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-generate.md",42831],"462b352b":[()=>t.e(7240).then(t.bind(t,52204)),"@site/docs_versioned_docs/version-v0.9/config-walkthrough/overview.md",52204],"47943cb5":[()=>t.e(9029).then(t.bind(t,51729)),"@site/docs_versioned_docs/version-v0.11/3-concepts/7-backend.md",51729],"486b02f9":[()=>t.e(9003).then(t.bind(t,66461)),"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/workload/job.md",66461],"48c1907d":[()=>t.e(7179).then(t.bind(t,21083)),"@site/docs_versioned_docs/version-v0.9/reference/model/naming-conventions.md",21083],"4969cfcb":[()=>t.e(3753).then(t.bind(t,48480)),"@site/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_compile.md",48480],"4ab041ea":[()=>t.e(4364).then(t.bind(t,12375)),"@site/docs_versioned_docs/version-v0.9/reference/cli/index.md",12375],"4ac8e691":[()=>t.e(3677).then(t.bind(t,37093)),"@site/docs/ctrlmesh/started/install.md",37093],"4b36b697":[()=>t.e(1130).then(t.bind(t,65193)),"@site/docs/kusion/3-concepts/1-project/1-overview.md",65193],"4bcd6c5f":[()=>t.e(4634).then(t.bind(t,91624)),"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/opsrule/opsrule.md",91624],"4c24e21f":[()=>t.e(2434).then(t.bind(t,10720)),"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace.md",10720],"4c493feb":[()=>t.e(9666).then(t.bind(t,92415)),"@site/docs/kusion/5-user-guides/2-working-with-k8s/2-container.md",92415],"4e2c8581":[()=>t.e(4070).then(t.bind(t,61087)),"@site/docs_versioned_docs/version-v0.11/3-concepts/1-project/1-overview.md",61087],"4e363eb9":[()=>t.e(4588).then(t.bind(t,4992)),"@site/docs/kusion/6-reference/1-commands/kusion-workspace-delete.md",4992],"4e8f51cf":[()=>t.e(527).then(t.bind(t,80075)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-project-create.md",80075],"4f047c6d":[()=>t.e(2124).then(t.bind(t,59757)),"@site/docs/kusion/6-reference/1-commands/kusion-stack-create.md",59757],"4f9c62c8":[()=>t.e(6803).then(t.t.bind(t,57719,19)),"~blog/default/blog-tags-kusion-page-2-3fb-list.json",57719],"500b21de":[()=>Promise.all([t.e(532),t.e(5034)]).then(t.bind(t,92028)),"@site/docs_versioned_docs/version-v0.10/2-getting-started/1-install-kusion.md",92028],"501d789c":[()=>t.e(2677).then(t.t.bind(t,75626,19)),"~blog/default/blog-tags-platform-engineering-f5a.json",75626],"5078128f":[()=>t.e(4373).then(t.t.bind(t,24469,19)),"/home/runner/work/kusionstack.io/kusionstack.io/.docusaurus/docusaurus-plugin-content-blog/default/plugin-route-context-module-100.json",24469],"5080e45a":[()=>t.e(8136).then(t.bind(t,72423)),"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/workload/service.md",72423],"50dd0c7d":[()=>t.e(8111).then(t.bind(t,24581)),"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/container/lifecycle/doc_lifecycle.md",24581],"50dd26bc":[()=>t.e(8625).then(t.bind(t,93430)),"@site/docs/kusion/5-user-guides/2-working-with-k8s/4-image-upgrade.md",93430],"5112681f":[()=>t.e(8651).then(t.bind(t,25531)),"@site/docs_versioned_docs/version-v0.10/5-user-guides/1-cloud-resources/2-expose-service.md",25531],"5114ba79":[()=>t.e(4539).then(t.bind(t,49377)),"@site/docs/community/intro/intro.md",49377],"5207b198":[()=>t.e(2860).then(t.bind(t,8409)),"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/container/lifecycle/lifecycle.md",8409],"523e8f76":[()=>t.e(8465).then(t.t.bind(t,50601,19)),"~blog/default/blog-tags-kusion-page-4-da4.json",50601],"530384b4":[()=>t.e(7035).then(t.bind(t,95115)),"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/network/network.md",95115],"5353a7a1":[()=>t.e(4354).then(t.bind(t,92655)),"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace-delete.md",92655],"563e94c0":[()=>t.e(8440).then(t.bind(t,28387)),"@site/docs/kusion/6-reference/2-modules/2-workspace-configs/networking/network.md",28387],"5679e7dd":[()=>t.e(3273).then(t.t.bind(t,31652,19)),"~docs/operating/version-current-metadata-prop-751.json",31652],"5849eb93":[()=>t.e(4040).then(t.bind(t,65538)),"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/monitoring/doc_prometheus.md",65538],"588e0fb2":[()=>t.e(5276).then(t.bind(t,47698)),"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/internal/common.md",47698],"58f1477f":[()=>t.e(886).then(t.bind(t,590)),"@site/blog/2023-05-26-qcon-guangzhou/index.md?truncated=true",590],"59cd1056":[()=>t.e(7960).then(t.bind(t,57369)),"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/1-overview.md",57369],"59edad29":[()=>t.e(4699).then(t.bind(t,38400)),"@site/docs_versioned_docs/version-v0.10/5-user-guides/4-github-actions/1-deploy-application-via-github-actions.md",38400],"5a0745f3":[()=>t.e(3486).then(t.bind(t,59024)),"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/container/probe/doc_probe.md",59024],"5a928bd4":[()=>t.e(5002).then(t.t.bind(t,97134,19)),"~blog/default/blog-tags-platform-engineering-f5a-list.json",97134],"5a9b41ac":[()=>t.e(7037).then(t.bind(t,81560)),"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace-create.md",81560],"5b1b6e2c":[()=>t.e(3752).then(t.bind(t,99479)),"@site/docs/kusion/6-reference/1-commands/kusion-init.md",99479],"5b1d6087":[()=>t.e(7930).then(t.t.bind(t,2123,19)),"~blog/default/blog-tags-kusion-stack-page-3-1a9-list.json",2123],"5b317457":[()=>t.e(6853).then(t.bind(t,50757)),"@site/docs_versioned_docs/version-v0.9/config-walkthrough/database.md",50757],"5b5ba27a":[()=>t.e(4678).then(t.t.bind(t,87407,19)),"~blog/default/blog-tags-kcl-17e-list.json",87407],"5bd88873":[()=>t.e(4409).then(t.bind(t,29506)),"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/5-networking.md",29506],"5cbd74ee":[()=>t.e(2106).then(t.bind(t,46663)),"@site/docs_versioned_docs/version-v0.10/1-what-is-kusion/1-overview.md",46663],"5d01e53a":[()=>t.e(8880).then(t.bind(t,61733)),"@site/docs_versioned_docs/version-v0.11/6-reference/3-roadmap.md",61733],"5d07f957":[()=>t.e(7059).then(t.bind(t,82091)),"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/container/doc_container.md",82091],"5d5d02b0":[()=>t.e(664).then(t.bind(t,50835)),"@site/docs_versioned_docs/version-v0.9/guides/observability/prometheus.md",50835],"5d71f5cd":[()=>t.e(4233).then(t.bind(t,27701)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-mod-push.md",27701],"5de204ea":[()=>t.e(394).then(t.bind(t,28030)),"@site/docs_versioned_docs/version-v0.10/3-concepts/1-project/2-configuration.md",28030],"5e9f5e1a":[()=>Promise.resolve().then(t.bind(t,36809)),"@generated/docusaurus.config",36809],"5f7776bb":[()=>t.e(8993).then(t.bind(t,17682)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-update.md",17682],"5f9bf2e5":[()=>t.e(8835).then(t.bind(t,29883)),"@site/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/6-set-up-operational-rules.md",29883],"60cc01db":[()=>t.e(9198).then(t.bind(t,93118)),"@site/docs/operating/started/demo-graceful-operation.md",93118],"60cfcd23":[()=>t.e(6511).then(t.bind(t,96510)),"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-init.md",96510],"6145b3f7":[()=>t.e(9172).then(t.bind(t,11802)),"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/index.md",11802],"61f95e53":[()=>t.e(3682).then(t.bind(t,60571)),"@site/docs/kusion/6-reference/2-modules/3-naming-conventions.md",60571],"622b4683":[()=>t.e(1375).then(t.bind(t,66050)),"@site/operating_versioned_docs/version-v0.3/introduction/introduction.md",66050],"62fad4c6":[()=>t.e(7506).then(t.bind(t,94071)),"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/common.md",94071],"648c71af":[()=>t.e(4729).then(t.t.bind(t,32481,19)),"/home/runner/work/kusionstack.io/kusionstack.io/.docusaurus/docusaurus-plugin-content-docs/community/plugin-route-context-module-100.json",32481],"64d48972":[()=>t.e(1228).then(t.bind(t,76600)),"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/doc_app_configuration.md",76600],"6609e39c":[()=>t.e(3033).then(t.bind(t,20965)),"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/internal/container/lifecycle/lifecycle.md",20965],"66880af1":[()=>t.e(2964).then(t.bind(t,44081)),"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/database/doc_database.md",44081],"66add7b5":[()=>t.e(4335).then(t.bind(t,81384)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-stack-create.md",81384],"6875c492":[()=>Promise.all([t.e(532),t.e(8718),t.e(2529),t.e(8610)]).then(t.bind(t,41714)),"@theme/BlogTagsPostsPage",41714],"688dcd1a":[()=>t.e(2459).then(t.bind(t,18143)),"@site/ctrlmesh_versioned_docs/version-v0.1/concepts/concepts.md",18143],68966825:[()=>t.e(9507).then(t.bind(t,10514)),"@site/docs_versioned_docs/version-v0.11/1-what-is-kusion/1-overview.md",10514],"6a5caa1d":[()=>t.e(9441).then(t.bind(t,82046)),"@site/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/2-container.md",82046],"6b2b9057":[()=>t.e(3925).then(t.bind(t,16864)),"@site/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/3-service.md",16864],"6b830420":[()=>t.e(992).then(t.bind(t,80847)),"@site/docs/kusion/5-user-guides/3-observability/1-prometheus.md",80847],"6c13589d":[()=>t.e(1472).then(t.bind(t,32465)),"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/internal/container/lifecycle/lifecycle.md",32465],"6dc132fb":[()=>Promise.all([t.e(532),t.e(120)]).then(t.bind(t,45395)),"@site/docs_versioned_docs/version-v0.9/guides/cloud-resources/database.md",45395],"6fb6dfc9":[()=>t.e(9440).then(t.bind(t,22344)),"@site/docs/kusion/6-reference/1-commands/kusion-apply.md",22344],"70fd01e9":[()=>t.e(2291).then(t.bind(t,23956)),"@site/docs/kusion/3-concepts/2-stack/1-overview.md",23956],"725d07b1":[()=>t.e(8675).then(t.bind(t,21829)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-config-get.md",21829],"72b4a38a":[()=>t.e(8537).then(t.bind(t,34966)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-delete.md",34966],"72c158da":[()=>t.e(1824).then(t.bind(t,87019)),"@site/docs/operating/introduction/introduction.md",87019],73743333:[()=>t.e(9160).then(t.bind(t,53507)),"@site/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_version.md",53507],"74aaa9a4":[()=>t.e(9042).then(t.bind(t,17802)),"@site/docs/kusion/6-reference/1-commands/kusion-config-unset.md",17802],"74fcf2e7":[()=>t.e(2137).then(t.bind(t,63709)),"@site/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_destroy.md",63709],"75071e09":[()=>t.e(3485).then(t.bind(t,2398)),"@site/docs/kusion/4-configuration-walkthrough/5-networking.md",2398],"75b6673c":[()=>t.e(1550).then(t.bind(t,88108)),"@site/docs/kusion/3-concepts/3-kusion-module/1-overview.md",88108],"75ecccc2":[()=>t.e(9475).then(t.bind(t,48685)),"@site/docs/kusion/6-reference/1-commands/kusion-project.md",48685],"76129d61":[()=>Promise.all([t.e(532),t.e(5359)]).then(t.bind(t,62761)),"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/6-database.md",62761],"767bd663":[()=>t.e(6093).then(t.bind(t,34104)),"@site/operating_versioned_docs/version-v0.3/concepts/podopslifecycle.md",34104],"772d0280":[()=>t.e(7908).then(t.bind(t,89678)),"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/workload/job.md",89678],"77590aba":[()=>t.e(8251).then(t.bind(t,47526)),"@site/blog/2022-12-12-post-cloud-native-era-operation/index.md?truncated=true",47526],"77c6b439":[()=>t.e(8527).then(t.bind(t,8221)),"@site/docs/kusion/1-what-is-kusion/1-overview.md",8221],"77cf6619":[()=>t.e(5114).then(t.bind(t,28781)),"@site/docs_versioned_docs/version-v0.11/3-concepts/9-how-kusion-works.md",28781],"78ce7f42":[()=>t.e(8088).then(t.t.bind(t,44659,19)),"/home/runner/work/kusionstack.io/kusionstack.io/.docusaurus/docusaurus-plugin-content-docs/operating/plugin-route-context-module-100.json",44659],"78ec9a9a":[()=>t.e(9193).then(t.bind(t,58682)),"@site/docs/operating/manuals/collaset.md",58682],"79507ce0":[()=>t.e(5932).then(t.bind(t,48663)),"@site/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/5-resource-spec.md",48663],"7a493ae1":[()=>t.e(5623).then(t.bind(t,69253)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-config-list.md",69253],"7b7347a8":[()=>t.e(8607).then(t.bind(t,26421)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-config-unset.md",26421],"7c47ad75":[()=>t.e(191).then(t.bind(t,24545)),"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/app-configuration.md",24545],"7d429836":[()=>t.e(2616).then(t.bind(t,92951)),"@site/blog/2022-11-24-kusionstack-application-scale-operation-solution-in-the-post-cloudnative-era/index.md?truncated=true",92951],"7d9726a8":[()=>t.e(7429).then(t.t.bind(t,89494,19)),"~blog/default/blog-page-4-30b.json",89494],"7d99d243":[()=>Promise.all([t.e(532),t.e(7214)]).then(t.bind(t,72940)),"@site/docs_versioned_docs/version-v0.9/concepts/index.md",72940],"7dad11d2":[()=>t.e(6956).then(t.bind(t,18968)),"@site/docs/kusion/3-concepts/8-configuration.md",18968],"7de5ceea":[()=>t.e(8627).then(t.bind(t,81460)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-destroy.md",81460],"7eff7e60":[()=>t.e(5436).then(t.bind(t,67766)),"@site/blog/2021-08-03-kcl-intro/index.md?truncated=true",67766],"814f3328":[()=>t.e(2535).then(t.t.bind(t,45641,19)),"~blog/default/blog-post-list-prop-default.json",45641],"81f06d1d":[()=>t.e(5835).then(t.bind(t,74072)),"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/4-workload.md",74072],"8356d355":[()=>t.e(7706).then(t.t.bind(t,36069,19)),"~blog/default/blog-tags-kusion-page-3-d9b.json",36069],"83a718dd":[()=>t.e(4085).then(t.bind(t,62373)),"@site/docs_versioned_docs/version-v0.10/3-concepts/3-kusion-module.md",62373],"84d0485c":[()=>t.e(6626).then(t.bind(t,42355)),"@site/docs_versioned_docs/version-v0.11/7-faq/1-install-error.md",42355],"84d7eb88":[()=>t.e(944).then(t.bind(t,71684)),"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/2-kcl-basics.md",71684],"84e0516e":[()=>t.e(2781).then(t.bind(t,47780)),"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/workload/job.md",47780],86470930:[()=>t.e(3389).then(t.bind(t,49749)),"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/internal/common.md",49749],"86b70772":[()=>t.e(4679).then(t.bind(t,57310)),"@site/docs_versioned_docs/version-v0.10/5-user-guides/5-secrets-management/1-using-cloud-secrets.md",57310],"86bff84a":[()=>t.e(435).then(t.t.bind(t,60557,19)),"~docs/ctrlmesh/version-v-0-1-metadata-prop-cd1.json",60557],"87009dad":[()=>t.e(2499).then(t.t.bind(t,33426,19)),"~blog/default/blog-tags-kusion-faa.json",33426],87668920:[()=>t.e(9243).then(t.bind(t,25836)),"@site/docs/operating/concepts/podopslifecycle.md",25836],"8892d5ac":[()=>t.e(4505).then(t.bind(t,42423)),"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/index.md",42423],"891a814b":[()=>t.e(8514).then(t.bind(t,1978)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-show.md",1978],"891ff042":[()=>t.e(3769).then(t.bind(t,87441)),"@site/docs_versioned_docs/version-v0.9/reference/roadmap.md",87441],"892abc49":[()=>t.e(3741).then(t.t.bind(t,37951,19)),"~blog/default/blog-tags-kusion-faa-list.json",37951],"8953171e":[()=>t.e(6338).then(t.bind(t,44126)),"@site/docs_versioned_docs/version-v0.9/config-walkthrough/base_override.md",44126],"8af73e9a":[()=>t.e(230).then(t.bind(t,93749)),"@site/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/1-deploy-application.md",93749],"8b16a1f6":[()=>t.e(7531).then(t.bind(t,97407)),"@site/docs_versioned_docs/version-v0.11/3-concepts/1-project/2-configuration.md",97407],"8b66fb2a":[()=>t.e(4499).then(t.bind(t,52171)),"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/8-monitoring.md",52171],"8b914266":[()=>t.e(6183).then(t.t.bind(t,63987,19)),"~blog/default/blog-tags-kusion-stack-page-4-3a4-list.json",63987],"8c906d29":[()=>t.e(1436).then(t.bind(t,13587)),"@site/docs_versioned_docs/version-v0.10/7-faq/2-kcl.md",13587],"8cadf11f":[()=>t.e(824).then(t.bind(t,64014)),"@site/docs_versioned_docs/version-v0.9/concepts/intent.md",64014],"8cc3f780":[()=>t.e(4224).then(t.bind(t,25904)),"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/trait/doc_opsrule.md",25904],"8dc01f00":[()=>t.e(2285).then(t.bind(t,58490)),"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/database/postgres.md",58490],"8e8efec7":[()=>t.e(7600).then(t.bind(t,80627)),"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/network/port.md",80627],"8eb4e46b":[()=>t.e(1).then(t.t.bind(t,82638,19)),"~blog/default/blog-page-2-677.json",82638],"8ed9d5b5":[()=>t.e(308).then(t.bind(t,20719)),"@site/docs/kusion/2-getting-started/2-deliver-quickstart.md",20719],"8fcded8c":[()=>t.e(9803).then(t.bind(t,93635)),"@site/docs/kusion/5-user-guides/2-working-with-k8s/6-set-up-operational-rules.md",93635],"90c4e188":[()=>t.e(4397).then(t.bind(t,35001)),"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/9-operational-rules.md",35001],"914bff86":[()=>t.e(3310).then(t.bind(t,21388)),"@site/docs_versioned_docs/version-v0.10/3-concepts/6-intent.md",21388],"9218050e":[()=>t.e(5692).then(t.bind(t,46041)),"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/workload/service.md",46041],"926125d1":[()=>t.e(8503).then(t.bind(t,7111)),"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/database/mysql.md",7111],"92999a1c":[()=>t.e(8442).then(t.t.bind(t,15310,19)),"~blog/default/blog-page-3-fd4.json",15310],"9333a297":[()=>t.e(798).then(t.bind(t,66977)),"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/opsrule/opsrule.md",66977],"9437cc2c":[()=>t.e(6472).then(t.bind(t,92374)),"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/1-overview.md",92374],"96484e64":[()=>t.e(3736).then(t.t.bind(t,685,19)),"~docs/docs/version-v-0-11-metadata-prop-43e.json",685],"974b9b1f":[()=>t.e(4101).then(t.bind(t,33421)),"@site/docs/kusion/6-reference/1-commands/kusion-workspace-switch.md",33421],"977fdfc4":[()=>Promise.all([t.e(532),t.e(135)]).then(t.bind(t,81087)),"@site/docs/kusion/4-configuration-walkthrough/6-database.md",81087],"97b1a5f1":[()=>t.e(6447).then(t.bind(t,45785)),"@site/operating_versioned_docs/version-v0.3/manuals/podtransitionrule.md",45785],"97cb7c6f":[()=>t.e(4627).then(t.bind(t,1094)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-mod-init.md",1094],"97d4b178":[()=>t.e(5644).then(t.bind(t,32559)),"@site/docs/kusion/4-configuration-walkthrough/2-kcl-basics.md",32559],"98c2782f":[()=>t.e(2984).then(t.bind(t,3055)),"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/container/probe/probe.md",3055],"992984a1":[()=>t.e(8767).then(t.bind(t,80368)),"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace-update.md",80368],"99c9a9f3":[()=>t.e(1930).then(t.bind(t,7833)),"@site/docs_versioned_docs/version-v0.11/3-concepts/4-workspace.md",7833],"9a8d2f85":[()=>t.e(7135).then(t.bind(t,74335)),"@site/docs_versioned_docs/version-v0.9/reference/model/index.md",74335],"9aa67784":[()=>t.e(786).then(t.bind(t,82477)),"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/internal/container/probe/probe.md",82477],"9abd7762":[()=>t.e(2379).then(t.bind(t,76663)),"@site/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_init.md",76663],"9b7cb8f9":[()=>t.e(8976).then(t.bind(t,74985)),"@site/docs_versioned_docs/version-v0.9/guides/working-with-k8s/5-resource-spec.md",74985],"9beb799b":[()=>t.e(6568).then(t.bind(t,94540)),"@site/docs_versioned_docs/version-v0.11/3-concepts/2-stack/2-configuration.md",94540],"9bfd3055":[()=>t.e(4645).then(t.bind(t,69496)),"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/3-base-override.md",69496],"9ce7b331":[()=>t.e(9253).then(t.bind(t,56550)),"@site/operating_versioned_docs/version-v0.3/started/install.md",56550],"9d46269e":[()=>t.e(5827).then(t.bind(t,47561)),"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-preview.md",47561],"9e3571d8":[()=>t.e(6103).then(t.bind(t,78379)),"@site/docs/kusion/3-concepts/1-project/2-configuration.md",78379],"9e4087bc":[()=>t.e(3608).then(t.bind(t,63169)),"@theme/BlogArchivePage",63169],"9edb4516":[()=>t.e(3296).then(t.bind(t,16410)),"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/database/postgres.md",16410],"9f069a65":[()=>t.e(963).then(t.bind(t,61704)),"@site/docs/kusion/4-configuration-walkthrough/8-monitoring.md",61704],"9f0c4bd9":[()=>t.e(5742).then(t.bind(t,115)),"@site/docs/kusion/6-reference/1-commands/kusion-config-get.md",115],a08f9b67:[()=>t.e(6107).then(t.bind(t,61374)),"@site/docs/kusion/6-reference/1-commands/kusion-workspace.md",61374],a0ca06fd:[()=>t.e(9032).then(t.bind(t,57952)),"@site/docs_versioned_docs/version-v0.9/config-walkthrough/monitoring.md",57952],a104d7e6:[()=>t.e(6773).then(t.bind(t,96262)),"@site/docs/kusion/6-reference/1-commands/kusion-mod.md",96262],a121ee0b:[()=>t.e(2180).then(t.bind(t,21599)),"@site/docs/kusion/3-concepts/2-stack/2-configuration.md",21599],a28f322c:[()=>t.e(905).then(t.bind(t,52406)),"@site/docs/kusion/6-reference/1-commands/kusion-destroy.md",52406],a2e57478:[()=>t.e(7061).then(t.bind(t,83252)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-create.md",83252],a3522fac:[()=>t.e(7130).then(t.bind(t,41195)),"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/internal/container/container.md",41195],a3e670f9:[()=>t.e(2052).then(t.bind(t,14365)),"@site/docs_versioned_docs/version-v0.9/config-walkthrough/kcl_basics.md",14365],a61b46cc:[()=>t.e(8427).then(t.bind(t,72224)),"@site/docs_versioned_docs/version-v0.9/guides/working-with-k8s/3-service.md",72224],a6996c29:[()=>t.e(6248).then(t.bind(t,28243)),"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-build.md",28243],a6aa9e1f:[()=>Promise.all([t.e(532),t.e(8718),t.e(2529),t.e(3089)]).then(t.bind(t,80046)),"@theme/BlogListPage",80046],a7023ddc:[()=>t.e(1713).then(t.t.bind(t,53457,19)),"~blog/default/blog-tags-tags-4c2.json",53457],a8efa3a6:[()=>t.e(7690).then(t.bind(t,52955)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-apply.md",52955],a8fa00b4:[()=>t.e(6014).then(t.bind(t,15576)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-config.md",15576],a932aaa1:[()=>t.e(6657).then(t.bind(t,24692)),"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/workload/job.md",24692],a93b393b:[()=>t.e(3643).then(t.bind(t,31740)),"@site/docs_versioned_docs/version-v0.11/1-what-is-kusion/2-kusion-vs-x.md",31740],a9c8d21a:[()=>t.e(5194).then(t.bind(t,56250)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-init.md",56250],abc4e0a8:[()=>t.e(2204).then(t.bind(t,77098)),"@site/docs/kusion/4-configuration-walkthrough/1-overview.md",77098],ac50aac8:[()=>t.e(3206).then(t.bind(t,36800)),"@site/operating_versioned_docs/version-v0.3/manuals/collaset.md",36800],ac6eab16:[()=>t.e(9345).then(t.bind(t,50101)),"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/monitoring/prometheus.md",50101],acb8ea0c:[()=>Promise.all([t.e(532),t.e(5101)]).then(t.bind(t,77546)),"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/6-database.md",77546],b075c519:[()=>t.e(3464).then(t.bind(t,99827)),"@site/docs/ctrlmesh/concepts/concepts.md",99827],b10c63de:[()=>t.e(7143).then(t.bind(t,73362)),"@site/blog/2022-09-16-learn-from-scale-practice/index.md",73362],b1566ae1:[()=>t.e(9424).then(t.bind(t,74937)),"@site/blog/2022-11-24-kusionstack-application-scale-operation-solution-in-the-post-cloudnative-era/index.md",74937],b21ef2b8:[()=>t.e(7101).then(t.t.bind(t,39149,19)),"~blog/default/blog-tags-kusion-page-2-3fb.json",39149],b2b675dd:[()=>t.e(533).then(t.t.bind(t,28017,19)),"~blog/default/blog-c06.json",28017],b2f554cd:[()=>t.e(1477).then(t.t.bind(t,30010,19)),"~blog/default/blog-archive-80c.json",30010],b3471d8e:[()=>t.e(3229).then(t.bind(t,45470)),"@site/docs/operating/manuals/poddecoration.md",45470],b34bf6de:[()=>t.e(851).then(t.bind(t,61817)),"@site/docs/operating/manuals/podtransitionrule.md",61817],b472ca0f:[()=>t.e(2322).then(t.t.bind(t,61023,19)),"~blog/default/blog-tags-kcl-17e.json",61023],b57a4a2d:[()=>t.e(2708).then(t.bind(t,92542)),"@site/docs/kusion/5-user-guides/2-working-with-k8s/5-resource-spec.md",92542],b5bd2a6d:[()=>t.e(3345).then(t.t.bind(t,61755,19)),"~docs/docs/version-v-0-9-metadata-prop-346.json",61755],b62a942b:[()=>t.e(1e3).then(t.bind(t,88914)),"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/monitoring/prometheus.md",88914],b70fdfcb:[()=>t.e(5081).then(t.bind(t,56221)),"@site/docs/ctrlmesh/faq/faq.md",56221],b72e870b:[()=>t.e(799).then(t.bind(t,71295)),"@site/docs/kusion/6-reference/1-commands/kusion-workspace-show.md",71295],b7fa5c7a:[()=>t.e(4042).then(t.t.bind(t,66610,19)),"~docs/ctrlmesh/version-current-metadata-prop-751.json",66610],b7fdee58:[()=>t.e(5889).then(t.bind(t,670)),"@site/blog/2022-05-28-open-day/index.md",670],b8f8e7bf:[()=>t.e(1792).then(t.bind(t,8669)),"@site/docs_versioned_docs/version-v0.10/2-getting-started/2-deliver-wordpress.md",8669],b934881b:[()=>t.e(4757).then(t.bind(t,2558)),"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/database/mysql.md",2558],b9aad1dc:[()=>t.e(6039).then(t.bind(t,73466)),"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/trait/opsrule.md",73466],b9b61d04:[()=>t.e(4491).then(t.bind(t,90999)),"@site/docs/kusion/6-reference/2-modules/index.md",90999],ba7ecca1:[()=>t.e(9524).then(t.t.bind(t,15745,19)),"/home/runner/work/kusionstack.io/kusionstack.io/.docusaurus/docusaurus-plugin-content-pages/default/plugin-route-context-module-100.json",15745],baa12f70:[()=>t.e(5641).then(t.bind(t,46770)),"@site/docs/kusion/6-reference/3-roadmap.md",46770],bae34ec2:[()=>t.e(3066).then(t.bind(t,84290)),"@site/docs_versioned_docs/version-v0.9/concepts/arch.md",84290],bbb94644:[()=>t.e(4967).then(t.bind(t,9148)),"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/internal/container/probe/probe.md",9148],bc5f1a80:[()=>t.e(835).then(t.bind(t,73060)),"@site/docs/kusion/7-faq/1-install-error.md",73060],bcb97d3a:[()=>t.e(702).then(t.bind(t,64172)),"@site/docs/kusion/6-reference/1-commands/kusion-project-create.md",64172],bcd317c5:[()=>t.e(5969).then(t.bind(t,22429)),"@site/docs_versioned_docs/version-v0.11/3-concepts/6-spec.md",22429],bd8a8750:[()=>Promise.all([t.e(532),t.e(5633)]).then(t.bind(t,50904)),"@site/docs_versioned_docs/version-v0.9/getting-started/install-kusion.md",50904],befc1215:[()=>Promise.all([t.e(532),t.e(7334)]).then(t.bind(t,18135)),"@site/docs_versioned_docs/version-v0.11/5-user-guides/1-cloud-resources/2-expose-service.md",18135],bffab106:[()=>t.e(2777).then(t.bind(t,8664)),"@site/docs_versioned_docs/version-v0.9/reference/cli/kusion/kusion_apply.md",8664],c02a675f:[()=>t.e(800).then(t.bind(t,62222)),"@site/docs/kusion/6-reference/2-modules/2-workspace-configs/database/postgres.md",62222],c09b0fe7:[()=>t.e(1813).then(t.bind(t,71470)),"@site/docs/kusion/6-reference/1-commands/kusion-workspace-create.md",71470],c1bf8f22:[()=>Promise.all([t.e(532),t.e(2347)]).then(t.bind(t,90200)),"@site/docs/kusion/5-user-guides/1-cloud-resources/2-expose-service.md",90200],c1ddaab4:[()=>t.e(722).then(t.bind(t,42678)),"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/workload/doc_job.md",42678],c311d7f4:[()=>t.e(4446).then(t.bind(t,22537)),"@site/docs/operating/manuals/resourceconsist.md",22537],c3289e2b:[()=>t.e(4072).then(t.bind(t,60996)),"@site/docs_versioned_docs/version-v0.11/5-user-guides/3-observability/1-prometheus.md",60996],c3570998:[()=>t.e(9083).then(t.bind(t,21520)),"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/workload/doc_service.md",21520],c3d74b12:[()=>t.e(3496).then(t.bind(t,39182)),"@site/docs_versioned_docs/version-v0.9/getting-started/deliver-wordpress.md",39182],c4f5d8e4:[()=>Promise.all([t.e(532),t.e(8550),t.e(4195)]).then(t.bind(t,7413)),"@site/src/pages/index.js",7413],c4ff0a86:[()=>t.e(5722).then(t.bind(t,56053)),"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/workload/job.md",56053],c5353c60:[()=>t.e(4855).then(t.bind(t,56777)),"@site/docs/kusion/1-what-is-kusion/2-kusion-vs-x.md",56777],c61f38e7:[()=>t.e(5735).then(t.bind(t,79416)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-project.md",79416],c65cb071:[()=>t.e(7830).then(t.bind(t,8335)),"@site/blog/2021-08-03-kcl-intro/index.md",8335],c6834bbf:[()=>t.e(3550).then(t.bind(t,55522)),"@site/docs_versioned_docs/version-v0.10/1-what-is-kusion/2-kusion-vs-x.md",55522],c6c2c73a:[()=>t.e(1407).then(t.bind(t,55771)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-preview.md",55771],c7fa01e5:[()=>t.e(5523).then(t.bind(t,14609)),"@site/docs/kusion/5-user-guides/2-working-with-k8s/7-job.md",14609],c89433e3:[()=>t.e(9946).then(t.bind(t,74954)),"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/2-workspace-configs/monitoring/prometheus.md",74954],c89804bb:[()=>t.e(4124).then(t.bind(t,61113)),"@site/docs/kusion/6-reference/2-modules/1-developer-schemas/monitoring/prometheus.md",61113],c9777963:[()=>t.e(8052).then(t.bind(t,13559)),"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-destroy.md",13559],c9f937b3:[()=>t.e(7598).then(t.bind(t,58168)),"@site/blog/2022-06-07-sense-of-open-day/index.md?truncated=true",58168],ca110a3e:[()=>t.e(65).then(t.bind(t,28650)),"@site/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/7-job.md",28650],cae059c7:[()=>t.e(8417).then(t.bind(t,1786)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-options.md",1786],cbd4dc33:[()=>t.e(6355).then(t.bind(t,95755)),"@site/docs_versioned_docs/version-v0.9/reference/model/catalog_models/internal/secret/doc_secret.md",95755],cc1bc459:[()=>t.e(3780).then(t.bind(t,42421)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-mod.md",42421],cc91f96a:[()=>t.e(2534).then(t.bind(t,70909)),"@site/docs_versioned_docs/version-v0.11/3-concepts/3-kusion-module/2-develop-guide.md",70909],ccc49370:[()=>Promise.all([t.e(532),t.e(8718),t.e(2529),t.e(1080)]).then(t.bind(t,65203)),"@theme/BlogPostPage",65203],cd9e621c:[()=>t.e(7744).then(t.bind(t,67241)),"@site/docs/kusion/6-reference/1-commands/kusion-workspace-list.md",67241],ce316b05:[()=>t.e(3280).then(t.bind(t,53273)),"@site/docs_versioned_docs/version-v0.9/reference/model/1-overview.md",53273],cf74b0d6:[()=>t.e(5617).then(t.bind(t,14546)),"@site/blog/2022-09-16-learn-from-scale-practice/index.md?truncated=true",14546],d037b23d:[()=>t.e(7631).then(t.bind(t,296)),"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/2-kcl-basics.md",296],d08bdbd3:[()=>t.e(5665).then(t.bind(t,11286)),"@site/docs/kusion/6-reference/2-modules/2-workspace-configs/monitoring/prometheus.md",11286],d268f61a:[()=>t.e(7672).then(t.bind(t,86142)),"@site/docs_versioned_docs/version-v0.10/3-concepts/8-how-kusion-works.md",86142],d33211a6:[()=>t.e(5203).then(t.t.bind(t,86080,19)),"~blog/default/blog-tags-kclvm-31a-list.json",86080],d33f5cb2:[()=>t.e(1137).then(t.bind(t,90511)),"@site/docs/kusion/6-reference/1-commands/index.md",90511],d3d0d205:[()=>t.e(5246).then(t.bind(t,97455)),"@site/docs/kusion/6-reference/1-commands/kusion-config.md",97455],d47a6750:[()=>t.e(3951).then(t.t.bind(t,81355,19)),"~docs/docs/version-v-0-10-metadata-prop-b87.json",81355],d4850a38:[()=>t.e(511).then(t.bind(t,13169)),"@site/docs_versioned_docs/version-v0.9/concepts/kusion.md",13169],d5099334:[()=>t.e(171).then(t.bind(t,3696)),"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/9-operational-rules.md",3696],d5b05897:[()=>t.e(2789).then(t.bind(t,37793)),"@site/docs/kusion/4-configuration-walkthrough/3-base-override.md",37793],d622cb4f:[()=>t.e(556).then(t.bind(t,42012)),"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/database/postgres.md",42012],d64f1887:[()=>t.e(7541).then(t.bind(t,11493)),"@site/docs_versioned_docs/version-v0.9/guides/guides.md",11493],d76a14be:[()=>t.e(8555).then(t.bind(t,52600)),"@site/docs/kusion/3-concepts/6-spec.md",52600],d80fe9c5:[()=>t.e(1194).then(t.bind(t,4158)),"@site/operating_versioned_docs/version-v0.3/manuals/resourceconsist.md",4158],d82a2a7b:[()=>t.e(6949).then(t.bind(t,3938)),"@site/docs_versioned_docs/version-v0.9/support/kcl.md",3938],d889ad2d:[()=>t.e(438).then(t.bind(t,86854)),"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/database/mysql.md",86854],d8f7b805:[()=>Promise.all([t.e(532),t.e(4847)]).then(t.bind(t,90008)),"@site/docs_versioned_docs/version-v0.11/2-getting-started/1-install-kusion.md",90008],d9d9f449:[()=>t.e(102).then(t.bind(t,48939)),"@site/docs_versioned_docs/version-v0.10/7-faq/1-install-error.md",48939],daa78d60:[()=>Promise.all([t.e(532),t.e(223)]).then(t.bind(t,44261)),"@site/docs_versioned_docs/version-v0.9/concepts/glossary.md",44261],db343463:[()=>t.e(8420).then(t.bind(t,51901)),"@site/docs/kusion/6-reference/2-modules/2-workspace-configs/workload/job.md",51901],db719915:[()=>t.e(2679).then(t.bind(t,55421)),"@site/docs_versioned_docs/version-v0.11/4-configuration-walkthrough/8-monitoring.md",55421],de5e0098:[()=>t.e(8522).then(t.bind(t,7504)),"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/internal/secret/secret.md",7504],de7874bb:[()=>t.e(8026).then(t.bind(t,23127)),"@site/docs/kusion/3-concepts/5-appconfiguration.md",23127],e08a2305:[()=>t.e(3021).then(t.bind(t,81468)),"@site/docs_versioned_docs/version-v0.9/support/support.md",81468],e0d4068f:[()=>t.e(5815).then(t.bind(t,21522)),"@site/docs_versioned_docs/version-v0.11/3-concepts/3-kusion-module/1-overview.md",21522],e0ecd429:[()=>t.e(5435).then(t.t.bind(t,84931,19)),"~blog/default/blog-tags-large-scale-0df-list.json",84931],e14874ff:[()=>t.e(6061).then(t.bind(t,49474)),"@site/docs_versioned_docs/version-v0.11/3-concepts/8-configuration.md",49474],e1b9f8c7:[()=>t.e(7626).then(t.bind(t,7081)),"@site/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/6-set-up-operational-rules.md",7081],e1c24df0:[()=>t.e(2195).then(t.bind(t,89246)),"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/networking/network.md",89246],e2111cc5:[()=>t.e(8691).then(t.bind(t,65351)),"@site/blog/2022-06-07-sense-of-open-day/index.md",65351],e31dd6e1:[()=>t.e(8708).then(t.bind(t,24055)),"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/5-networking.md",24055],e3966691:[()=>t.e(3975).then(t.bind(t,2998)),"@site/docs/kusion/6-reference/1-commands/kusion-mod-init.md",2998],e4842d65:[()=>t.e(8276).then(t.t.bind(t,7085,19)),"/home/runner/work/kusionstack.io/kusionstack.io/.docusaurus/docusaurus-theme-search-algolia/default/plugin-route-context-module-100.json",7085],e4f1eb77:[()=>t.e(2636).then(t.bind(t,77353)),"@site/docs/kusion/5-user-guides/2-working-with-k8s/3-service.md",77353],e5474da6:[()=>t.e(574).then(t.bind(t,41703)),"@site/docs_versioned_docs/version-v0.9/getting-started/getting-started.md",41703],e5601569:[()=>t.e(5392).then(t.bind(t,93741)),"@site/docs_versioned_docs/version-v0.11/5-user-guides/2-working-with-k8s/4-image-upgrade.md",93741],e5c6035a:[()=>t.e(2966).then(t.bind(t,66234)),"@site/ctrlmesh_versioned_docs/version-v0.1/intro/intro.md",66234],e65d0f52:[()=>t.e(5468).then(t.t.bind(t,37371,19)),"/home/runner/work/kusionstack.io/kusionstack.io/.docusaurus/docusaurus-plugin-content-docs/docs/plugin-route-context-module-100.json",37371],e7791cad:[()=>t.e(745).then(t.bind(t,4151)),"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/2-workspace-configs/database/mysql.md",4151],e803704a:[()=>t.e(9904).then(t.bind(t,16327)),"@site/docs_versioned_docs/version-v0.11/5-user-guides/4-secrets-management/1-using-cloud-secrets.md",16327],e82e5e58:[()=>t.e(9319).then(t.bind(t,11998)),"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/workload/service.md",11998],e866e893:[()=>t.e(6485).then(t.t.bind(t,57761,19)),"~blog/default/blog-tags-kusion-stack-1cb.json",57761],e86c9445:[()=>t.e(466).then(t.bind(t,93672)),"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/3-naming-conventions.md",93672],e8d372a7:[()=>t.e(1937).then(t.bind(t,85563)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace-switch.md",85563],ec5071fd:[()=>t.e(6234).then(t.bind(t,12861)),"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/app-configuration.md",12861],ed44aa5e:[()=>t.e(3849).then(t.bind(t,50621)),"@site/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/4-image-upgrade.md",50621],ee544c0a:[()=>t.e(118).then(t.bind(t,17831)),"@site/operating_versioned_docs/version-v0.3/started/demo-graceful-operation.md",17831],ee6d0512:[()=>t.e(2121).then(t.bind(t,41437)),"@site/docs/kusion/7-faq/2-kcl.md",41437],f0c48f07:[()=>t.e(5664).then(t.bind(t,80197)),"@site/docs_versioned_docs/version-v0.10/5-user-guides/2-working-with-k8s/2-container.md",80197],f158ec46:[()=>t.e(7984).then(t.bind(t,83637)),"@site/docs_versioned_docs/version-v0.10/4-configuration-walkthrough/7-secret.md",83637],f2140f39:[()=>t.e(1200).then(t.bind(t,61385)),"@site/docs_versioned_docs/version-v0.10/3-concepts/2-stack/1-overview.md",61385],f23835f0:[()=>t.e(2664).then(t.t.bind(t,62810,19)),"~blog/default/blog-tags-kusion-stack-page-2-b1d.json",62810],f293b4fc:[()=>t.e(155).then(t.bind(t,2415)),"@site/docs_versioned_docs/version-v0.9/concepts/appconfiguration.md",2415],f3facea8:[()=>t.e(2769).then(t.bind(t,77634)),"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/internal/secret/secret.md",77634],f4dc87f8:[()=>t.e(1731).then(t.bind(t,82720)),"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-version.md",82720],f72402e6:[()=>t.e(6300).then(t.bind(t,66314)),"@site/docs/kusion/6-reference/1-commands/kusion-mod-push.md",66314],f7cb8cb3:[()=>t.e(8741).then(t.bind(t,66509)),"@site/docs_versioned_docs/version-v0.10/6-reference/1-commands/kusion-workspace-show.md",66509],f7f2164e:[()=>t.e(9095).then(t.bind(t,3483)),"@site/docs/kusion/3-concepts/9-how-kusion-works.md",3483],f8e6c3d7:[()=>t.e(6064).then(t.bind(t,85867)),"@site/docs_versioned_docs/version-v0.9/config-walkthrough/networking.md",85867],faf6f2db:[()=>t.e(9505).then(t.bind(t,55253)),"@site/docs_versioned_docs/version-v0.11/6-reference/1-commands/kusion-workspace.md",55253],fb3f88b1:[()=>t.e(4370).then(t.bind(t,95128)),"@site/docs_versioned_docs/version-v0.10/6-reference/2-modules/1-catalog-models/trait/opsrule.md",95128],fb5bb801:[()=>t.e(7971).then(t.bind(t,2233)),"@site/blog/2022-09-19-origin-present-and-future/index.md",2233],fb634d25:[()=>t.e(3934).then(t.bind(t,92351)),"@site/docs_versioned_docs/version-v0.11/6-reference/2-modules/1-developer-schemas/internal/container/container.md",92351],fbcd2cf0:[()=>t.e(8090).then(t.bind(t,20476)),"@site/blog/2022-09-19-origin-present-and-future/index.md?truncated=true",20476],fd1fdd14:[()=>t.e(3438).then(t.bind(t,81426)),"@site/docs/kusion/3-concepts/4-workspace.md",81426],fd5a02a1:[()=>t.e(6624).then(t.t.bind(t,22581,19)),"~blog/default/blog-tags-kusion-stack-page-3-1a9.json",22581],fd8fca12:[()=>t.e(6383).then(t.bind(t,33936)),"@site/docs/kusion/6-reference/1-commands/kusion-stack.md",33936],ff1602b7:[()=>t.e(5458).then(t.bind(t,55504)),"@site/docs_versioned_docs/version-v0.9/config-walkthrough/operational_rules.md",55504]};function l(e){let{error:n,retry:t,pastDelay:r}=e;return n?o.createElement("div",{style:{textAlign:"center",color:"#fff",backgroundColor:"#fa383e",borderColor:"#fa383e",borderStyle:"solid",borderRadius:"0.25rem",borderWidth:"1px",boxSizing:"border-box",display:"block",padding:"1rem",flex:"0 0 50%",marginLeft:"25%",marginRight:"25%",marginTop:"5rem",maxWidth:"50%",width:"100%"}},o.createElement("p",null,String(n)),o.createElement("div",null,o.createElement("button",{type:"button",onClick:t},"Retry"))):r?o.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh"}},o.createElement("svg",{id:"loader",style:{width:128,height:110,position:"absolute",top:"calc(100vh - 64%)"},viewBox:"0 0 45 45",xmlns:"http://www.w3.org/2000/svg",stroke:"#61dafb"},o.createElement("g",{fill:"none",fillRule:"evenodd",transform:"translate(1 1)",strokeWidth:"2"},o.createElement("circle",{cx:"22",cy:"22",r:"6",strokeOpacity:"0"},o.createElement("animate",{attributeName:"r",begin:"1.5s",dur:"3s",values:"6;22",calcMode:"linear",repeatCount:"indefinite"}),o.createElement("animate",{attributeName:"stroke-opacity",begin:"1.5s",dur:"3s",values:"1;0",calcMode:"linear",repeatCount:"indefinite"}),o.createElement("animate",{attributeName:"stroke-width",begin:"1.5s",dur:"3s",values:"2;0",calcMode:"linear",repeatCount:"indefinite"})),o.createElement("circle",{cx:"22",cy:"22",r:"6",strokeOpacity:"0"},o.createElement("animate",{attributeName:"r",begin:"3s",dur:"3s",values:"6;22",calcMode:"linear",repeatCount:"indefinite"}),o.createElement("animate",{attributeName:"stroke-opacity",begin:"3s",dur:"3s",values:"1;0",calcMode:"linear",repeatCount:"indefinite"}),o.createElement("animate",{attributeName:"stroke-width",begin:"3s",dur:"3s",values:"2;0",calcMode:"linear",repeatCount:"indefinite"})),o.createElement("circle",{cx:"22",cy:"22",r:"8"},o.createElement("animate",{attributeName:"r",begin:"0s",dur:"1.5s",values:"6;1;2;3;4;5;6",calcMode:"linear",repeatCount:"indefinite"}))))):null}var d=t(99670),u=t(30226);function p(e,n){if("*"===e)return s()({loading:l,loader:()=>t.e(4972).then(t.bind(t,4972)),modules:["@theme/NotFound"],webpack:()=>[4972],render(e,n){const t=e.default;return o.createElement(u.z,{value:{plugin:{name:"native",id:"default"}}},o.createElement(t,n))}});const a=i[`${e}-${n}`],p={},f=[],m=[],h=(0,d.Z)(a);return Object.entries(h).forEach((e=>{let[n,t]=e;const o=c[t];o&&(p[n]=o[0],f.push(o[1]),m.push(o[2]))})),s().Map({loading:l,loader:p,modules:f,webpack:()=>m,render(n,t){const s=JSON.parse(JSON.stringify(a));Object.entries(n).forEach((n=>{let[t,o]=n;const r=o.default;if(!r)throw new Error(`The page component at ${e} doesn't have a default export. This makes it impossible to render anything. Consider default-exporting a React component.`);"object"!=typeof r&&"function"!=typeof r||Object.keys(o).filter((e=>"default"!==e)).forEach((e=>{r[e]=o[e]}));let a=s;const i=t.split(".");i.slice(0,-1).forEach((e=>{a=a[e]})),a[i[i.length-1]]=r}));const i=s.__comp;delete s.__comp;const c=s.__context;return delete s.__context,o.createElement(u.z,{value:c},o.createElement(i,(0,r.Z)({},s,t)))}})}const f=[{path:"/blog",component:p("/blog","739"),exact:!0},{path:"/blog/2021-kcl-intro",component:p("/blog/2021-kcl-intro","363"),exact:!0},{path:"/blog/2021-kusion-intro",component:p("/blog/2021-kusion-intro","f82"),exact:!0},{path:"/blog/2022-kusionstack-application-scale-operation-solution-in-the-post-cloudnative-era",component:p("/blog/2022-kusionstack-application-scale-operation-solution-in-the-post-cloudnative-era","d44"),exact:!0},{path:"/blog/2022-learn-from-scale-practice",component:p("/blog/2022-learn-from-scale-practice","fc2"),exact:!0},{path:"/blog/2022-open-day",component:p("/blog/2022-open-day","f3d"),exact:!0},{path:"/blog/2022-origin-present-and-future",component:p("/blog/2022-origin-present-and-future","d98"),exact:!0},{path:"/blog/2022-post-cloud-native-era-operation",component:p("/blog/2022-post-cloud-native-era-operation","74f"),exact:!0},{path:"/blog/2022-sense-of-open-day",component:p("/blog/2022-sense-of-open-day","66f"),exact:!0},{path:"/blog/2023-05-26-qcon-guangzhou",component:p("/blog/2023-05-26-qcon-guangzhou","aaf"),exact:!0},{path:"/blog/archive",component:p("/blog/archive","d35"),exact:!0},{path:"/blog/page/2",component:p("/blog/page/2","7b7"),exact:!0},{path:"/blog/page/3",component:p("/blog/page/3","f80"),exact:!0},{path:"/blog/page/4",component:p("/blog/page/4","c94"),exact:!0},{path:"/blog/page/5",component:p("/blog/page/5","6b8"),exact:!0},{path:"/blog/tags",component:p("/blog/tags","468"),exact:!0},{path:"/blog/tags/kcl",component:p("/blog/tags/kcl","3dc"),exact:!0},{path:"/blog/tags/kclvm",component:p("/blog/tags/kclvm","2fa"),exact:!0},{path:"/blog/tags/kusion",component:p("/blog/tags/kusion","e28"),exact:!0},{path:"/blog/tags/kusion-stack",component:p("/blog/tags/kusion-stack","b5f"),exact:!0},{path:"/blog/tags/kusion-stack/page/2",component:p("/blog/tags/kusion-stack/page/2","f5c"),exact:!0},{path:"/blog/tags/kusion-stack/page/3",component:p("/blog/tags/kusion-stack/page/3","3ba"),exact:!0},{path:"/blog/tags/kusion-stack/page/4",component:p("/blog/tags/kusion-stack/page/4","bd3"),exact:!0},{path:"/blog/tags/kusion/page/2",component:p("/blog/tags/kusion/page/2","5f9"),exact:!0},{path:"/blog/tags/kusion/page/3",component:p("/blog/tags/kusion/page/3","e49"),exact:!0},{path:"/blog/tags/kusion/page/4",component:p("/blog/tags/kusion/page/4","18b"),exact:!0},{path:"/blog/tags/large-scale",component:p("/blog/tags/large-scale","645"),exact:!0},{path:"/blog/tags/platform-engineering",component:p("/blog/tags/platform-engineering","309"),exact:!0},{path:"/markdown-page",component:p("/markdown-page","b1e"),exact:!0},{path:"/search",component:p("/search","599"),exact:!0},{path:"/ctrlmesh/next",component:p("/ctrlmesh/next","7d1"),routes:[{path:"/ctrlmesh/next/concepts/",component:p("/ctrlmesh/next/concepts/","dc4"),exact:!0,sidebar:"ctrlmesh"},{path:"/ctrlmesh/next/faq/",component:p("/ctrlmesh/next/faq/","5a1"),exact:!0,sidebar:"ctrlmesh"},{path:"/ctrlmesh/next/intro/",component:p("/ctrlmesh/next/intro/","411"),exact:!0,sidebar:"ctrlmesh"},{path:"/ctrlmesh/next/started/install",component:p("/ctrlmesh/next/started/install","f75"),exact:!0,sidebar:"ctrlmesh"},{path:"/ctrlmesh/next/started/try",component:p("/ctrlmesh/next/started/try","84d"),exact:!0,sidebar:"ctrlmesh"}]},{path:"/docs/next",component:p("/docs/next","255"),routes:[{path:"/docs/next/",component:p("/docs/next/","4f4"),exact:!0,sidebar:"kusion"},{path:"/docs/next/concepts/app-configuration",component:p("/docs/next/concepts/app-configuration","769"),exact:!0,sidebar:"kusion"},{path:"/docs/next/concepts/backend",component:p("/docs/next/concepts/backend","3ef"),exact:!0,sidebar:"kusion"},{path:"/docs/next/concepts/configuration",component:p("/docs/next/concepts/configuration","1c9"),exact:!0,sidebar:"kusion"},{path:"/docs/next/concepts/how-kusion-works",component:p("/docs/next/concepts/how-kusion-works","6c9"),exact:!0,sidebar:"kusion"},{path:"/docs/next/concepts/kusion-module/app-dev-guide",component:p("/docs/next/concepts/kusion-module/app-dev-guide","101"),exact:!0,sidebar:"kusion"},{path:"/docs/next/concepts/kusion-module/develop-guide",component:p("/docs/next/concepts/kusion-module/develop-guide","467"),exact:!0,sidebar:"kusion"},{path:"/docs/next/concepts/kusion-module/overview",component:p("/docs/next/concepts/kusion-module/overview","f49"),exact:!0,sidebar:"kusion"},{path:"/docs/next/concepts/project/configuration",component:p("/docs/next/concepts/project/configuration","023"),exact:!0,sidebar:"kusion"},{path:"/docs/next/concepts/project/overview",component:p("/docs/next/concepts/project/overview","89f"),exact:!0,sidebar:"kusion"},{path:"/docs/next/concepts/spec",component:p("/docs/next/concepts/spec","ba4"),exact:!0,sidebar:"kusion"},{path:"/docs/next/concepts/stack/configuration",component:p("/docs/next/concepts/stack/configuration","bca"),exact:!0,sidebar:"kusion"},{path:"/docs/next/concepts/stack/overview",component:p("/docs/next/concepts/stack/overview","9ed"),exact:!0,sidebar:"kusion"},{path:"/docs/next/concepts/workspace",component:p("/docs/next/concepts/workspace","d8c"),exact:!0,sidebar:"kusion"},{path:"/docs/next/configuration-walkthrough/base-override",component:p("/docs/next/configuration-walkthrough/base-override","5c9"),exact:!0,sidebar:"kusion"},{path:"/docs/next/configuration-walkthrough/databse",component:p("/docs/next/configuration-walkthrough/databse","3bd"),exact:!0,sidebar:"kusion"},{path:"/docs/next/configuration-walkthrough/kcl-basics",component:p("/docs/next/configuration-walkthrough/kcl-basics","5ef"),exact:!0,sidebar:"kusion"},{path:"/docs/next/configuration-walkthrough/monitoring",component:p("/docs/next/configuration-walkthrough/monitoring","dac"),exact:!0,sidebar:"kusion"},{path:"/docs/next/configuration-walkthrough/networking",component:p("/docs/next/configuration-walkthrough/networking","d88"),exact:!0,sidebar:"kusion"},{path:"/docs/next/configuration-walkthrough/operational-rules",component:p("/docs/next/configuration-walkthrough/operational-rules","1f3"),exact:!0,sidebar:"kusion"},{path:"/docs/next/configuration-walkthrough/overview",component:p("/docs/next/configuration-walkthrough/overview","b81"),exact:!0,sidebar:"kusion"},{path:"/docs/next/configuration-walkthrough/secret",component:p("/docs/next/configuration-walkthrough/secret","ea8"),exact:!0,sidebar:"kusion"},{path:"/docs/next/configuration-walkthrough/workload",component:p("/docs/next/configuration-walkthrough/workload","af1"),exact:!0,sidebar:"kusion"},{path:"/docs/next/faq/install-error",component:p("/docs/next/faq/install-error","91a"),exact:!0,sidebar:"kusion"},{path:"/docs/next/faq/kcl",component:p("/docs/next/faq/kcl","2bc"),exact:!0,sidebar:"kusion"},{path:"/docs/next/getting-started/deliver-quickstart",component:p("/docs/next/getting-started/deliver-quickstart","c1b"),exact:!0,sidebar:"kusion"},{path:"/docs/next/getting-started/install-kusion",component:p("/docs/next/getting-started/install-kusion","54e"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/",component:p("/docs/next/reference/commands/","050"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/kusion-apply",component:p("/docs/next/reference/commands/kusion-apply","b8d"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/kusion-config",component:p("/docs/next/reference/commands/kusion-config","4c9"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/kusion-config-get",component:p("/docs/next/reference/commands/kusion-config-get","e98"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/kusion-config-list",component:p("/docs/next/reference/commands/kusion-config-list","ee4"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/kusion-config-set",component:p("/docs/next/reference/commands/kusion-config-set","453"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/kusion-config-unset",component:p("/docs/next/reference/commands/kusion-config-unset","1e2"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/kusion-destroy",component:p("/docs/next/reference/commands/kusion-destroy","7dc"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/kusion-generate",component:p("/docs/next/reference/commands/kusion-generate","75b"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/kusion-init",component:p("/docs/next/reference/commands/kusion-init","783"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/kusion-mod",component:p("/docs/next/reference/commands/kusion-mod","9cd"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/kusion-mod-init",component:p("/docs/next/reference/commands/kusion-mod-init","9af"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/kusion-mod-push",component:p("/docs/next/reference/commands/kusion-mod-push","67b"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/kusion-options",component:p("/docs/next/reference/commands/kusion-options","964"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/kusion-preview",component:p("/docs/next/reference/commands/kusion-preview","542"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/kusion-project",component:p("/docs/next/reference/commands/kusion-project","827"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/kusion-project-create",component:p("/docs/next/reference/commands/kusion-project-create","b50"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/kusion-stack",component:p("/docs/next/reference/commands/kusion-stack","cd7"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/kusion-stack-create",component:p("/docs/next/reference/commands/kusion-stack-create","d86"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/kusion-version",component:p("/docs/next/reference/commands/kusion-version","988"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/kusion-workspace",component:p("/docs/next/reference/commands/kusion-workspace","daf"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/kusion-workspace-create",component:p("/docs/next/reference/commands/kusion-workspace-create","9a6"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/kusion-workspace-delete",component:p("/docs/next/reference/commands/kusion-workspace-delete","f46"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/kusion-workspace-list",component:p("/docs/next/reference/commands/kusion-workspace-list","670"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/kusion-workspace-show",component:p("/docs/next/reference/commands/kusion-workspace-show","a20"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/kusion-workspace-switch",component:p("/docs/next/reference/commands/kusion-workspace-switch","165"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/commands/kusion-workspace-update",component:p("/docs/next/reference/commands/kusion-workspace-update","ab4"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/modules/",component:p("/docs/next/reference/modules/","1aa"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/modules/developer-schemas/app-configuration",component:p("/docs/next/reference/modules/developer-schemas/app-configuration","2b6"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/modules/developer-schemas/database/mysql",component:p("/docs/next/reference/modules/developer-schemas/database/mysql","087"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/modules/developer-schemas/database/postgres",component:p("/docs/next/reference/modules/developer-schemas/database/postgres","66a"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/modules/developer-schemas/internal/common",component:p("/docs/next/reference/modules/developer-schemas/internal/common","7fc"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/modules/developer-schemas/internal/container/",component:p("/docs/next/reference/modules/developer-schemas/internal/container/","75f"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/modules/developer-schemas/internal/container/lifecycle/",component:p("/docs/next/reference/modules/developer-schemas/internal/container/lifecycle/","efb"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/modules/developer-schemas/internal/container/probe/",component:p("/docs/next/reference/modules/developer-schemas/internal/container/probe/","062"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/modules/developer-schemas/internal/secret/",component:p("/docs/next/reference/modules/developer-schemas/internal/secret/","29f"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/modules/developer-schemas/monitoring/prometheus",component:p("/docs/next/reference/modules/developer-schemas/monitoring/prometheus","d9d"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/modules/developer-schemas/network/",component:p("/docs/next/reference/modules/developer-schemas/network/","8a1"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/modules/developer-schemas/opsrule/",component:p("/docs/next/reference/modules/developer-schemas/opsrule/","326"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/modules/developer-schemas/workload/job",component:p("/docs/next/reference/modules/developer-schemas/workload/job","003"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/modules/developer-schemas/workload/service",component:p("/docs/next/reference/modules/developer-schemas/workload/service","278"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/modules/naming-conventions",component:p("/docs/next/reference/modules/naming-conventions","f19"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/modules/workspace-configs/database/mysql",component:p("/docs/next/reference/modules/workspace-configs/database/mysql","f6b"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/modules/workspace-configs/database/postgres",component:p("/docs/next/reference/modules/workspace-configs/database/postgres","783"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/modules/workspace-configs/monitoring/prometheus",component:p("/docs/next/reference/modules/workspace-configs/monitoring/prometheus","e9c"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/modules/workspace-configs/networking/network",component:p("/docs/next/reference/modules/workspace-configs/networking/network","b22"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/modules/workspace-configs/opsrule/",component:p("/docs/next/reference/modules/workspace-configs/opsrule/","faa"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/modules/workspace-configs/workload/job",component:p("/docs/next/reference/modules/workspace-configs/workload/job","7d8"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/modules/workspace-configs/workload/service",component:p("/docs/next/reference/modules/workspace-configs/workload/service","d8a"),exact:!0,sidebar:"kusion"},{path:"/docs/next/reference/roadmap",component:p("/docs/next/reference/roadmap","23a"),exact:!0,sidebar:"kusion"},{path:"/docs/next/user-guides/cloud-resources/database",component:p("/docs/next/user-guides/cloud-resources/database","581"),exact:!0,sidebar:"kusion"},{path:"/docs/next/user-guides/cloud-resources/expose-service",component:p("/docs/next/user-guides/cloud-resources/expose-service","a2c"),exact:!0,sidebar:"kusion"},{path:"/docs/next/user-guides/observability/prometheus",component:p("/docs/next/user-guides/observability/prometheus","ef5"),exact:!0,sidebar:"kusion"},{path:"/docs/next/user-guides/secrets-management/using-cloud-secrets",component:p("/docs/next/user-guides/secrets-management/using-cloud-secrets","a0d"),exact:!0,sidebar:"kusion"},{path:"/docs/next/user-guides/working-with-k8s/container",component:p("/docs/next/user-guides/working-with-k8s/container","005"),exact:!0,sidebar:"kusion"},{path:"/docs/next/user-guides/working-with-k8s/deploy-application",component:p("/docs/next/user-guides/working-with-k8s/deploy-application","326"),exact:!0,sidebar:"kusion"},{path:"/docs/next/user-guides/working-with-k8s/image-upgrade",component:p("/docs/next/user-guides/working-with-k8s/image-upgrade","7f7"),exact:!0,sidebar:"kusion"},{path:"/docs/next/user-guides/working-with-k8s/job",component:p("/docs/next/user-guides/working-with-k8s/job","094"),exact:!0,sidebar:"kusion"},{path:"/docs/next/user-guides/working-with-k8s/resource-spec",component:p("/docs/next/user-guides/working-with-k8s/resource-spec","f2b"),exact:!0,sidebar:"kusion"},{path:"/docs/next/user-guides/working-with-k8s/service",component:p("/docs/next/user-guides/working-with-k8s/service","b5d"),exact:!0,sidebar:"kusion"},{path:"/docs/next/user-guides/working-with-k8s/set-up-operational-rules",component:p("/docs/next/user-guides/working-with-k8s/set-up-operational-rules","df4"),exact:!0,sidebar:"kusion"},{path:"/docs/next/what-is-kusion/kusion-vs-x",component:p("/docs/next/what-is-kusion/kusion-vs-x","7fa"),exact:!0,sidebar:"kusion"}]},{path:"/docs/v0.10",component:p("/docs/v0.10","e81"),routes:[{path:"/docs/v0.10/",component:p("/docs/v0.10/","ef3"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/concepts/app-configuration",component:p("/docs/v0.10/concepts/app-configuration","6df"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/concepts/backend-configuration",component:p("/docs/v0.10/concepts/backend-configuration","9c9"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/concepts/how-kusion-works",component:p("/docs/v0.10/concepts/how-kusion-works","c08"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/concepts/intent",component:p("/docs/v0.10/concepts/intent","c4d"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/concepts/kusion-module",component:p("/docs/v0.10/concepts/kusion-module","55e"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/concepts/project/configuration",component:p("/docs/v0.10/concepts/project/configuration","915"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/concepts/project/overview",component:p("/docs/v0.10/concepts/project/overview","f3c"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/concepts/stack/configuration",component:p("/docs/v0.10/concepts/stack/configuration","bc4"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/concepts/stack/overview",component:p("/docs/v0.10/concepts/stack/overview","6e2"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/concepts/workspace",component:p("/docs/v0.10/concepts/workspace","e1d"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/configuration-walkthrough/base-override",component:p("/docs/v0.10/configuration-walkthrough/base-override","0b5"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/configuration-walkthrough/databse",component:p("/docs/v0.10/configuration-walkthrough/databse","121"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/configuration-walkthrough/kcl-basics",component:p("/docs/v0.10/configuration-walkthrough/kcl-basics","dd0"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/configuration-walkthrough/monitoring",component:p("/docs/v0.10/configuration-walkthrough/monitoring","f11"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/configuration-walkthrough/networking",component:p("/docs/v0.10/configuration-walkthrough/networking","b4b"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/configuration-walkthrough/operational-rules",component:p("/docs/v0.10/configuration-walkthrough/operational-rules","ec1"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/configuration-walkthrough/overview",component:p("/docs/v0.10/configuration-walkthrough/overview","e22"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/configuration-walkthrough/secret",component:p("/docs/v0.10/configuration-walkthrough/secret","585"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/configuration-walkthrough/workload",component:p("/docs/v0.10/configuration-walkthrough/workload","572"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/faq/install-error",component:p("/docs/v0.10/faq/install-error","fc0"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/faq/kcl",component:p("/docs/v0.10/faq/kcl","2f0"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/getting-started/deliver-wordpress",component:p("/docs/v0.10/getting-started/deliver-wordpress","135"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/getting-started/install-kusion",component:p("/docs/v0.10/getting-started/install-kusion","b53"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/commands/",component:p("/docs/v0.10/reference/commands/","836"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/commands/kusion-apply",component:p("/docs/v0.10/reference/commands/kusion-apply","119"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/commands/kusion-build",component:p("/docs/v0.10/reference/commands/kusion-build","c21"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/commands/kusion-compile",component:p("/docs/v0.10/reference/commands/kusion-compile","edf"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/commands/kusion-destroy",component:p("/docs/v0.10/reference/commands/kusion-destroy","277"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/commands/kusion-init",component:p("/docs/v0.10/reference/commands/kusion-init","2d2"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/commands/kusion-preview",component:p("/docs/v0.10/reference/commands/kusion-preview","feb"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/commands/kusion-version",component:p("/docs/v0.10/reference/commands/kusion-version","ced"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/commands/kusion-workspace",component:p("/docs/v0.10/reference/commands/kusion-workspace","490"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/commands/kusion-workspace-create",component:p("/docs/v0.10/reference/commands/kusion-workspace-create","52b"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/commands/kusion-workspace-delete",component:p("/docs/v0.10/reference/commands/kusion-workspace-delete","2c7"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/commands/kusion-workspace-list",component:p("/docs/v0.10/reference/commands/kusion-workspace-list","64e"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/commands/kusion-workspace-show",component:p("/docs/v0.10/reference/commands/kusion-workspace-show","447"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/commands/kusion-workspace-update",component:p("/docs/v0.10/reference/commands/kusion-workspace-update","bcf"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/modules/",component:p("/docs/v0.10/reference/modules/","490"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/modules/catalog-models/app-configuration",component:p("/docs/v0.10/reference/modules/catalog-models/app-configuration","862"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/modules/catalog-models/database/mysql",component:p("/docs/v0.10/reference/modules/catalog-models/database/mysql","640"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/modules/catalog-models/database/postgres",component:p("/docs/v0.10/reference/modules/catalog-models/database/postgres","d78"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/modules/catalog-models/internal/common",component:p("/docs/v0.10/reference/modules/catalog-models/internal/common","2fe"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/modules/catalog-models/internal/container/",component:p("/docs/v0.10/reference/modules/catalog-models/internal/container/","430"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/modules/catalog-models/internal/container/lifecycle/",component:p("/docs/v0.10/reference/modules/catalog-models/internal/container/lifecycle/","122"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/modules/catalog-models/internal/container/probe/",component:p("/docs/v0.10/reference/modules/catalog-models/internal/container/probe/","627"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/modules/catalog-models/internal/network/port",component:p("/docs/v0.10/reference/modules/catalog-models/internal/network/port","0ed"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/modules/catalog-models/internal/secret/",component:p("/docs/v0.10/reference/modules/catalog-models/internal/secret/","bcd"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/modules/catalog-models/monitoring/prometheus",component:p("/docs/v0.10/reference/modules/catalog-models/monitoring/prometheus","b2b"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/modules/catalog-models/trait/opsrule",component:p("/docs/v0.10/reference/modules/catalog-models/trait/opsrule","ed8"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/modules/catalog-models/workload/job",component:p("/docs/v0.10/reference/modules/catalog-models/workload/job","854"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/modules/catalog-models/workload/service",component:p("/docs/v0.10/reference/modules/catalog-models/workload/service","627"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/modules/naming-conventions",component:p("/docs/v0.10/reference/modules/naming-conventions","55d"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/modules/workspace-configs/database/mysql",component:p("/docs/v0.10/reference/modules/workspace-configs/database/mysql","f23"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/modules/workspace-configs/database/postgres",component:p("/docs/v0.10/reference/modules/workspace-configs/database/postgres","d00"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/modules/workspace-configs/monitoring/prometheus",component:p("/docs/v0.10/reference/modules/workspace-configs/monitoring/prometheus","0ef"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/modules/workspace-configs/networking/port",component:p("/docs/v0.10/reference/modules/workspace-configs/networking/port","cf2"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/modules/workspace-configs/trait/opsrule",component:p("/docs/v0.10/reference/modules/workspace-configs/trait/opsrule","569"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/modules/workspace-configs/workload/job",component:p("/docs/v0.10/reference/modules/workspace-configs/workload/job","2b8"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/modules/workspace-configs/workload/service",component:p("/docs/v0.10/reference/modules/workspace-configs/workload/service","5af"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/reference/roadmap",component:p("/docs/v0.10/reference/roadmap","6b1"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/user-guides/cloud-resources/database",component:p("/docs/v0.10/user-guides/cloud-resources/database","709"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/user-guides/cloud-resources/expose-service",component:p("/docs/v0.10/user-guides/cloud-resources/expose-service","83c"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/user-guides/github-actions/deploy-application-via-github-actions",component:p("/docs/v0.10/user-guides/github-actions/deploy-application-via-github-actions","7c7"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/user-guides/observability/prometheus",component:p("/docs/v0.10/user-guides/observability/prometheus","698"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/user-guides/secrets-management/using-cloud-secrets",component:p("/docs/v0.10/user-guides/secrets-management/using-cloud-secrets","250"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/user-guides/working-with-k8s/container",component:p("/docs/v0.10/user-guides/working-with-k8s/container","de6"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/user-guides/working-with-k8s/deploy-application",component:p("/docs/v0.10/user-guides/working-with-k8s/deploy-application","270"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/user-guides/working-with-k8s/image-upgrade",component:p("/docs/v0.10/user-guides/working-with-k8s/image-upgrade","769"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/user-guides/working-with-k8s/job",component:p("/docs/v0.10/user-guides/working-with-k8s/job","b7c"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/user-guides/working-with-k8s/resource-spec",component:p("/docs/v0.10/user-guides/working-with-k8s/resource-spec","837"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/user-guides/working-with-k8s/service",component:p("/docs/v0.10/user-guides/working-with-k8s/service","f99"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/user-guides/working-with-k8s/set-up-operational-rules",component:p("/docs/v0.10/user-guides/working-with-k8s/set-up-operational-rules","1d3"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.10/what-is-kusion/kusion-vs-x",component:p("/docs/v0.10/what-is-kusion/kusion-vs-x","9f7"),exact:!0,sidebar:"kusion"}]},{path:"/docs/v0.9",component:p("/docs/v0.9","8be"),routes:[{path:"/docs/v0.9/",component:p("/docs/v0.9/","585"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/concepts/",component:p("/docs/v0.9/concepts/","75c"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/concepts/appconfiguration",component:p("/docs/v0.9/concepts/appconfiguration","d58"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/concepts/arch",component:p("/docs/v0.9/concepts/arch","684"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/concepts/glossary",component:p("/docs/v0.9/concepts/glossary","096"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/concepts/intent",component:p("/docs/v0.9/concepts/intent","68d"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/concepts/kusion",component:p("/docs/v0.9/concepts/kusion","7c0"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/config-walkthrough/base_override",component:p("/docs/v0.9/config-walkthrough/base_override","460"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/config-walkthrough/database",component:p("/docs/v0.9/config-walkthrough/database","af6"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/config-walkthrough/kcl_basics",component:p("/docs/v0.9/config-walkthrough/kcl_basics","a5e"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/config-walkthrough/monitoring",component:p("/docs/v0.9/config-walkthrough/monitoring","126"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/config-walkthrough/networking",component:p("/docs/v0.9/config-walkthrough/networking","479"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/config-walkthrough/operational_rules",component:p("/docs/v0.9/config-walkthrough/operational_rules","81b"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/config-walkthrough/overview",component:p("/docs/v0.9/config-walkthrough/overview","fc5"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/config-walkthrough/secret",component:p("/docs/v0.9/config-walkthrough/secret","7a0"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/config-walkthrough/workload",component:p("/docs/v0.9/config-walkthrough/workload","eb8"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/getting-started/",component:p("/docs/v0.9/getting-started/","86b"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/getting-started/deliver-wordpress",component:p("/docs/v0.9/getting-started/deliver-wordpress","260"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/getting-started/install-kusion",component:p("/docs/v0.9/getting-started/install-kusion","9a4"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/guides/",component:p("/docs/v0.9/guides/","ae5"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/guides/cloud-resources/database",component:p("/docs/v0.9/guides/cloud-resources/database","406"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/guides/cloud-resources/expose-service",component:p("/docs/v0.9/guides/cloud-resources/expose-service","5c7"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/guides/github-actions/deploy-application-securely-and-efficiently-via-github-actions",component:p("/docs/v0.9/guides/github-actions/deploy-application-securely-and-efficiently-via-github-actions","8de"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/guides/observability/prometheus",component:p("/docs/v0.9/guides/observability/prometheus","6aa"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/guides/working-with-k8s/",component:p("/docs/v0.9/guides/working-with-k8s/","eb1"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/guides/working-with-k8s/container",component:p("/docs/v0.9/guides/working-with-k8s/container","baf"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/guides/working-with-k8s/deploy-application",component:p("/docs/v0.9/guides/working-with-k8s/deploy-application","135"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/guides/working-with-k8s/image-upgrade",component:p("/docs/v0.9/guides/working-with-k8s/image-upgrade","0eb"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/guides/working-with-k8s/resource-spec",component:p("/docs/v0.9/guides/working-with-k8s/resource-spec","a84"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/guides/working-with-k8s/service",component:p("/docs/v0.9/guides/working-with-k8s/service","b15"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/intro/kusion-vs-x",component:p("/docs/v0.9/intro/kusion-vs-x","427"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/cli/",component:p("/docs/v0.9/reference/cli/","595"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/cli/backend/backend-configuration",component:p("/docs/v0.9/reference/cli/backend/backend-configuration","d5e"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/cli/kusion/",component:p("/docs/v0.9/reference/cli/kusion/","7b9"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/cli/kusion/kusion_apply",component:p("/docs/v0.9/reference/cli/kusion/kusion_apply","efb"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/cli/kusion/kusion_build",component:p("/docs/v0.9/reference/cli/kusion/kusion_build","753"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/cli/kusion/kusion_compile",component:p("/docs/v0.9/reference/cli/kusion/kusion_compile","a75"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/cli/kusion/kusion_destroy",component:p("/docs/v0.9/reference/cli/kusion/kusion_destroy","960"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/cli/kusion/kusion_init",component:p("/docs/v0.9/reference/cli/kusion/kusion_init","b9d"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/cli/kusion/kusion_preview",component:p("/docs/v0.9/reference/cli/kusion/kusion_preview","cb7"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/cli/kusion/kusion_version",component:p("/docs/v0.9/reference/cli/kusion/kusion_version","f0f"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/model/",component:p("/docs/v0.9/reference/model/","55c"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/model/catalog_models/database/doc_database",component:p("/docs/v0.9/reference/model/catalog_models/database/doc_database","79a"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/model/catalog_models/doc_app_configuration",component:p("/docs/v0.9/reference/model/catalog_models/doc_app_configuration","b93"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/model/catalog_models/internal/container/doc_container",component:p("/docs/v0.9/reference/model/catalog_models/internal/container/doc_container","177"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/model/catalog_models/internal/container/lifecycle/doc_lifecycle",component:p("/docs/v0.9/reference/model/catalog_models/internal/container/lifecycle/doc_lifecycle","923"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/model/catalog_models/internal/container/probe/doc_probe",component:p("/docs/v0.9/reference/model/catalog_models/internal/container/probe/doc_probe","dc9"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/model/catalog_models/internal/doc_common",component:p("/docs/v0.9/reference/model/catalog_models/internal/doc_common","220"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/model/catalog_models/internal/network/doc_port",component:p("/docs/v0.9/reference/model/catalog_models/internal/network/doc_port","fd6"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/model/catalog_models/internal/secret/doc_secret",component:p("/docs/v0.9/reference/model/catalog_models/internal/secret/doc_secret","386"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/model/catalog_models/monitoring/doc_prometheus",component:p("/docs/v0.9/reference/model/catalog_models/monitoring/doc_prometheus","347"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/model/catalog_models/trait/doc_opsrule",component:p("/docs/v0.9/reference/model/catalog_models/trait/doc_opsrule","1ad"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/model/catalog_models/workload/doc_job",component:p("/docs/v0.9/reference/model/catalog_models/workload/doc_job","dda"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/model/catalog_models/workload/doc_service",component:p("/docs/v0.9/reference/model/catalog_models/workload/doc_service","2d0"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/model/naming-conventions",component:p("/docs/v0.9/reference/model/naming-conventions","584"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/model/overview",component:p("/docs/v0.9/reference/model/overview","ac0"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/model/project-stack-config-items",component:p("/docs/v0.9/reference/model/project-stack-config-items","203"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/reference/roadmap",component:p("/docs/v0.9/reference/roadmap","673"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/support/",component:p("/docs/v0.9/support/","dcd"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/support/install-error",component:p("/docs/v0.9/support/install-error","174"),exact:!0,sidebar:"kusion"},{path:"/docs/v0.9/support/kcl",component:p("/docs/v0.9/support/kcl","8dc"),exact:!0,sidebar:"kusion"}]},{path:"/operating/next",component:p("/operating/next","3e5"),routes:[{path:"/operating/next/concepts/podopslifecycle",component:p("/operating/next/concepts/podopslifecycle","a91"),exact:!0,sidebar:"operating"},{path:"/operating/next/introduction/",component:p("/operating/next/introduction/","5e1"),exact:!0,sidebar:"operating"},{path:"/operating/next/manuals/collaset",component:p("/operating/next/manuals/collaset","83c"),exact:!0,sidebar:"operating"},{path:"/operating/next/manuals/poddecoration",component:p("/operating/next/manuals/poddecoration","b1b"),exact:!0,sidebar:"operating"},{path:"/operating/next/manuals/podtransitionrule",component:p("/operating/next/manuals/podtransitionrule","750"),exact:!0,sidebar:"operating"},{path:"/operating/next/manuals/resourceconsist",component:p("/operating/next/manuals/resourceconsist","7c7"),exact:!0,sidebar:"operating"},{path:"/operating/next/started/demo-graceful-operation",component:p("/operating/next/started/demo-graceful-operation","968"),exact:!0,sidebar:"operating"},{path:"/operating/next/started/install",component:p("/operating/next/started/install","90e"),exact:!0,sidebar:"operating"}]},{path:"/community",component:p("/community","f97"),routes:[{path:"/community/intro/",component:p("/community/intro/","332"),exact:!0,sidebar:"community"}]},{path:"/ctrlmesh",component:p("/ctrlmesh","d4a"),routes:[{path:"/ctrlmesh/concepts/",component:p("/ctrlmesh/concepts/","370"),exact:!0,sidebar:"ctrlmesh"},{path:"/ctrlmesh/faq/",component:p("/ctrlmesh/faq/","fe9"),exact:!0,sidebar:"ctrlmesh"},{path:"/ctrlmesh/intro/",component:p("/ctrlmesh/intro/","4f8"),exact:!0,sidebar:"ctrlmesh"},{path:"/ctrlmesh/started/install",component:p("/ctrlmesh/started/install","908"),exact:!0,sidebar:"ctrlmesh"},{path:"/ctrlmesh/started/try",component:p("/ctrlmesh/started/try","fc3"),exact:!0,sidebar:"ctrlmesh"}]},{path:"/docs",component:p("/docs","8bd"),routes:[{path:"/docs/",component:p("/docs/","699"),exact:!0,sidebar:"kusion"},{path:"/docs/concepts/app-configuration",component:p("/docs/concepts/app-configuration","032"),exact:!0,sidebar:"kusion"},{path:"/docs/concepts/backend",component:p("/docs/concepts/backend","a6d"),exact:!0,sidebar:"kusion"},{path:"/docs/concepts/configuration",component:p("/docs/concepts/configuration","e01"),exact:!0,sidebar:"kusion"},{path:"/docs/concepts/how-kusion-works",component:p("/docs/concepts/how-kusion-works","408"),exact:!0,sidebar:"kusion"},{path:"/docs/concepts/kusion-module/app-dev-guide",component:p("/docs/concepts/kusion-module/app-dev-guide","c1e"),exact:!0,sidebar:"kusion"},{path:"/docs/concepts/kusion-module/develop-guide",component:p("/docs/concepts/kusion-module/develop-guide","044"),exact:!0,sidebar:"kusion"},{path:"/docs/concepts/kusion-module/overview",component:p("/docs/concepts/kusion-module/overview","2a5"),exact:!0,sidebar:"kusion"},{path:"/docs/concepts/project/configuration",component:p("/docs/concepts/project/configuration","907"),exact:!0,sidebar:"kusion"},{path:"/docs/concepts/project/overview",component:p("/docs/concepts/project/overview","d5f"),exact:!0,sidebar:"kusion"},{path:"/docs/concepts/spec",component:p("/docs/concepts/spec","9e8"),exact:!0,sidebar:"kusion"},{path:"/docs/concepts/stack/configuration",component:p("/docs/concepts/stack/configuration","0af"),exact:!0,sidebar:"kusion"},{path:"/docs/concepts/stack/overview",component:p("/docs/concepts/stack/overview","1fc"),exact:!0,sidebar:"kusion"},{path:"/docs/concepts/workspace",component:p("/docs/concepts/workspace","a9c"),exact:!0,sidebar:"kusion"},{path:"/docs/configuration-walkthrough/base-override",component:p("/docs/configuration-walkthrough/base-override","5a6"),exact:!0,sidebar:"kusion"},{path:"/docs/configuration-walkthrough/databse",component:p("/docs/configuration-walkthrough/databse","54a"),exact:!0,sidebar:"kusion"},{path:"/docs/configuration-walkthrough/kcl-basics",component:p("/docs/configuration-walkthrough/kcl-basics","16c"),exact:!0,sidebar:"kusion"},{path:"/docs/configuration-walkthrough/monitoring",component:p("/docs/configuration-walkthrough/monitoring","193"),exact:!0,sidebar:"kusion"},{path:"/docs/configuration-walkthrough/networking",component:p("/docs/configuration-walkthrough/networking","baa"),exact:!0,sidebar:"kusion"},{path:"/docs/configuration-walkthrough/operational-rules",component:p("/docs/configuration-walkthrough/operational-rules","250"),exact:!0,sidebar:"kusion"},{path:"/docs/configuration-walkthrough/overview",component:p("/docs/configuration-walkthrough/overview","508"),exact:!0,sidebar:"kusion"},{path:"/docs/configuration-walkthrough/secret",component:p("/docs/configuration-walkthrough/secret","f2e"),exact:!0,sidebar:"kusion"},{path:"/docs/configuration-walkthrough/workload",component:p("/docs/configuration-walkthrough/workload","60b"),exact:!0,sidebar:"kusion"},{path:"/docs/faq/install-error",component:p("/docs/faq/install-error","6a7"),exact:!0,sidebar:"kusion"},{path:"/docs/faq/kcl",component:p("/docs/faq/kcl","04b"),exact:!0,sidebar:"kusion"},{path:"/docs/getting-started/deliver-quickstart",component:p("/docs/getting-started/deliver-quickstart","619"),exact:!0,sidebar:"kusion"},{path:"/docs/getting-started/install-kusion",component:p("/docs/getting-started/install-kusion","9b2"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/",component:p("/docs/reference/commands/","447"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/kusion-apply",component:p("/docs/reference/commands/kusion-apply","915"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/kusion-config",component:p("/docs/reference/commands/kusion-config","297"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/kusion-config-get",component:p("/docs/reference/commands/kusion-config-get","3cd"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/kusion-config-list",component:p("/docs/reference/commands/kusion-config-list","5c5"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/kusion-config-set",component:p("/docs/reference/commands/kusion-config-set","a7d"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/kusion-config-unset",component:p("/docs/reference/commands/kusion-config-unset","37c"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/kusion-destroy",component:p("/docs/reference/commands/kusion-destroy","d0c"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/kusion-generate",component:p("/docs/reference/commands/kusion-generate","a81"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/kusion-init",component:p("/docs/reference/commands/kusion-init","44e"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/kusion-mod",component:p("/docs/reference/commands/kusion-mod","a90"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/kusion-mod-init",component:p("/docs/reference/commands/kusion-mod-init","49d"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/kusion-mod-push",component:p("/docs/reference/commands/kusion-mod-push","421"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/kusion-options",component:p("/docs/reference/commands/kusion-options","020"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/kusion-preview",component:p("/docs/reference/commands/kusion-preview","7c7"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/kusion-project",component:p("/docs/reference/commands/kusion-project","485"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/kusion-project-create",component:p("/docs/reference/commands/kusion-project-create","182"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/kusion-stack",component:p("/docs/reference/commands/kusion-stack","c3d"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/kusion-stack-create",component:p("/docs/reference/commands/kusion-stack-create","f52"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/kusion-version",component:p("/docs/reference/commands/kusion-version","cd6"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/kusion-workspace",component:p("/docs/reference/commands/kusion-workspace","ab3"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/kusion-workspace-create",component:p("/docs/reference/commands/kusion-workspace-create","f2c"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/kusion-workspace-delete",component:p("/docs/reference/commands/kusion-workspace-delete","5c0"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/kusion-workspace-list",component:p("/docs/reference/commands/kusion-workspace-list","deb"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/kusion-workspace-show",component:p("/docs/reference/commands/kusion-workspace-show","2c2"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/kusion-workspace-switch",component:p("/docs/reference/commands/kusion-workspace-switch","679"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/commands/kusion-workspace-update",component:p("/docs/reference/commands/kusion-workspace-update","615"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/modules/",component:p("/docs/reference/modules/","7d3"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/modules/developer-schemas/app-configuration",component:p("/docs/reference/modules/developer-schemas/app-configuration","18b"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/modules/developer-schemas/database/mysql",component:p("/docs/reference/modules/developer-schemas/database/mysql","cd2"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/modules/developer-schemas/database/postgres",component:p("/docs/reference/modules/developer-schemas/database/postgres","297"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/modules/developer-schemas/internal/common",component:p("/docs/reference/modules/developer-schemas/internal/common","449"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/modules/developer-schemas/internal/container/",component:p("/docs/reference/modules/developer-schemas/internal/container/","529"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/modules/developer-schemas/internal/container/lifecycle/",component:p("/docs/reference/modules/developer-schemas/internal/container/lifecycle/","9e2"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/modules/developer-schemas/internal/container/probe/",component:p("/docs/reference/modules/developer-schemas/internal/container/probe/","aec"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/modules/developer-schemas/internal/secret/",component:p("/docs/reference/modules/developer-schemas/internal/secret/","a1f"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/modules/developer-schemas/monitoring/prometheus",component:p("/docs/reference/modules/developer-schemas/monitoring/prometheus","a63"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/modules/developer-schemas/network/",component:p("/docs/reference/modules/developer-schemas/network/","526"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/modules/developer-schemas/opsrule/",component:p("/docs/reference/modules/developer-schemas/opsrule/","d7b"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/modules/developer-schemas/workload/job",component:p("/docs/reference/modules/developer-schemas/workload/job","95f"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/modules/developer-schemas/workload/service",component:p("/docs/reference/modules/developer-schemas/workload/service","d9a"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/modules/naming-conventions",component:p("/docs/reference/modules/naming-conventions","f29"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/modules/workspace-configs/database/mysql",component:p("/docs/reference/modules/workspace-configs/database/mysql","232"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/modules/workspace-configs/database/postgres",component:p("/docs/reference/modules/workspace-configs/database/postgres","ad3"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/modules/workspace-configs/monitoring/prometheus",component:p("/docs/reference/modules/workspace-configs/monitoring/prometheus","367"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/modules/workspace-configs/networking/network",component:p("/docs/reference/modules/workspace-configs/networking/network","4ec"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/modules/workspace-configs/opsrule/",component:p("/docs/reference/modules/workspace-configs/opsrule/","bb5"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/modules/workspace-configs/workload/job",component:p("/docs/reference/modules/workspace-configs/workload/job","838"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/modules/workspace-configs/workload/service",component:p("/docs/reference/modules/workspace-configs/workload/service","edd"),exact:!0,sidebar:"kusion"},{path:"/docs/reference/roadmap",component:p("/docs/reference/roadmap","209"),exact:!0,sidebar:"kusion"},{path:"/docs/user-guides/cloud-resources/database",component:p("/docs/user-guides/cloud-resources/database","f46"),exact:!0,sidebar:"kusion"},{path:"/docs/user-guides/cloud-resources/expose-service",component:p("/docs/user-guides/cloud-resources/expose-service","dfe"),exact:!0,sidebar:"kusion"},{path:"/docs/user-guides/observability/prometheus",component:p("/docs/user-guides/observability/prometheus","303"),exact:!0,sidebar:"kusion"},{path:"/docs/user-guides/secrets-management/using-cloud-secrets",component:p("/docs/user-guides/secrets-management/using-cloud-secrets","f6d"),exact:!0,sidebar:"kusion"},{path:"/docs/user-guides/working-with-k8s/container",component:p("/docs/user-guides/working-with-k8s/container","c03"),exact:!0,sidebar:"kusion"},{path:"/docs/user-guides/working-with-k8s/deploy-application",component:p("/docs/user-guides/working-with-k8s/deploy-application","cbc"),exact:!0,sidebar:"kusion"},{path:"/docs/user-guides/working-with-k8s/image-upgrade",component:p("/docs/user-guides/working-with-k8s/image-upgrade","f1c"),exact:!0,sidebar:"kusion"},{path:"/docs/user-guides/working-with-k8s/job",component:p("/docs/user-guides/working-with-k8s/job","976"),exact:!0,sidebar:"kusion"},{path:"/docs/user-guides/working-with-k8s/resource-spec",component:p("/docs/user-guides/working-with-k8s/resource-spec","2d6"),exact:!0,sidebar:"kusion"},{path:"/docs/user-guides/working-with-k8s/service",component:p("/docs/user-guides/working-with-k8s/service","8bf"),exact:!0,sidebar:"kusion"},{path:"/docs/user-guides/working-with-k8s/set-up-operational-rules",component:p("/docs/user-guides/working-with-k8s/set-up-operational-rules","af6"),exact:!0,sidebar:"kusion"},{path:"/docs/what-is-kusion/kusion-vs-x",component:p("/docs/what-is-kusion/kusion-vs-x","ced"),exact:!0,sidebar:"kusion"}]},{path:"/operating",component:p("/operating","aeb"),routes:[{path:"/operating/concepts/podopslifecycle",component:p("/operating/concepts/podopslifecycle","81f"),exact:!0,sidebar:"operating"},{path:"/operating/introduction/",component:p("/operating/introduction/","d58"),exact:!0,sidebar:"operating"},{path:"/operating/manuals/collaset",component:p("/operating/manuals/collaset","4fc"),exact:!0,sidebar:"operating"},{path:"/operating/manuals/poddecoration",component:p("/operating/manuals/poddecoration","c83"),exact:!0,sidebar:"operating"},{path:"/operating/manuals/podtransitionrule",component:p("/operating/manuals/podtransitionrule","3ab"),exact:!0,sidebar:"operating"},{path:"/operating/manuals/resourceconsist",component:p("/operating/manuals/resourceconsist","a10"),exact:!0,sidebar:"operating"},{path:"/operating/started/demo-graceful-operation",component:p("/operating/started/demo-graceful-operation","39a"),exact:!0,sidebar:"operating"},{path:"/operating/started/install",component:p("/operating/started/install","45e"),exact:!0,sidebar:"operating"}]},{path:"/",component:p("/","2da"),exact:!0},{path:"*",component:p("*")}]},98934:(e,n,t)=>{"use strict";t.d(n,{_:()=>r,t:()=>a});var o=t(67294);const r=o.createContext(!1);function a(e){let{children:n}=e;const[t,a]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{a(!0)}),[]),o.createElement(r.Provider,{value:t},n)}},49383:(e,n,t)=>{"use strict";var o=t(67294),r=t(73935),a=t(73727),s=t(70405),i=t(10412);const c=[t(56657),t(32497),t(3310),t(18320),t(52295)];var l=t(723),d=t(76775),u=t(18790);function p(e){let{children:n}=e;return o.createElement(o.Fragment,null,n)}var f=t(87462),m=t(35742),h=t(52263),g=t(44996),b=t(86668),v=t(10833),k=t(94711),w=t(19727),y=t(43320),_=t(90197);function x(){const{i18n:{defaultLocale:e,localeConfigs:n}}=(0,h.Z)(),t=(0,k.l)();return o.createElement(m.Z,null,Object.entries(n).map((e=>{let[n,{htmlLang:r}]=e;return o.createElement("link",{key:n,rel:"alternate",href:t.createUrl({locale:n,fullyQualified:!0}),hrefLang:r})})),o.createElement("link",{rel:"alternate",href:t.createUrl({locale:e,fullyQualified:!0}),hrefLang:"x-default"}))}function E(e){let{permalink:n}=e;const{siteConfig:{url:t}}=(0,h.Z)(),r=function(){const{siteConfig:{url:e}}=(0,h.Z)(),{pathname:n}=(0,d.TH)();return e+(0,g.Z)(n)}(),a=n?`${t}${n}`:r;return o.createElement(m.Z,null,o.createElement("meta",{property:"og:url",content:a}),o.createElement("link",{rel:"canonical",href:a}))}function S(){const{i18n:{currentLocale:e}}=(0,h.Z)(),{metadata:n,image:t}=(0,b.L)();return o.createElement(o.Fragment,null,o.createElement(m.Z,null,o.createElement("meta",{name:"twitter:card",content:"summary_large_image"}),o.createElement("body",{className:w.h})),t&&o.createElement(v.d,{image:t}),o.createElement(E,null),o.createElement(x,null),o.createElement(_.Z,{tag:y.HX,locale:e}),o.createElement(m.Z,null,n.map(((e,n)=>o.createElement("meta",(0,f.Z)({key:n},e))))))}const C=new Map;function T(e){if(C.has(e.pathname))return{...e,pathname:C.get(e.pathname)};if((0,u.f)(l.Z,e.pathname).some((e=>{let{route:n}=e;return!0===n.exact})))return C.set(e.pathname,e.pathname),e;const n=e.pathname.trim().replace(/(?:\/index)?\.html$/,"")||"/";return C.set(e.pathname,n),{...e,pathname:n}}var A=t(98934),L=t(58940);function P(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),o=1;o{var o;const r=(null==(o=n.default)?void 0:o[e])??n[e];return null==r?void 0:r(...t)}));return()=>r.forEach((e=>null==e?void 0:e()))}const R=function(e){let{children:n,location:t,previousLocation:r}=e;return(0,o.useLayoutEffect)((()=>{r!==t&&(!function(e){let{location:n,previousLocation:t}=e;if(!t)return;const o=n.pathname===t.pathname,r=n.hash===t.hash,a=n.search===t.search;if(o&&r&&!a)return;const{hash:s}=n;if(s){const e=decodeURIComponent(s.substring(1)),n=document.getElementById(e);null==n||n.scrollIntoView()}else window.scrollTo(0,0)}({location:t,previousLocation:r}),P("onRouteDidUpdate",{previousLocation:r,location:t}))}),[r,t]),n};function N(e){const n=Array.from(new Set([e,decodeURI(e)])).map((e=>(0,u.f)(l.Z,e))).flat();return Promise.all(n.map((e=>null==e.route.component.preload?void 0:e.route.component.preload())))}class O extends o.Component{previousLocation;routeUpdateCleanupCb;constructor(e){super(e),this.previousLocation=null,this.routeUpdateCleanupCb=i.Z.canUseDOM?P("onRouteUpdate",{previousLocation:null,location:this.props.location}):()=>{},this.state={nextRouteHasLoaded:!0}}shouldComponentUpdate(e,n){if(e.location===this.props.location)return n.nextRouteHasLoaded;const t=e.location;return this.previousLocation=this.props.location,this.setState({nextRouteHasLoaded:!1}),this.routeUpdateCleanupCb=P("onRouteUpdate",{previousLocation:this.previousLocation,location:t}),N(t.pathname).then((()=>{this.routeUpdateCleanupCb(),this.setState({nextRouteHasLoaded:!0})})).catch((e=>{console.warn(e),window.location.reload()})),!1}render(){const{children:e,location:n}=this.props;return o.createElement(R,{previousLocation:this.previousLocation,location:n},o.createElement(d.AW,{location:n,render:()=>e}))}}const I=O,D="__docusaurus-base-url-issue-banner-container",M="__docusaurus-base-url-issue-banner-suggestion-container",j="__DOCUSAURUS_INSERT_BASEURL_BANNER";function B(e){return`\nwindow['${j}'] = true;\n\ndocument.addEventListener('DOMContentLoaded', maybeInsertBanner);\n\nfunction maybeInsertBanner() {\n var shouldInsert = window['${j}'];\n shouldInsert && insertBanner();\n}\n\nfunction insertBanner() {\n var bannerContainer = document.getElementById('${D}');\n if (!bannerContainer) {\n return;\n }\n var bannerHtml = ${JSON.stringify(function(e){return`\n
\n

Your Docusaurus site did not load properly.

\n

A very common reason is a wrong site baseUrl configuration.

\n

Current configured baseUrl = ${e} ${"/"===e?" (default value)":""}

\n

We suggest trying baseUrl =

\n
\n`}(e)).replace(/{window[j]=!1}),[]),o.createElement(o.Fragment,null,!i.Z.canUseDOM&&o.createElement(m.Z,null,o.createElement("script",null,B(e))),o.createElement("div",{id:D}))}function q(){const{siteConfig:{baseUrl:e,baseUrlIssueBanner:n}}=(0,h.Z)(),{pathname:t}=(0,d.TH)();return n&&t===e?o.createElement(F,null):null}function z(){const{siteConfig:{favicon:e,title:n,noIndex:t},i18n:{currentLocale:r,localeConfigs:a}}=(0,h.Z)(),s=(0,g.Z)(e),{htmlLang:i,direction:c}=a[r];return o.createElement(m.Z,null,o.createElement("html",{lang:i,dir:c}),o.createElement("title",null,n),o.createElement("meta",{property:"og:title",content:n}),o.createElement("meta",{name:"viewport",content:"width=device-width, initial-scale=1.0"}),t&&o.createElement("meta",{name:"robots",content:"noindex, nofollow"}),e&&o.createElement("link",{rel:"icon",href:s}))}var U=t(44763);function $(){const e=(0,u.H)(l.Z),n=(0,d.TH)();return o.createElement(U.Z,null,o.createElement(L.M,null,o.createElement(A.t,null,o.createElement(p,null,o.createElement(z,null),o.createElement(S,null),o.createElement(q,null),o.createElement(I,{location:T(n)},e)))))}var G=t(16887);const H=function(e){try{return document.createElement("link").relList.supports(e)}catch{return!1}}("prefetch")?function(e){return new Promise(((n,t)=>{var o;if("undefined"==typeof document)return void t();const r=document.createElement("link");r.setAttribute("rel","prefetch"),r.setAttribute("href",e),r.onload=()=>n(),r.onerror=()=>t();const a=document.getElementsByTagName("head")[0]??(null==(o=document.getElementsByName("script")[0])?void 0:o.parentNode);null==a||a.appendChild(r)}))}:function(e){return new Promise(((n,t)=>{const o=new XMLHttpRequest;o.open("GET",e,!0),o.withCredentials=!0,o.onload=()=>{200===o.status?n():t()},o.send(null)}))};var Z=t(99670);const V=new Set,W=new Set,K=()=>{var e,n;return(null==(e=navigator.connection)?void 0:e.effectiveType.includes("2g"))||(null==(n=navigator.connection)?void 0:n.saveData)},Y={prefetch(e){if(!(e=>!K()&&!W.has(e)&&!V.has(e))(e))return!1;V.add(e);const n=(0,u.f)(l.Z,e).flatMap((e=>{return n=e.route.path,Object.entries(G).filter((e=>{let[t]=e;return t.replace(/-[^-]+$/,"")===n})).flatMap((e=>{let[,n]=e;return Object.values((0,Z.Z)(n))}));var n}));return Promise.all(n.map((e=>{const n=t.gca(e);return n&&!n.includes("undefined")?H(n).catch((()=>{})):Promise.resolve()})))},preload:e=>!!(e=>!K()&&!W.has(e))(e)&&(W.add(e),N(e))},Q=Object.freeze(Y);if(i.Z.canUseDOM){window.docusaurus=Q;const e=r.hydrate;N(window.location.pathname).then((()=>{e(o.createElement(s.B6,null,o.createElement(a.VK,null,o.createElement($,null))),document.getElementById("__docusaurus"))}))}},58940:(e,n,t)=>{"use strict";t.d(n,{_:()=>d,M:()=>u});var o=t(67294),r=t(36809);const a=JSON.parse('{"docusaurus-plugin-google-gtag":{"default":{"trackingID":["G-XC4Z27TLBR"],"anonymizeIP":false,"id":"default"}},"docusaurus-plugin-content-docs":{"docs":{"path":"/docs","versions":[{"name":"current","label":"v0.12 \ud83d\udea7","isLast":false,"path":"/docs/next","mainDocId":"what-is-kusion/overview","docs":[{"id":"concepts/app-configuration","path":"/docs/next/concepts/app-configuration","sidebar":"kusion"},{"id":"concepts/backend","path":"/docs/next/concepts/backend","sidebar":"kusion"},{"id":"concepts/configuration","path":"/docs/next/concepts/configuration","sidebar":"kusion"},{"id":"concepts/how-kusion-works","path":"/docs/next/concepts/how-kusion-works","sidebar":"kusion"},{"id":"concepts/kusion-module/app-dev-guide","path":"/docs/next/concepts/kusion-module/app-dev-guide","sidebar":"kusion"},{"id":"concepts/kusion-module/develop-guide","path":"/docs/next/concepts/kusion-module/develop-guide","sidebar":"kusion"},{"id":"concepts/kusion-module/overview","path":"/docs/next/concepts/kusion-module/overview","sidebar":"kusion"},{"id":"concepts/project/configuration","path":"/docs/next/concepts/project/configuration","sidebar":"kusion"},{"id":"concepts/project/overview","path":"/docs/next/concepts/project/overview","sidebar":"kusion"},{"id":"concepts/spec","path":"/docs/next/concepts/spec","sidebar":"kusion"},{"id":"concepts/stack/configuration","path":"/docs/next/concepts/stack/configuration","sidebar":"kusion"},{"id":"concepts/stack/overview","path":"/docs/next/concepts/stack/overview","sidebar":"kusion"},{"id":"concepts/workspace","path":"/docs/next/concepts/workspace","sidebar":"kusion"},{"id":"configuration-walkthrough/base-override","path":"/docs/next/configuration-walkthrough/base-override","sidebar":"kusion"},{"id":"configuration-walkthrough/databse","path":"/docs/next/configuration-walkthrough/databse","sidebar":"kusion"},{"id":"configuration-walkthrough/kcl-basics","path":"/docs/next/configuration-walkthrough/kcl-basics","sidebar":"kusion"},{"id":"configuration-walkthrough/monitoring","path":"/docs/next/configuration-walkthrough/monitoring","sidebar":"kusion"},{"id":"configuration-walkthrough/networking","path":"/docs/next/configuration-walkthrough/networking","sidebar":"kusion"},{"id":"configuration-walkthrough/operational-rules","path":"/docs/next/configuration-walkthrough/operational-rules","sidebar":"kusion"},{"id":"configuration-walkthrough/overview","path":"/docs/next/configuration-walkthrough/overview","sidebar":"kusion"},{"id":"configuration-walkthrough/secret","path":"/docs/next/configuration-walkthrough/secret","sidebar":"kusion"},{"id":"configuration-walkthrough/workload","path":"/docs/next/configuration-walkthrough/workload","sidebar":"kusion"},{"id":"faq/install-error","path":"/docs/next/faq/install-error","sidebar":"kusion"},{"id":"faq/kcl","path":"/docs/next/faq/kcl","sidebar":"kusion"},{"id":"getting-started/deliver-quickstart","path":"/docs/next/getting-started/deliver-quickstart","sidebar":"kusion"},{"id":"getting-started/install-kusion","path":"/docs/next/getting-started/install-kusion","sidebar":"kusion"},{"id":"reference/commands/index","path":"/docs/next/reference/commands/","sidebar":"kusion"},{"id":"reference/commands/kusion-apply","path":"/docs/next/reference/commands/kusion-apply","sidebar":"kusion"},{"id":"reference/commands/kusion-config","path":"/docs/next/reference/commands/kusion-config","sidebar":"kusion"},{"id":"reference/commands/kusion-config-get","path":"/docs/next/reference/commands/kusion-config-get","sidebar":"kusion"},{"id":"reference/commands/kusion-config-list","path":"/docs/next/reference/commands/kusion-config-list","sidebar":"kusion"},{"id":"reference/commands/kusion-config-set","path":"/docs/next/reference/commands/kusion-config-set","sidebar":"kusion"},{"id":"reference/commands/kusion-config-unset","path":"/docs/next/reference/commands/kusion-config-unset","sidebar":"kusion"},{"id":"reference/commands/kusion-destroy","path":"/docs/next/reference/commands/kusion-destroy","sidebar":"kusion"},{"id":"reference/commands/kusion-generate","path":"/docs/next/reference/commands/kusion-generate","sidebar":"kusion"},{"id":"reference/commands/kusion-init","path":"/docs/next/reference/commands/kusion-init","sidebar":"kusion"},{"id":"reference/commands/kusion-mod","path":"/docs/next/reference/commands/kusion-mod","sidebar":"kusion"},{"id":"reference/commands/kusion-mod-init","path":"/docs/next/reference/commands/kusion-mod-init","sidebar":"kusion"},{"id":"reference/commands/kusion-mod-push","path":"/docs/next/reference/commands/kusion-mod-push","sidebar":"kusion"},{"id":"reference/commands/kusion-options","path":"/docs/next/reference/commands/kusion-options","sidebar":"kusion"},{"id":"reference/commands/kusion-preview","path":"/docs/next/reference/commands/kusion-preview","sidebar":"kusion"},{"id":"reference/commands/kusion-project","path":"/docs/next/reference/commands/kusion-project","sidebar":"kusion"},{"id":"reference/commands/kusion-project-create","path":"/docs/next/reference/commands/kusion-project-create","sidebar":"kusion"},{"id":"reference/commands/kusion-stack","path":"/docs/next/reference/commands/kusion-stack","sidebar":"kusion"},{"id":"reference/commands/kusion-stack-create","path":"/docs/next/reference/commands/kusion-stack-create","sidebar":"kusion"},{"id":"reference/commands/kusion-version","path":"/docs/next/reference/commands/kusion-version","sidebar":"kusion"},{"id":"reference/commands/kusion-workspace","path":"/docs/next/reference/commands/kusion-workspace","sidebar":"kusion"},{"id":"reference/commands/kusion-workspace-create","path":"/docs/next/reference/commands/kusion-workspace-create","sidebar":"kusion"},{"id":"reference/commands/kusion-workspace-delete","path":"/docs/next/reference/commands/kusion-workspace-delete","sidebar":"kusion"},{"id":"reference/commands/kusion-workspace-list","path":"/docs/next/reference/commands/kusion-workspace-list","sidebar":"kusion"},{"id":"reference/commands/kusion-workspace-show","path":"/docs/next/reference/commands/kusion-workspace-show","sidebar":"kusion"},{"id":"reference/commands/kusion-workspace-switch","path":"/docs/next/reference/commands/kusion-workspace-switch","sidebar":"kusion"},{"id":"reference/commands/kusion-workspace-update","path":"/docs/next/reference/commands/kusion-workspace-update","sidebar":"kusion"},{"id":"reference/modules/developer-schemas/app-configuration","path":"/docs/next/reference/modules/developer-schemas/app-configuration","sidebar":"kusion"},{"id":"reference/modules/developer-schemas/database/mysql","path":"/docs/next/reference/modules/developer-schemas/database/mysql","sidebar":"kusion"},{"id":"reference/modules/developer-schemas/database/postgres","path":"/docs/next/reference/modules/developer-schemas/database/postgres","sidebar":"kusion"},{"id":"reference/modules/developer-schemas/internal/common","path":"/docs/next/reference/modules/developer-schemas/internal/common","sidebar":"kusion"},{"id":"reference/modules/developer-schemas/internal/container/container","path":"/docs/next/reference/modules/developer-schemas/internal/container/","sidebar":"kusion"},{"id":"reference/modules/developer-schemas/internal/container/lifecycle/lifecycle","path":"/docs/next/reference/modules/developer-schemas/internal/container/lifecycle/","sidebar":"kusion"},{"id":"reference/modules/developer-schemas/internal/container/probe/probe","path":"/docs/next/reference/modules/developer-schemas/internal/container/probe/","sidebar":"kusion"},{"id":"reference/modules/developer-schemas/internal/secret/secret","path":"/docs/next/reference/modules/developer-schemas/internal/secret/","sidebar":"kusion"},{"id":"reference/modules/developer-schemas/monitoring/prometheus","path":"/docs/next/reference/modules/developer-schemas/monitoring/prometheus","sidebar":"kusion"},{"id":"reference/modules/developer-schemas/network/network","path":"/docs/next/reference/modules/developer-schemas/network/","sidebar":"kusion"},{"id":"reference/modules/developer-schemas/opsrule/opsrule","path":"/docs/next/reference/modules/developer-schemas/opsrule/","sidebar":"kusion"},{"id":"reference/modules/developer-schemas/workload/job","path":"/docs/next/reference/modules/developer-schemas/workload/job","sidebar":"kusion"},{"id":"reference/modules/developer-schemas/workload/service","path":"/docs/next/reference/modules/developer-schemas/workload/service","sidebar":"kusion"},{"id":"reference/modules/index","path":"/docs/next/reference/modules/","sidebar":"kusion"},{"id":"reference/modules/naming-conventions","path":"/docs/next/reference/modules/naming-conventions","sidebar":"kusion"},{"id":"reference/modules/workspace-configs/database/mysql","path":"/docs/next/reference/modules/workspace-configs/database/mysql","sidebar":"kusion"},{"id":"reference/modules/workspace-configs/database/postgres","path":"/docs/next/reference/modules/workspace-configs/database/postgres","sidebar":"kusion"},{"id":"reference/modules/workspace-configs/monitoring/prometheus","path":"/docs/next/reference/modules/workspace-configs/monitoring/prometheus","sidebar":"kusion"},{"id":"reference/modules/workspace-configs/networking/network","path":"/docs/next/reference/modules/workspace-configs/networking/network","sidebar":"kusion"},{"id":"reference/modules/workspace-configs/opsrule/opsrule","path":"/docs/next/reference/modules/workspace-configs/opsrule/","sidebar":"kusion"},{"id":"reference/modules/workspace-configs/workload/job","path":"/docs/next/reference/modules/workspace-configs/workload/job","sidebar":"kusion"},{"id":"reference/modules/workspace-configs/workload/service","path":"/docs/next/reference/modules/workspace-configs/workload/service","sidebar":"kusion"},{"id":"reference/roadmap","path":"/docs/next/reference/roadmap","sidebar":"kusion"},{"id":"user-guides/cloud-resources/database","path":"/docs/next/user-guides/cloud-resources/database","sidebar":"kusion"},{"id":"user-guides/cloud-resources/expose-service","path":"/docs/next/user-guides/cloud-resources/expose-service","sidebar":"kusion"},{"id":"user-guides/observability/prometheus","path":"/docs/next/user-guides/observability/prometheus","sidebar":"kusion"},{"id":"user-guides/secrets-management/using-cloud-secrets","path":"/docs/next/user-guides/secrets-management/using-cloud-secrets","sidebar":"kusion"},{"id":"user-guides/working-with-k8s/container","path":"/docs/next/user-guides/working-with-k8s/container","sidebar":"kusion"},{"id":"user-guides/working-with-k8s/deploy-application","path":"/docs/next/user-guides/working-with-k8s/deploy-application","sidebar":"kusion"},{"id":"user-guides/working-with-k8s/image-upgrade","path":"/docs/next/user-guides/working-with-k8s/image-upgrade","sidebar":"kusion"},{"id":"user-guides/working-with-k8s/job","path":"/docs/next/user-guides/working-with-k8s/job","sidebar":"kusion"},{"id":"user-guides/working-with-k8s/resource-spec","path":"/docs/next/user-guides/working-with-k8s/resource-spec","sidebar":"kusion"},{"id":"user-guides/working-with-k8s/service","path":"/docs/next/user-guides/working-with-k8s/service","sidebar":"kusion"},{"id":"user-guides/working-with-k8s/set-up-operational-rules","path":"/docs/next/user-guides/working-with-k8s/set-up-operational-rules","sidebar":"kusion"},{"id":"what-is-kusion/kusion-vs-x","path":"/docs/next/what-is-kusion/kusion-vs-x","sidebar":"kusion"},{"id":"what-is-kusion/overview","path":"/docs/next/","sidebar":"kusion"}],"draftIds":[],"sidebars":{"kusion":{"link":{"path":"/docs/next/","label":"what-is-kusion/overview"}}}},{"name":"v0.11","label":"v0.11","isLast":true,"path":"/docs","mainDocId":"what-is-kusion/overview","docs":[{"id":"concepts/app-configuration","path":"/docs/concepts/app-configuration","sidebar":"kusion"},{"id":"concepts/backend","path":"/docs/concepts/backend","sidebar":"kusion"},{"id":"concepts/configuration","path":"/docs/concepts/configuration","sidebar":"kusion"},{"id":"concepts/how-kusion-works","path":"/docs/concepts/how-kusion-works","sidebar":"kusion"},{"id":"concepts/kusion-module/app-dev-guide","path":"/docs/concepts/kusion-module/app-dev-guide","sidebar":"kusion"},{"id":"concepts/kusion-module/develop-guide","path":"/docs/concepts/kusion-module/develop-guide","sidebar":"kusion"},{"id":"concepts/kusion-module/overview","path":"/docs/concepts/kusion-module/overview","sidebar":"kusion"},{"id":"concepts/project/configuration","path":"/docs/concepts/project/configuration","sidebar":"kusion"},{"id":"concepts/project/overview","path":"/docs/concepts/project/overview","sidebar":"kusion"},{"id":"concepts/spec","path":"/docs/concepts/spec","sidebar":"kusion"},{"id":"concepts/stack/configuration","path":"/docs/concepts/stack/configuration","sidebar":"kusion"},{"id":"concepts/stack/overview","path":"/docs/concepts/stack/overview","sidebar":"kusion"},{"id":"concepts/workspace","path":"/docs/concepts/workspace","sidebar":"kusion"},{"id":"configuration-walkthrough/base-override","path":"/docs/configuration-walkthrough/base-override","sidebar":"kusion"},{"id":"configuration-walkthrough/databse","path":"/docs/configuration-walkthrough/databse","sidebar":"kusion"},{"id":"configuration-walkthrough/kcl-basics","path":"/docs/configuration-walkthrough/kcl-basics","sidebar":"kusion"},{"id":"configuration-walkthrough/monitoring","path":"/docs/configuration-walkthrough/monitoring","sidebar":"kusion"},{"id":"configuration-walkthrough/networking","path":"/docs/configuration-walkthrough/networking","sidebar":"kusion"},{"id":"configuration-walkthrough/operational-rules","path":"/docs/configuration-walkthrough/operational-rules","sidebar":"kusion"},{"id":"configuration-walkthrough/overview","path":"/docs/configuration-walkthrough/overview","sidebar":"kusion"},{"id":"configuration-walkthrough/secret","path":"/docs/configuration-walkthrough/secret","sidebar":"kusion"},{"id":"configuration-walkthrough/workload","path":"/docs/configuration-walkthrough/workload","sidebar":"kusion"},{"id":"faq/install-error","path":"/docs/faq/install-error","sidebar":"kusion"},{"id":"faq/kcl","path":"/docs/faq/kcl","sidebar":"kusion"},{"id":"getting-started/deliver-quickstart","path":"/docs/getting-started/deliver-quickstart","sidebar":"kusion"},{"id":"getting-started/install-kusion","path":"/docs/getting-started/install-kusion","sidebar":"kusion"},{"id":"reference/commands/index","path":"/docs/reference/commands/","sidebar":"kusion"},{"id":"reference/commands/kusion-apply","path":"/docs/reference/commands/kusion-apply","sidebar":"kusion"},{"id":"reference/commands/kusion-config","path":"/docs/reference/commands/kusion-config","sidebar":"kusion"},{"id":"reference/commands/kusion-config-get","path":"/docs/reference/commands/kusion-config-get","sidebar":"kusion"},{"id":"reference/commands/kusion-config-list","path":"/docs/reference/commands/kusion-config-list","sidebar":"kusion"},{"id":"reference/commands/kusion-config-set","path":"/docs/reference/commands/kusion-config-set","sidebar":"kusion"},{"id":"reference/commands/kusion-config-unset","path":"/docs/reference/commands/kusion-config-unset","sidebar":"kusion"},{"id":"reference/commands/kusion-destroy","path":"/docs/reference/commands/kusion-destroy","sidebar":"kusion"},{"id":"reference/commands/kusion-generate","path":"/docs/reference/commands/kusion-generate","sidebar":"kusion"},{"id":"reference/commands/kusion-init","path":"/docs/reference/commands/kusion-init","sidebar":"kusion"},{"id":"reference/commands/kusion-mod","path":"/docs/reference/commands/kusion-mod","sidebar":"kusion"},{"id":"reference/commands/kusion-mod-init","path":"/docs/reference/commands/kusion-mod-init","sidebar":"kusion"},{"id":"reference/commands/kusion-mod-push","path":"/docs/reference/commands/kusion-mod-push","sidebar":"kusion"},{"id":"reference/commands/kusion-options","path":"/docs/reference/commands/kusion-options","sidebar":"kusion"},{"id":"reference/commands/kusion-preview","path":"/docs/reference/commands/kusion-preview","sidebar":"kusion"},{"id":"reference/commands/kusion-project","path":"/docs/reference/commands/kusion-project","sidebar":"kusion"},{"id":"reference/commands/kusion-project-create","path":"/docs/reference/commands/kusion-project-create","sidebar":"kusion"},{"id":"reference/commands/kusion-stack","path":"/docs/reference/commands/kusion-stack","sidebar":"kusion"},{"id":"reference/commands/kusion-stack-create","path":"/docs/reference/commands/kusion-stack-create","sidebar":"kusion"},{"id":"reference/commands/kusion-version","path":"/docs/reference/commands/kusion-version","sidebar":"kusion"},{"id":"reference/commands/kusion-workspace","path":"/docs/reference/commands/kusion-workspace","sidebar":"kusion"},{"id":"reference/commands/kusion-workspace-create","path":"/docs/reference/commands/kusion-workspace-create","sidebar":"kusion"},{"id":"reference/commands/kusion-workspace-delete","path":"/docs/reference/commands/kusion-workspace-delete","sidebar":"kusion"},{"id":"reference/commands/kusion-workspace-list","path":"/docs/reference/commands/kusion-workspace-list","sidebar":"kusion"},{"id":"reference/commands/kusion-workspace-show","path":"/docs/reference/commands/kusion-workspace-show","sidebar":"kusion"},{"id":"reference/commands/kusion-workspace-switch","path":"/docs/reference/commands/kusion-workspace-switch","sidebar":"kusion"},{"id":"reference/commands/kusion-workspace-update","path":"/docs/reference/commands/kusion-workspace-update","sidebar":"kusion"},{"id":"reference/modules/developer-schemas/app-configuration","path":"/docs/reference/modules/developer-schemas/app-configuration","sidebar":"kusion"},{"id":"reference/modules/developer-schemas/database/mysql","path":"/docs/reference/modules/developer-schemas/database/mysql","sidebar":"kusion"},{"id":"reference/modules/developer-schemas/database/postgres","path":"/docs/reference/modules/developer-schemas/database/postgres","sidebar":"kusion"},{"id":"reference/modules/developer-schemas/internal/common","path":"/docs/reference/modules/developer-schemas/internal/common","sidebar":"kusion"},{"id":"reference/modules/developer-schemas/internal/container/container","path":"/docs/reference/modules/developer-schemas/internal/container/","sidebar":"kusion"},{"id":"reference/modules/developer-schemas/internal/container/lifecycle/lifecycle","path":"/docs/reference/modules/developer-schemas/internal/container/lifecycle/","sidebar":"kusion"},{"id":"reference/modules/developer-schemas/internal/container/probe/probe","path":"/docs/reference/modules/developer-schemas/internal/container/probe/","sidebar":"kusion"},{"id":"reference/modules/developer-schemas/internal/secret/secret","path":"/docs/reference/modules/developer-schemas/internal/secret/","sidebar":"kusion"},{"id":"reference/modules/developer-schemas/monitoring/prometheus","path":"/docs/reference/modules/developer-schemas/monitoring/prometheus","sidebar":"kusion"},{"id":"reference/modules/developer-schemas/network/network","path":"/docs/reference/modules/developer-schemas/network/","sidebar":"kusion"},{"id":"reference/modules/developer-schemas/opsrule/opsrule","path":"/docs/reference/modules/developer-schemas/opsrule/","sidebar":"kusion"},{"id":"reference/modules/developer-schemas/workload/job","path":"/docs/reference/modules/developer-schemas/workload/job","sidebar":"kusion"},{"id":"reference/modules/developer-schemas/workload/service","path":"/docs/reference/modules/developer-schemas/workload/service","sidebar":"kusion"},{"id":"reference/modules/index","path":"/docs/reference/modules/","sidebar":"kusion"},{"id":"reference/modules/naming-conventions","path":"/docs/reference/modules/naming-conventions","sidebar":"kusion"},{"id":"reference/modules/workspace-configs/database/mysql","path":"/docs/reference/modules/workspace-configs/database/mysql","sidebar":"kusion"},{"id":"reference/modules/workspace-configs/database/postgres","path":"/docs/reference/modules/workspace-configs/database/postgres","sidebar":"kusion"},{"id":"reference/modules/workspace-configs/monitoring/prometheus","path":"/docs/reference/modules/workspace-configs/monitoring/prometheus","sidebar":"kusion"},{"id":"reference/modules/workspace-configs/networking/network","path":"/docs/reference/modules/workspace-configs/networking/network","sidebar":"kusion"},{"id":"reference/modules/workspace-configs/opsrule/opsrule","path":"/docs/reference/modules/workspace-configs/opsrule/","sidebar":"kusion"},{"id":"reference/modules/workspace-configs/workload/job","path":"/docs/reference/modules/workspace-configs/workload/job","sidebar":"kusion"},{"id":"reference/modules/workspace-configs/workload/service","path":"/docs/reference/modules/workspace-configs/workload/service","sidebar":"kusion"},{"id":"reference/roadmap","path":"/docs/reference/roadmap","sidebar":"kusion"},{"id":"user-guides/cloud-resources/database","path":"/docs/user-guides/cloud-resources/database","sidebar":"kusion"},{"id":"user-guides/cloud-resources/expose-service","path":"/docs/user-guides/cloud-resources/expose-service","sidebar":"kusion"},{"id":"user-guides/observability/prometheus","path":"/docs/user-guides/observability/prometheus","sidebar":"kusion"},{"id":"user-guides/secrets-management/using-cloud-secrets","path":"/docs/user-guides/secrets-management/using-cloud-secrets","sidebar":"kusion"},{"id":"user-guides/working-with-k8s/container","path":"/docs/user-guides/working-with-k8s/container","sidebar":"kusion"},{"id":"user-guides/working-with-k8s/deploy-application","path":"/docs/user-guides/working-with-k8s/deploy-application","sidebar":"kusion"},{"id":"user-guides/working-with-k8s/image-upgrade","path":"/docs/user-guides/working-with-k8s/image-upgrade","sidebar":"kusion"},{"id":"user-guides/working-with-k8s/job","path":"/docs/user-guides/working-with-k8s/job","sidebar":"kusion"},{"id":"user-guides/working-with-k8s/resource-spec","path":"/docs/user-guides/working-with-k8s/resource-spec","sidebar":"kusion"},{"id":"user-guides/working-with-k8s/service","path":"/docs/user-guides/working-with-k8s/service","sidebar":"kusion"},{"id":"user-guides/working-with-k8s/set-up-operational-rules","path":"/docs/user-guides/working-with-k8s/set-up-operational-rules","sidebar":"kusion"},{"id":"what-is-kusion/kusion-vs-x","path":"/docs/what-is-kusion/kusion-vs-x","sidebar":"kusion"},{"id":"what-is-kusion/overview","path":"/docs/","sidebar":"kusion"}],"draftIds":[],"sidebars":{"kusion":{"link":{"path":"/docs/","label":"version-v0.11/what-is-kusion/overview"}}}},{"name":"v0.10","label":"v0.10","isLast":false,"path":"/docs/v0.10","mainDocId":"what-is-kusion/overview","docs":[{"id":"concepts/app-configuration","path":"/docs/v0.10/concepts/app-configuration","sidebar":"kusion"},{"id":"concepts/backend-configuration","path":"/docs/v0.10/concepts/backend-configuration","sidebar":"kusion"},{"id":"concepts/how-kusion-works","path":"/docs/v0.10/concepts/how-kusion-works","sidebar":"kusion"},{"id":"concepts/intent","path":"/docs/v0.10/concepts/intent","sidebar":"kusion"},{"id":"concepts/kusion-module","path":"/docs/v0.10/concepts/kusion-module","sidebar":"kusion"},{"id":"concepts/project/configuration","path":"/docs/v0.10/concepts/project/configuration","sidebar":"kusion"},{"id":"concepts/project/overview","path":"/docs/v0.10/concepts/project/overview","sidebar":"kusion"},{"id":"concepts/stack/configuration","path":"/docs/v0.10/concepts/stack/configuration","sidebar":"kusion"},{"id":"concepts/stack/overview","path":"/docs/v0.10/concepts/stack/overview","sidebar":"kusion"},{"id":"concepts/workspace","path":"/docs/v0.10/concepts/workspace","sidebar":"kusion"},{"id":"configuration-walkthrough/base-override","path":"/docs/v0.10/configuration-walkthrough/base-override","sidebar":"kusion"},{"id":"configuration-walkthrough/databse","path":"/docs/v0.10/configuration-walkthrough/databse","sidebar":"kusion"},{"id":"configuration-walkthrough/kcl-basics","path":"/docs/v0.10/configuration-walkthrough/kcl-basics","sidebar":"kusion"},{"id":"configuration-walkthrough/monitoring","path":"/docs/v0.10/configuration-walkthrough/monitoring","sidebar":"kusion"},{"id":"configuration-walkthrough/networking","path":"/docs/v0.10/configuration-walkthrough/networking","sidebar":"kusion"},{"id":"configuration-walkthrough/operational-rules","path":"/docs/v0.10/configuration-walkthrough/operational-rules","sidebar":"kusion"},{"id":"configuration-walkthrough/overview","path":"/docs/v0.10/configuration-walkthrough/overview","sidebar":"kusion"},{"id":"configuration-walkthrough/secret","path":"/docs/v0.10/configuration-walkthrough/secret","sidebar":"kusion"},{"id":"configuration-walkthrough/workload","path":"/docs/v0.10/configuration-walkthrough/workload","sidebar":"kusion"},{"id":"faq/install-error","path":"/docs/v0.10/faq/install-error","sidebar":"kusion"},{"id":"faq/kcl","path":"/docs/v0.10/faq/kcl","sidebar":"kusion"},{"id":"getting-started/deliver-wordpress","path":"/docs/v0.10/getting-started/deliver-wordpress","sidebar":"kusion"},{"id":"getting-started/install-kusion","path":"/docs/v0.10/getting-started/install-kusion","sidebar":"kusion"},{"id":"reference/commands/index","path":"/docs/v0.10/reference/commands/","sidebar":"kusion"},{"id":"reference/commands/kusion-apply","path":"/docs/v0.10/reference/commands/kusion-apply","sidebar":"kusion"},{"id":"reference/commands/kusion-build","path":"/docs/v0.10/reference/commands/kusion-build","sidebar":"kusion"},{"id":"reference/commands/kusion-compile","path":"/docs/v0.10/reference/commands/kusion-compile","sidebar":"kusion"},{"id":"reference/commands/kusion-destroy","path":"/docs/v0.10/reference/commands/kusion-destroy","sidebar":"kusion"},{"id":"reference/commands/kusion-init","path":"/docs/v0.10/reference/commands/kusion-init","sidebar":"kusion"},{"id":"reference/commands/kusion-preview","path":"/docs/v0.10/reference/commands/kusion-preview","sidebar":"kusion"},{"id":"reference/commands/kusion-version","path":"/docs/v0.10/reference/commands/kusion-version","sidebar":"kusion"},{"id":"reference/commands/kusion-workspace","path":"/docs/v0.10/reference/commands/kusion-workspace","sidebar":"kusion"},{"id":"reference/commands/kusion-workspace-create","path":"/docs/v0.10/reference/commands/kusion-workspace-create","sidebar":"kusion"},{"id":"reference/commands/kusion-workspace-delete","path":"/docs/v0.10/reference/commands/kusion-workspace-delete","sidebar":"kusion"},{"id":"reference/commands/kusion-workspace-list","path":"/docs/v0.10/reference/commands/kusion-workspace-list","sidebar":"kusion"},{"id":"reference/commands/kusion-workspace-show","path":"/docs/v0.10/reference/commands/kusion-workspace-show","sidebar":"kusion"},{"id":"reference/commands/kusion-workspace-update","path":"/docs/v0.10/reference/commands/kusion-workspace-update","sidebar":"kusion"},{"id":"reference/modules/catalog-models/app-configuration","path":"/docs/v0.10/reference/modules/catalog-models/app-configuration","sidebar":"kusion"},{"id":"reference/modules/catalog-models/database/mysql","path":"/docs/v0.10/reference/modules/catalog-models/database/mysql","sidebar":"kusion"},{"id":"reference/modules/catalog-models/database/postgres","path":"/docs/v0.10/reference/modules/catalog-models/database/postgres","sidebar":"kusion"},{"id":"reference/modules/catalog-models/internal/common","path":"/docs/v0.10/reference/modules/catalog-models/internal/common","sidebar":"kusion"},{"id":"reference/modules/catalog-models/internal/container/container","path":"/docs/v0.10/reference/modules/catalog-models/internal/container/","sidebar":"kusion"},{"id":"reference/modules/catalog-models/internal/container/lifecycle/lifecycle","path":"/docs/v0.10/reference/modules/catalog-models/internal/container/lifecycle/","sidebar":"kusion"},{"id":"reference/modules/catalog-models/internal/container/probe/probe","path":"/docs/v0.10/reference/modules/catalog-models/internal/container/probe/","sidebar":"kusion"},{"id":"reference/modules/catalog-models/internal/network/port","path":"/docs/v0.10/reference/modules/catalog-models/internal/network/port","sidebar":"kusion"},{"id":"reference/modules/catalog-models/internal/secret/secret","path":"/docs/v0.10/reference/modules/catalog-models/internal/secret/","sidebar":"kusion"},{"id":"reference/modules/catalog-models/monitoring/prometheus","path":"/docs/v0.10/reference/modules/catalog-models/monitoring/prometheus","sidebar":"kusion"},{"id":"reference/modules/catalog-models/trait/opsrule","path":"/docs/v0.10/reference/modules/catalog-models/trait/opsrule","sidebar":"kusion"},{"id":"reference/modules/catalog-models/workload/job","path":"/docs/v0.10/reference/modules/catalog-models/workload/job","sidebar":"kusion"},{"id":"reference/modules/catalog-models/workload/service","path":"/docs/v0.10/reference/modules/catalog-models/workload/service","sidebar":"kusion"},{"id":"reference/modules/index","path":"/docs/v0.10/reference/modules/","sidebar":"kusion"},{"id":"reference/modules/naming-conventions","path":"/docs/v0.10/reference/modules/naming-conventions","sidebar":"kusion"},{"id":"reference/modules/workspace-configs/database/mysql","path":"/docs/v0.10/reference/modules/workspace-configs/database/mysql","sidebar":"kusion"},{"id":"reference/modules/workspace-configs/database/postgres","path":"/docs/v0.10/reference/modules/workspace-configs/database/postgres","sidebar":"kusion"},{"id":"reference/modules/workspace-configs/monitoring/prometheus","path":"/docs/v0.10/reference/modules/workspace-configs/monitoring/prometheus","sidebar":"kusion"},{"id":"reference/modules/workspace-configs/networking/port","path":"/docs/v0.10/reference/modules/workspace-configs/networking/port","sidebar":"kusion"},{"id":"reference/modules/workspace-configs/trait/opsrule","path":"/docs/v0.10/reference/modules/workspace-configs/trait/opsrule","sidebar":"kusion"},{"id":"reference/modules/workspace-configs/workload/job","path":"/docs/v0.10/reference/modules/workspace-configs/workload/job","sidebar":"kusion"},{"id":"reference/modules/workspace-configs/workload/service","path":"/docs/v0.10/reference/modules/workspace-configs/workload/service","sidebar":"kusion"},{"id":"reference/roadmap","path":"/docs/v0.10/reference/roadmap","sidebar":"kusion"},{"id":"user-guides/cloud-resources/database","path":"/docs/v0.10/user-guides/cloud-resources/database","sidebar":"kusion"},{"id":"user-guides/cloud-resources/expose-service","path":"/docs/v0.10/user-guides/cloud-resources/expose-service","sidebar":"kusion"},{"id":"user-guides/github-actions/deploy-application-via-github-actions","path":"/docs/v0.10/user-guides/github-actions/deploy-application-via-github-actions","sidebar":"kusion"},{"id":"user-guides/observability/prometheus","path":"/docs/v0.10/user-guides/observability/prometheus","sidebar":"kusion"},{"id":"user-guides/secrets-management/using-cloud-secrets","path":"/docs/v0.10/user-guides/secrets-management/using-cloud-secrets","sidebar":"kusion"},{"id":"user-guides/working-with-k8s/container","path":"/docs/v0.10/user-guides/working-with-k8s/container","sidebar":"kusion"},{"id":"user-guides/working-with-k8s/deploy-application","path":"/docs/v0.10/user-guides/working-with-k8s/deploy-application","sidebar":"kusion"},{"id":"user-guides/working-with-k8s/image-upgrade","path":"/docs/v0.10/user-guides/working-with-k8s/image-upgrade","sidebar":"kusion"},{"id":"user-guides/working-with-k8s/job","path":"/docs/v0.10/user-guides/working-with-k8s/job","sidebar":"kusion"},{"id":"user-guides/working-with-k8s/resource-spec","path":"/docs/v0.10/user-guides/working-with-k8s/resource-spec","sidebar":"kusion"},{"id":"user-guides/working-with-k8s/service","path":"/docs/v0.10/user-guides/working-with-k8s/service","sidebar":"kusion"},{"id":"user-guides/working-with-k8s/set-up-operational-rules","path":"/docs/v0.10/user-guides/working-with-k8s/set-up-operational-rules","sidebar":"kusion"},{"id":"what-is-kusion/kusion-vs-x","path":"/docs/v0.10/what-is-kusion/kusion-vs-x","sidebar":"kusion"},{"id":"what-is-kusion/overview","path":"/docs/v0.10/","sidebar":"kusion"}],"draftIds":[],"sidebars":{"kusion":{"link":{"path":"/docs/v0.10/","label":"version-v0.10/what-is-kusion/overview"}}}},{"name":"v0.9","label":"v0.9","isLast":false,"path":"/docs/v0.9","mainDocId":"intro/overview","docs":[{"id":"concepts/appconfiguration","path":"/docs/v0.9/concepts/appconfiguration","sidebar":"kusion"},{"id":"concepts/arch","path":"/docs/v0.9/concepts/arch","sidebar":"kusion"},{"id":"concepts/glossary","path":"/docs/v0.9/concepts/glossary","sidebar":"kusion"},{"id":"concepts/index","path":"/docs/v0.9/concepts/","sidebar":"kusion"},{"id":"concepts/intent","path":"/docs/v0.9/concepts/intent","sidebar":"kusion"},{"id":"concepts/kusion","path":"/docs/v0.9/concepts/kusion","sidebar":"kusion"},{"id":"config-walkthrough/base_override","path":"/docs/v0.9/config-walkthrough/base_override","sidebar":"kusion"},{"id":"config-walkthrough/database","path":"/docs/v0.9/config-walkthrough/database","sidebar":"kusion"},{"id":"config-walkthrough/kcl_basics","path":"/docs/v0.9/config-walkthrough/kcl_basics","sidebar":"kusion"},{"id":"config-walkthrough/monitoring","path":"/docs/v0.9/config-walkthrough/monitoring","sidebar":"kusion"},{"id":"config-walkthrough/networking","path":"/docs/v0.9/config-walkthrough/networking","sidebar":"kusion"},{"id":"config-walkthrough/operational_rules","path":"/docs/v0.9/config-walkthrough/operational_rules","sidebar":"kusion"},{"id":"config-walkthrough/overview","path":"/docs/v0.9/config-walkthrough/overview","sidebar":"kusion"},{"id":"config-walkthrough/secret","path":"/docs/v0.9/config-walkthrough/secret","sidebar":"kusion"},{"id":"config-walkthrough/workload","path":"/docs/v0.9/config-walkthrough/workload","sidebar":"kusion"},{"id":"getting-started/deliver-wordpress","path":"/docs/v0.9/getting-started/deliver-wordpress","sidebar":"kusion"},{"id":"getting-started/getting-started","path":"/docs/v0.9/getting-started/","sidebar":"kusion"},{"id":"getting-started/install-kusion","path":"/docs/v0.9/getting-started/install-kusion","sidebar":"kusion"},{"id":"guides/cloud-resources/database","path":"/docs/v0.9/guides/cloud-resources/database","sidebar":"kusion"},{"id":"guides/cloud-resources/expose-service","path":"/docs/v0.9/guides/cloud-resources/expose-service","sidebar":"kusion"},{"id":"guides/github-actions/deploy-application-securely-and-efficiently-via-github-actions","path":"/docs/v0.9/guides/github-actions/deploy-application-securely-and-efficiently-via-github-actions","sidebar":"kusion"},{"id":"guides/guides","path":"/docs/v0.9/guides/","sidebar":"kusion"},{"id":"guides/observability/prometheus","path":"/docs/v0.9/guides/observability/prometheus","sidebar":"kusion"},{"id":"guides/working-with-k8s/container","path":"/docs/v0.9/guides/working-with-k8s/container","sidebar":"kusion"},{"id":"guides/working-with-k8s/deploy-application","path":"/docs/v0.9/guides/working-with-k8s/deploy-application","sidebar":"kusion"},{"id":"guides/working-with-k8s/image-upgrade","path":"/docs/v0.9/guides/working-with-k8s/image-upgrade","sidebar":"kusion"},{"id":"guides/working-with-k8s/index","path":"/docs/v0.9/guides/working-with-k8s/","sidebar":"kusion"},{"id":"guides/working-with-k8s/resource-spec","path":"/docs/v0.9/guides/working-with-k8s/resource-spec","sidebar":"kusion"},{"id":"guides/working-with-k8s/service","path":"/docs/v0.9/guides/working-with-k8s/service","sidebar":"kusion"},{"id":"intro/kusion-vs-x","path":"/docs/v0.9/intro/kusion-vs-x","sidebar":"kusion"},{"id":"intro/overview","path":"/docs/v0.9/","sidebar":"kusion"},{"id":"reference/cli/backend/backend-configuration","path":"/docs/v0.9/reference/cli/backend/backend-configuration","sidebar":"kusion"},{"id":"reference/cli/index","path":"/docs/v0.9/reference/cli/","sidebar":"kusion"},{"id":"reference/cli/kusion/index","path":"/docs/v0.9/reference/cli/kusion/","sidebar":"kusion"},{"id":"reference/cli/kusion/kusion_apply","path":"/docs/v0.9/reference/cli/kusion/kusion_apply","sidebar":"kusion"},{"id":"reference/cli/kusion/kusion_build","path":"/docs/v0.9/reference/cli/kusion/kusion_build","sidebar":"kusion"},{"id":"reference/cli/kusion/kusion_compile","path":"/docs/v0.9/reference/cli/kusion/kusion_compile","sidebar":"kusion"},{"id":"reference/cli/kusion/kusion_destroy","path":"/docs/v0.9/reference/cli/kusion/kusion_destroy","sidebar":"kusion"},{"id":"reference/cli/kusion/kusion_init","path":"/docs/v0.9/reference/cli/kusion/kusion_init","sidebar":"kusion"},{"id":"reference/cli/kusion/kusion_preview","path":"/docs/v0.9/reference/cli/kusion/kusion_preview","sidebar":"kusion"},{"id":"reference/cli/kusion/kusion_version","path":"/docs/v0.9/reference/cli/kusion/kusion_version","sidebar":"kusion"},{"id":"reference/model/catalog_models/database/doc_database","path":"/docs/v0.9/reference/model/catalog_models/database/doc_database","sidebar":"kusion"},{"id":"reference/model/catalog_models/doc_app_configuration","path":"/docs/v0.9/reference/model/catalog_models/doc_app_configuration","sidebar":"kusion"},{"id":"reference/model/catalog_models/internal/container/doc_container","path":"/docs/v0.9/reference/model/catalog_models/internal/container/doc_container","sidebar":"kusion"},{"id":"reference/model/catalog_models/internal/container/lifecycle/doc_lifecycle","path":"/docs/v0.9/reference/model/catalog_models/internal/container/lifecycle/doc_lifecycle","sidebar":"kusion"},{"id":"reference/model/catalog_models/internal/container/probe/doc_probe","path":"/docs/v0.9/reference/model/catalog_models/internal/container/probe/doc_probe","sidebar":"kusion"},{"id":"reference/model/catalog_models/internal/doc_common","path":"/docs/v0.9/reference/model/catalog_models/internal/doc_common","sidebar":"kusion"},{"id":"reference/model/catalog_models/internal/network/doc_port","path":"/docs/v0.9/reference/model/catalog_models/internal/network/doc_port","sidebar":"kusion"},{"id":"reference/model/catalog_models/internal/secret/doc_secret","path":"/docs/v0.9/reference/model/catalog_models/internal/secret/doc_secret","sidebar":"kusion"},{"id":"reference/model/catalog_models/monitoring/doc_prometheus","path":"/docs/v0.9/reference/model/catalog_models/monitoring/doc_prometheus","sidebar":"kusion"},{"id":"reference/model/catalog_models/trait/doc_opsrule","path":"/docs/v0.9/reference/model/catalog_models/trait/doc_opsrule","sidebar":"kusion"},{"id":"reference/model/catalog_models/workload/doc_job","path":"/docs/v0.9/reference/model/catalog_models/workload/doc_job","sidebar":"kusion"},{"id":"reference/model/catalog_models/workload/doc_service","path":"/docs/v0.9/reference/model/catalog_models/workload/doc_service","sidebar":"kusion"},{"id":"reference/model/index","path":"/docs/v0.9/reference/model/","sidebar":"kusion"},{"id":"reference/model/naming-conventions","path":"/docs/v0.9/reference/model/naming-conventions","sidebar":"kusion"},{"id":"reference/model/overview","path":"/docs/v0.9/reference/model/overview","sidebar":"kusion"},{"id":"reference/model/project-stack-config-items","path":"/docs/v0.9/reference/model/project-stack-config-items","sidebar":"kusion"},{"id":"reference/roadmap","path":"/docs/v0.9/reference/roadmap","sidebar":"kusion"},{"id":"support/install-error","path":"/docs/v0.9/support/install-error","sidebar":"kusion"},{"id":"support/kcl","path":"/docs/v0.9/support/kcl","sidebar":"kusion"},{"id":"support/support","path":"/docs/v0.9/support/","sidebar":"kusion"}],"draftIds":[],"sidebars":{"kusion":{"link":{"path":"/docs/v0.9/","label":"Overview"}}}}],"breadcrumbs":true},"ctrlmesh":{"path":"/ctrlmesh","versions":[{"name":"current","label":"v0.2 \ud83d\udea7","isLast":false,"path":"/ctrlmesh/next","mainDocId":"intro/intro","docs":[{"id":"concepts/concepts","path":"/ctrlmesh/next/concepts/","sidebar":"ctrlmesh"},{"id":"faq/faq","path":"/ctrlmesh/next/faq/","sidebar":"ctrlmesh"},{"id":"intro/intro","path":"/ctrlmesh/next/intro/","sidebar":"ctrlmesh"},{"id":"started/install","path":"/ctrlmesh/next/started/install","sidebar":"ctrlmesh"},{"id":"started/try","path":"/ctrlmesh/next/started/try","sidebar":"ctrlmesh"}],"draftIds":[],"sidebars":{"ctrlmesh":{"link":{"path":"/ctrlmesh/next/intro/","label":"Introduction"}}}},{"name":"v0.1","label":"v0.1","isLast":true,"path":"/ctrlmesh","mainDocId":"intro/intro","docs":[{"id":"concepts/concepts","path":"/ctrlmesh/concepts/","sidebar":"ctrlmesh"},{"id":"faq/faq","path":"/ctrlmesh/faq/","sidebar":"ctrlmesh"},{"id":"intro/intro","path":"/ctrlmesh/intro/","sidebar":"ctrlmesh"},{"id":"started/install","path":"/ctrlmesh/started/install","sidebar":"ctrlmesh"},{"id":"started/try","path":"/ctrlmesh/started/try","sidebar":"ctrlmesh"}],"draftIds":[],"sidebars":{"ctrlmesh":{"link":{"path":"/ctrlmesh/intro/","label":"Introduction"}}}}],"breadcrumbs":true},"community":{"path":"/community","versions":[{"name":"current","label":"Next","isLast":true,"path":"/community","mainDocId":"intro/intro","docs":[{"id":"intro/intro","path":"/community/intro/","sidebar":"community"}],"draftIds":[],"sidebars":{"community":{"link":{"path":"/community/intro/","label":"Community"}}}}],"breadcrumbs":true},"operating":{"path":"/operating","versions":[{"name":"current","label":"v0.4 \ud83d\udea7","isLast":false,"path":"/operating/next","mainDocId":"introduction/introduction","docs":[{"id":"concepts/podopslifecycle","path":"/operating/next/concepts/podopslifecycle","sidebar":"operating"},{"id":"introduction/introduction","path":"/operating/next/introduction/","sidebar":"operating"},{"id":"manuals/collaset","path":"/operating/next/manuals/collaset","sidebar":"operating"},{"id":"manuals/poddecoration","path":"/operating/next/manuals/poddecoration","sidebar":"operating"},{"id":"manuals/podtransitionrule","path":"/operating/next/manuals/podtransitionrule","sidebar":"operating"},{"id":"manuals/resourceconsist","path":"/operating/next/manuals/resourceconsist","sidebar":"operating"},{"id":"started/demo-graceful-operation","path":"/operating/next/started/demo-graceful-operation","sidebar":"operating"},{"id":"started/install","path":"/operating/next/started/install","sidebar":"operating"}],"draftIds":[],"sidebars":{"operating":{"link":{"path":"/operating/next/introduction/","label":"Introduction"}}}},{"name":"v0.3","label":"v0.3","isLast":true,"path":"/operating","mainDocId":"introduction/introduction","docs":[{"id":"concepts/podopslifecycle","path":"/operating/concepts/podopslifecycle","sidebar":"operating"},{"id":"introduction/introduction","path":"/operating/introduction/","sidebar":"operating"},{"id":"manuals/collaset","path":"/operating/manuals/collaset","sidebar":"operating"},{"id":"manuals/poddecoration","path":"/operating/manuals/poddecoration","sidebar":"operating"},{"id":"manuals/podtransitionrule","path":"/operating/manuals/podtransitionrule","sidebar":"operating"},{"id":"manuals/resourceconsist","path":"/operating/manuals/resourceconsist","sidebar":"operating"},{"id":"started/demo-graceful-operation","path":"/operating/started/demo-graceful-operation","sidebar":"operating"},{"id":"started/install","path":"/operating/started/install","sidebar":"operating"}],"draftIds":[],"sidebars":{"operating":{"link":{"path":"/operating/introduction/","label":"Introduction"}}}}],"breadcrumbs":true}}}'),s=JSON.parse('{"defaultLocale":"en","locales":["en"],"path":"i18n","currentLocale":"en","localeConfigs":{"en":{"label":"English","direction":"ltr","htmlLang":"en","calendar":"gregory","path":"en"}}}');var i=t(57529);const c=JSON.parse('{"docusaurusVersion":"2.4.1","siteVersion":"0.1.0","pluginVersions":{"docusaurus-plugin-content-docs":{"type":"package","name":"@docusaurus/plugin-content-docs","version":"2.4.1"},"docusaurus-plugin-content-blog":{"type":"package","name":"@docusaurus/plugin-content-blog","version":"2.4.1"},"docusaurus-plugin-content-pages":{"type":"package","name":"@docusaurus/plugin-content-pages","version":"2.4.1"},"docusaurus-plugin-google-gtag":{"type":"package","name":"@docusaurus/plugin-google-gtag","version":"2.4.1"},"docusaurus-plugin-sitemap":{"type":"package","name":"@docusaurus/plugin-sitemap","version":"2.4.1"},"docusaurus-theme-classic":{"type":"package","name":"@docusaurus/theme-classic","version":"2.4.1"},"docusaurus-theme-search-algolia":{"type":"package","name":"@docusaurus/theme-search-algolia","version":"2.4.1"}}}'),l={siteConfig:r.default,siteMetadata:c,globalData:a,i18n:s,codeTranslations:i},d=o.createContext(l);function u(e){let{children:n}=e;return o.createElement(d.Provider,{value:l},n)}},44763:(e,n,t)=>{"use strict";t.d(n,{Z:()=>p});var o=t(67294),r=t(10412),a=t(35742),s=t(18780),i=t(83514);function c(e){let{error:n,tryAgain:t}=e;return o.createElement("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",minHeight:"100vh",width:"100%",maxWidth:"80ch",fontSize:"20px",margin:"0 auto",padding:"1rem"}},o.createElement("h1",{style:{fontSize:"3rem"}},"This page crashed"),o.createElement("button",{type:"button",onClick:t,style:{margin:"1rem 0",fontSize:"2rem",cursor:"pointer",borderRadius:20,padding:"1rem"}},"Try again"),o.createElement(l,{error:n}))}function l(e){let{error:n}=e;const t=(0,s.getErrorCausalChain)(n).map((e=>e.message)).join("\n\nCause:\n");return o.createElement("p",{style:{whiteSpace:"pre-wrap"}},t)}function d(e){let{error:n,tryAgain:t}=e;return o.createElement(p,{fallback:()=>o.createElement(c,{error:n,tryAgain:t})},o.createElement(a.Z,null,o.createElement("title",null,"Page Error")),o.createElement(i.Z,null,o.createElement(c,{error:n,tryAgain:t})))}const u=e=>o.createElement(d,e);class p extends o.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){r.Z.canUseDOM&&this.setState({error:e})}render(){const{children:e}=this.props,{error:n}=this.state;if(n){const e={error:n,tryAgain:()=>this.setState({error:null})};return(this.props.fallback??u)(e)}return e??null}}},10412:(e,n,t)=>{"use strict";t.d(n,{Z:()=>r});const o="undefined"!=typeof window&&"document"in window&&"createElement"in window.document,r={canUseDOM:o,canUseEventListeners:o&&("addEventListener"in window||"attachEvent"in window),canUseIntersectionObserver:o&&"IntersectionObserver"in window,canUseViewport:o&&"screen"in window}},35742:(e,n,t)=>{"use strict";t.d(n,{Z:()=>a});var o=t(67294),r=t(70405);function a(e){return o.createElement(r.ql,e)}},39960:(e,n,t)=>{"use strict";t.d(n,{Z:()=>f});var o=t(87462),r=t(67294),a=t(73727),s=t(18780),i=t(52263),c=t(13919),l=t(10412);const d=r.createContext({collectLink:()=>{}});var u=t(44996);function p(e,n){var t;let{isNavLink:p,to:f,href:m,activeClassName:h,isActive:g,"data-noBrokenLinkCheck":b,autoAddBaseUrl:v=!0,...k}=e;const{siteConfig:{trailingSlash:w,baseUrl:y}}=(0,i.Z)(),{withBaseUrl:_}=(0,u.C)(),x=(0,r.useContext)(d),E=(0,r.useRef)(null);(0,r.useImperativeHandle)(n,(()=>E.current));const S=f||m;const C=(0,c.Z)(S),T=null==S?void 0:S.replace("pathname://","");let A=void 0!==T?(L=T,v&&(e=>e.startsWith("/"))(L)?_(L):L):void 0;var L;A&&C&&(A=(0,s.applyTrailingSlash)(A,{trailingSlash:w,baseUrl:y}));const P=(0,r.useRef)(!1),R=p?a.OL:a.rU,N=l.Z.canUseIntersectionObserver,O=(0,r.useRef)(),I=()=>{P.current||null==A||(window.docusaurus.preload(A),P.current=!0)};(0,r.useEffect)((()=>(!N&&C&&null!=A&&window.docusaurus.prefetch(A),()=>{N&&O.current&&O.current.disconnect()})),[O,A,N,C]);const D=(null==(t=A)?void 0:t.startsWith("#"))??!1,M=!A||!C||D;return M||b||x.collectLink(A),M?r.createElement("a",(0,o.Z)({ref:E,href:A},S&&!C&&{target:"_blank",rel:"noopener noreferrer"},k)):r.createElement(R,(0,o.Z)({},k,{onMouseEnter:I,onTouchStart:I,innerRef:e=>{E.current=e,N&&e&&C&&(O.current=new window.IntersectionObserver((n=>{n.forEach((n=>{e===n.target&&(n.isIntersecting||n.intersectionRatio>0)&&(O.current.unobserve(e),O.current.disconnect(),null!=A&&window.docusaurus.prefetch(A))}))})),O.current.observe(e))},to:A},p&&{isActive:g,activeClassName:h}))}const f=r.forwardRef(p)},95999:(e,n,t)=>{"use strict";t.d(n,{Z:()=>c,I:()=>i});var o=t(67294);function r(e,n){const t=e.split(/(\{\w+\})/).map(((e,t)=>{if(t%2==1){const t=null==n?void 0:n[e.slice(1,-1)];if(void 0!==t)return t}return e}));return t.some((e=>(0,o.isValidElement)(e)))?t.map(((e,n)=>(0,o.isValidElement)(e)?o.cloneElement(e,{key:n}):e)).filter((e=>""!==e)):t.join("")}var a=t(57529);function s(e){let{id:n,message:t}=e;if(void 0===n&&void 0===t)throw new Error("Docusaurus translation declarations must have at least a translation id or a default translation message");return a[n??t]??t??n}function i(e,n){let{message:t,id:o}=e;return r(s({message:t,id:o}),n)}function c(e){let{children:n,id:t,values:a}=e;if(n&&"string"!=typeof n)throw console.warn("Illegal children",n),new Error("The Docusaurus component only accept simple string values");const i=s({message:n,id:t});return o.createElement(o.Fragment,null,r(i,a))}},29935:(e,n,t)=>{"use strict";t.d(n,{m:()=>o});const o="default"},13919:(e,n,t)=>{"use strict";function o(e){return/^(?:\w*:|\/\/)/.test(e)}function r(e){return void 0!==e&&!o(e)}t.d(n,{Z:()=>r,b:()=>o})},44996:(e,n,t)=>{"use strict";t.d(n,{C:()=>s,Z:()=>i});var o=t(67294),r=t(52263),a=t(13919);function s(){const{siteConfig:{baseUrl:e,url:n}}=(0,r.Z)(),t=(0,o.useCallback)(((t,o)=>function(e,n,t,o){let{forcePrependBaseUrl:r=!1,absolute:s=!1}=void 0===o?{}:o;if(!t||t.startsWith("#")||(0,a.b)(t))return t;if(r)return n+t.replace(/^\//,"");if(t===n.replace(/\/$/,""))return n;const i=t.startsWith(n)?t:n+t.replace(/^\//,"");return s?e+i:i}(n,e,t,o)),[n,e]);return{withBaseUrl:t}}function i(e,n){void 0===n&&(n={});const{withBaseUrl:t}=s();return t(e,n)}},52263:(e,n,t)=>{"use strict";t.d(n,{Z:()=>a});var o=t(67294),r=t(58940);function a(){return(0,o.useContext)(r._)}},72389:(e,n,t)=>{"use strict";t.d(n,{Z:()=>a});var o=t(67294),r=t(98934);function a(){return(0,o.useContext)(r._)}},99670:(e,n,t)=>{"use strict";t.d(n,{Z:()=>o});function o(e){const n={};return function e(t,o){Object.entries(t).forEach((t=>{let[r,a]=t;const s=o?`${o}.${r}`:r;var i;"object"==typeof(i=a)&&i&&Object.keys(i).length>0?e(a,s):n[s]=a}))}(e),n}},30226:(e,n,t)=>{"use strict";t.d(n,{_:()=>r,z:()=>a});var o=t(67294);const r=o.createContext(null);function a(e){let{children:n,value:t}=e;const a=o.useContext(r),s=(0,o.useMemo)((()=>function(e){let{parent:n,value:t}=e;if(!n){if(!t)throw new Error("Unexpected: no Docusaurus route context found");if(!("plugin"in t))throw new Error("Unexpected: Docusaurus topmost route context has no `plugin` attribute");return t}const o={...n.data,...null==t?void 0:t.data};return{plugin:n.plugin,data:o}}({parent:a,value:t})),[a,t]);return o.createElement(r.Provider,{value:s},n)}},80143:(e,n,t)=>{"use strict";t.d(n,{Iw:()=>b,gA:()=>f,WS:()=>m,_r:()=>u,Jo:()=>v,zh:()=>p,yW:()=>g,gB:()=>h});var o=t(76775),r=t(52263),a=t(29935);function s(e,n){void 0===n&&(n={});const t=function(){const{globalData:e}=(0,r.Z)();return e}()[e];if(!t&&n.failfast)throw new Error(`Docusaurus plugin global data not found for "${e}" plugin.`);return t}const i=e=>e.versions.find((e=>e.isLast));function c(e,n){const t=i(e);return[...e.versions.filter((e=>e!==t)),t].find((e=>!!(0,o.LX)(n,{path:e.path,exact:!1,strict:!1})))}function l(e,n){const t=c(e,n),r=null==t?void 0:t.docs.find((e=>!!(0,o.LX)(n,{path:e.path,exact:!0,strict:!1})));return{activeVersion:t,activeDoc:r,alternateDocVersions:r?function(n){const t={};return e.versions.forEach((e=>{e.docs.forEach((o=>{o.id===n&&(t[e.name]=o)}))})),t}(r.id):{}}}const d={},u=()=>s("docusaurus-plugin-content-docs")??d,p=e=>function(e,n,t){void 0===n&&(n=a.m),void 0===t&&(t={});const o=s(e),r=null==o?void 0:o[n];if(!r&&t.failfast)throw new Error(`Docusaurus plugin global data not found for "${e}" plugin with id "${n}".`);return r}("docusaurus-plugin-content-docs",e,{failfast:!0});function f(e){void 0===e&&(e={});const n=u(),{pathname:t}=(0,o.TH)();return function(e,n,t){void 0===t&&(t={});const r=Object.entries(e).sort(((e,n)=>n[1].path.localeCompare(e[1].path))).find((e=>{let[,t]=e;return!!(0,o.LX)(n,{path:t.path,exact:!1,strict:!1})})),a=r?{pluginId:r[0],pluginData:r[1]}:void 0;if(!a&&t.failfast)throw new Error(`Can't find active docs plugin for "${n}" pathname, while it was expected to be found. Maybe you tried to use a docs feature that can only be used on a docs-related page? Existing docs plugin paths are: ${Object.values(e).map((e=>e.path)).join(", ")}`);return a}(n,t,e)}function m(e){void 0===e&&(e={});const n=f(e),{pathname:t}=(0,o.TH)();if(!n)return;return{activePlugin:n,activeVersion:c(n.pluginData,t)}}function h(e){return p(e).versions}function g(e){const n=p(e);return i(n)}function b(e){const n=p(e),{pathname:t}=(0,o.TH)();return l(n,t)}function v(e){const n=p(e),{pathname:t}=(0,o.TH)();return function(e,n){const t=i(e);return{latestDocSuggestion:l(e,n).alternateDocVersions[t.name],latestVersionSuggestion:t}}(n,t)}},56657:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>o});const o={onRouteDidUpdate(e){let{location:n,previousLocation:t}=e;!t||n.pathname===t.pathname&&n.search===t.search&&n.hash===t.hash||setTimeout((()=>{window.gtag("event","page_view",{page_title:document.title,page_location:window.location.href,page_path:n.pathname+n.search+n.hash})}))}}},18320:(e,n,t)=>{"use strict";t.r(n),t.d(n,{default:()=>a});var o=t(74865),r=t.n(o);r().configure({showSpinner:!1});const a={onRouteUpdate(e){let{location:n,previousLocation:t}=e;if(t&&n.pathname!==t.pathname){const e=window.setTimeout((()=>{r().start()}),200);return()=>window.clearTimeout(e)}},onRouteDidUpdate(){r().done()}}},3310:(e,n,t)=>{"use strict";t.r(n);var o=t(87410),r=t(36809);!function(e){const{themeConfig:{prism:n}}=r.default,{additionalLanguages:o}=n;globalThis.Prism=e,o.forEach((e=>{t(6726)(`./prism-${e}`)})),delete globalThis.Prism}(o.Z)},39471:(e,n,t)=>{"use strict";t.d(n,{Z:()=>a});var o=t(67294);const r="iconExternalLink_nPIU";function a(e){let{width:n=13.5,height:t=13.5}=e;return o.createElement("svg",{width:n,height:t,"aria-hidden":"true",viewBox:"0 0 24 24",className:r},o.createElement("path",{fill:"currentColor",d:"M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"}))}},83514:(e,n,t)=>{"use strict";t.d(n,{Z:()=>Mn});var o=t(67294),r=t(86010),a=t(44763),s=t(10833),i=t(87462),c=t(76775),l=t(95999),d=t(85936);const u="__docusaurus_skipToContent_fallback";function p(e){e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")}function f(){const e=(0,o.useRef)(null),{action:n}=(0,c.k6)(),t=(0,o.useCallback)((e=>{e.preventDefault();const n=document.querySelector("main:first-of-type")??document.getElementById(u);n&&p(n)}),[]);return(0,d.S)((t=>{let{location:o}=t;e.current&&!o.hash&&"PUSH"===n&&p(e.current)})),{containerRef:e,onClick:t}}const m=(0,l.I)({id:"theme.common.skipToMainContent",description:"The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation",message:"Skip to main content"});function h(e){const n=e.children??m,{containerRef:t,onClick:r}=f();return o.createElement("div",{ref:t,role:"region","aria-label":m},o.createElement("a",(0,i.Z)({},e,{href:`#${u}`,onClick:r}),n))}var g=t(35281),b=t(19727);const v="skipToContent_fXgn";function k(){return o.createElement(h,{className:v})}var w=t(86668),y=t(59689);function _(e){let{width:n=21,height:t=21,color:r="currentColor",strokeWidth:a=1.2,className:s,...c}=e;return o.createElement("svg",(0,i.Z)({viewBox:"0 0 15 15",width:n,height:t},c),o.createElement("g",{stroke:r,strokeWidth:a},o.createElement("path",{d:"M.75.75l13.5 13.5M14.25.75L.75 14.25"})))}const x="closeButton_CVFx";function E(e){return o.createElement("button",(0,i.Z)({type:"button","aria-label":(0,l.I)({id:"theme.AnnouncementBar.closeButtonAriaLabel",message:"Close",description:"The ARIA label for close button of announcement bar"})},e,{className:(0,r.Z)("clean-btn close",x,e.className)}),o.createElement(_,{width:14,height:14,strokeWidth:3.1}))}const S="content_knG7";function C(e){const{announcementBar:n}=(0,w.L)(),{content:t}=n;return o.createElement("div",(0,i.Z)({},e,{className:(0,r.Z)(S,e.className),dangerouslySetInnerHTML:{__html:t}}))}const T="announcementBar_mb4j",A="announcementBarPlaceholder_vyr4",L="announcementBarClose_gvF7",P="announcementBarContent_xLdY";function R(){const{announcementBar:e}=(0,w.L)(),{isActive:n,close:t}=(0,y.nT)();if(!n)return null;const{backgroundColor:r,textColor:a,isCloseable:s}=e;return o.createElement("div",{className:T,style:{backgroundColor:r,color:a},role:"banner"},s&&o.createElement("div",{className:A}),o.createElement(C,{className:P}),s&&o.createElement(E,{onClick:t,className:L}))}var N=t(93163),O=t(12466);var I=t(902),D=t(13102);const M=o.createContext(null);function j(e){let{children:n}=e;const t=function(){const e=(0,N.e)(),n=(0,D.HY)(),[t,r]=(0,o.useState)(!1),a=null!==n.component,s=(0,I.D9)(a);return(0,o.useEffect)((()=>{a&&!s&&r(!0)}),[a,s]),(0,o.useEffect)((()=>{a?e.shown||r(!0):r(!1)}),[e.shown,a]),(0,o.useMemo)((()=>[t,r]),[t])}();return o.createElement(M.Provider,{value:t},n)}function B(e){if(e.component){const n=e.component;return o.createElement(n,e.props)}}function F(){const e=(0,o.useContext)(M);if(!e)throw new I.i6("NavbarSecondaryMenuDisplayProvider");const[n,t]=e,r=(0,o.useCallback)((()=>t(!1)),[t]),a=(0,D.HY)();return(0,o.useMemo)((()=>({shown:n,hide:r,content:B(a)})),[r,a,n])}function q(e){let{header:n,primaryMenu:t,secondaryMenu:a}=e;const{shown:s}=F();return o.createElement("div",{className:"navbar-sidebar"},n,o.createElement("div",{className:(0,r.Z)("navbar-sidebar__items",{"navbar-sidebar__items--show-secondary":s})},o.createElement("div",{className:"navbar-sidebar__item menu"},t),o.createElement("div",{className:"navbar-sidebar__item menu"},a)))}var z=t(92949),U=t(72389);function $(e){return o.createElement("svg",(0,i.Z)({viewBox:"0 0 24 24",width:24,height:24},e),o.createElement("path",{fill:"currentColor",d:"M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"}))}function G(e){return o.createElement("svg",(0,i.Z)({viewBox:"0 0 24 24",width:24,height:24},e),o.createElement("path",{fill:"currentColor",d:"M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"}))}const H={toggle:"toggle_vylO",toggleButton:"toggleButton_gllP",darkToggleIcon:"darkToggleIcon_wfgR",lightToggleIcon:"lightToggleIcon_pyhR",toggleButtonDisabled:"toggleButtonDisabled_aARS"};function Z(e){let{className:n,buttonClassName:t,value:a,onChange:s}=e;const i=(0,U.Z)(),c=(0,l.I)({message:"Switch between dark and light mode (currently {mode})",id:"theme.colorToggle.ariaLabel",description:"The ARIA label for the navbar color mode toggle"},{mode:"dark"===a?(0,l.I)({message:"dark mode",id:"theme.colorToggle.ariaLabel.mode.dark",description:"The name for the dark color mode"}):(0,l.I)({message:"light mode",id:"theme.colorToggle.ariaLabel.mode.light",description:"The name for the light color mode"})});return o.createElement("div",{className:(0,r.Z)(H.toggle,n)},o.createElement("button",{className:(0,r.Z)("clean-btn",H.toggleButton,!i&&H.toggleButtonDisabled,t),type:"button",onClick:()=>s("dark"===a?"light":"dark"),disabled:!i,title:c,"aria-label":c,"aria-live":"polite"},o.createElement($,{className:(0,r.Z)(H.toggleIcon,H.lightToggleIcon)}),o.createElement(G,{className:(0,r.Z)(H.toggleIcon,H.darkToggleIcon)})))}const V=o.memo(Z),W="darkNavbarColorModeToggle_X3D1";function K(e){let{className:n}=e;const t=(0,w.L)().navbar.style,r=(0,w.L)().colorMode.disableSwitch,{colorMode:a,setColorMode:s}=(0,z.I)();return r?null:o.createElement(V,{className:n,buttonClassName:"dark"===t?W:void 0,value:a,onChange:s})}var Y=t(21327);function Q(){return o.createElement(Y.Z,{className:"navbar__brand",imageClassName:"navbar__logo",titleClassName:"navbar__title text--truncate"})}function X(){const e=(0,N.e)();return o.createElement("button",{type:"button","aria-label":(0,l.I)({id:"theme.docs.sidebar.closeSidebarButtonAriaLabel",message:"Close navigation bar",description:"The ARIA label for close button of mobile sidebar"}),className:"clean-btn navbar-sidebar__close",onClick:()=>e.toggle()},o.createElement(_,{color:"var(--ifm-color-emphasis-600)"}))}function J(){return o.createElement("div",{className:"navbar-sidebar__brand"},o.createElement(Q,null),o.createElement(K,{className:"margin-right--md"}),o.createElement(X,null))}var ee=t(39960),ne=t(44996),te=t(13919),oe=t(98022),re=t(39471);function ae(e){let{activeBasePath:n,activeBaseRegex:t,to:r,href:a,label:s,html:c,isDropdownLink:l,prependBaseUrlToHref:d,...u}=e;const p=(0,ne.Z)(r),f=(0,ne.Z)(n),m=(0,ne.Z)(a,{forcePrependBaseUrl:!0}),h=s&&a&&!(0,te.Z)(a),g=c?{dangerouslySetInnerHTML:{__html:c}}:{children:o.createElement(o.Fragment,null,s,h&&o.createElement(re.Z,l&&{width:12,height:12}))};return a?o.createElement(ee.Z,(0,i.Z)({href:d?m:a},u,g)):o.createElement(ee.Z,(0,i.Z)({to:p,isNavLink:!0},(n||t)&&{isActive:(e,n)=>t?(0,oe.F)(t,n.pathname):n.pathname.startsWith(f)},u,g))}function se(e){let{className:n,isDropdownItem:t=!1,...a}=e;const s=o.createElement(ae,(0,i.Z)({className:(0,r.Z)(t?"dropdown__link":"navbar__item navbar__link",n),isDropdownLink:t},a));return t?o.createElement("li",null,s):s}function ie(e){let{className:n,isDropdownItem:t,...a}=e;return o.createElement("li",{className:"menu__list-item"},o.createElement(ae,(0,i.Z)({className:(0,r.Z)("menu__link",n)},a)))}function ce(e){let{mobile:n=!1,position:t,...r}=e;const a=n?ie:se;return o.createElement(a,(0,i.Z)({},r,{activeClassName:r.activeClassName??(n?"menu__link--active":"navbar__link--active")}))}var le=t(86043),de=t(48596),ue=t(52263);function pe(e,n){return e.some((e=>function(e,n){return!!(0,de.Mg)(e.to,n)||!!(0,oe.F)(e.activeBaseRegex,n)||!(!e.activeBasePath||!n.startsWith(e.activeBasePath))}(e,n)))}function fe(e){let{items:n,position:t,className:a,onClick:s,...c}=e;const l=(0,o.useRef)(null),[d,u]=(0,o.useState)(!1);return(0,o.useEffect)((()=>{const e=e=>{l.current&&!l.current.contains(e.target)&&u(!1)};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),document.addEventListener("focusin",e),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e),document.removeEventListener("focusin",e)}}),[l]),o.createElement("div",{ref:l,className:(0,r.Z)("navbar__item","dropdown","dropdown--hoverable",{"dropdown--right":"right"===t,"dropdown--show":d})},o.createElement(ae,(0,i.Z)({"aria-haspopup":"true","aria-expanded":d,role:"button",href:c.to?void 0:"#",className:(0,r.Z)("navbar__link",a)},c,{onClick:c.to?void 0:e=>e.preventDefault(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),u(!d))}}),c.children??c.label),o.createElement("ul",{className:"dropdown__menu"},n.map(((e,n)=>o.createElement(We,(0,i.Z)({isDropdownItem:!0,activeClassName:"dropdown__link--active"},e,{key:n}))))))}function me(e){let{items:n,className:t,position:a,onClick:s,...l}=e;const d=function(){const{siteConfig:{baseUrl:e}}=(0,ue.Z)(),{pathname:n}=(0,c.TH)();return n.replace(e,"/")}(),u=pe(n,d),{collapsed:p,toggleCollapsed:f,setCollapsed:m}=(0,le.u)({initialState:()=>!u});return(0,o.useEffect)((()=>{u&&m(!u)}),[d,u,m]),o.createElement("li",{className:(0,r.Z)("menu__list-item",{"menu__list-item--collapsed":p})},o.createElement(ae,(0,i.Z)({role:"button",className:(0,r.Z)("menu__link menu__link--sublist menu__link--sublist-caret",t)},l,{onClick:e=>{e.preventDefault(),f()}}),l.children??l.label),o.createElement(le.z,{lazy:!0,as:"ul",className:"menu__list",collapsed:p},n.map(((e,n)=>o.createElement(We,(0,i.Z)({mobile:!0,isDropdownItem:!0,onClick:s,activeClassName:"menu__link--active"},e,{key:n}))))))}function he(e){let{mobile:n=!1,...t}=e;const r=n?me:fe;return o.createElement(r,t)}var ge=t(94711);function be(e){let{width:n=20,height:t=20,...r}=e;return o.createElement("svg",(0,i.Z)({viewBox:"0 0 24 24",width:n,height:t,"aria-hidden":!0},r),o.createElement("path",{fill:"currentColor",d:"M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"}))}const ve="iconLanguage_nlXk";function ke(){return o.createElement("svg",{width:"15",height:"15",className:"DocSearch-Control-Key-Icon"},o.createElement("path",{d:"M4.505 4.496h2M5.505 5.496v5M8.216 4.496l.055 5.993M10 7.5c.333.333.5.667.5 1v2M12.326 4.5v5.996M8.384 4.496c1.674 0 2.116 0 2.116 1.5s-.442 1.5-2.116 1.5M3.205 9.303c-.09.448-.277 1.21-1.241 1.203C1 10.5.5 9.513.5 8V7c0-1.57.5-2.5 1.464-2.494.964.006 1.134.598 1.24 1.342M12.553 10.5h1.953",strokeWidth:"1.2",stroke:"currentColor",fill:"none",strokeLinecap:"square"}))}var we=t(20830),ye=["translations"];function _e(){return _e=Object.assign||function(e){for(var n=1;ne.length)&&(n=e.length);for(var t=0,o=new Array(n);t=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var Ce="Ctrl";var Te=o.forwardRef((function(e,n){var t=e.translations,r=void 0===t?{}:t,a=Se(e,ye),s=r.buttonText,i=void 0===s?"Search":s,c=r.buttonAriaLabel,l=void 0===c?"Search":c,d=xe((0,o.useState)(null),2),u=d[0],p=d[1];return(0,o.useEffect)((function(){"undefined"!=typeof navigator&&(/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)?p("\u2318"):p(Ce))}),[]),o.createElement("button",_e({type:"button",className:"DocSearch DocSearch-Button","aria-label":l},a,{ref:n}),o.createElement("span",{className:"DocSearch-Button-Container"},o.createElement(we.W,null),o.createElement("span",{className:"DocSearch-Button-Placeholder"},i)),o.createElement("span",{className:"DocSearch-Button-Keys"},null!==u&&o.createElement(o.Fragment,null,o.createElement("kbd",{className:"DocSearch-Button-Key"},u===Ce?o.createElement(ke,null):u),o.createElement("kbd",{className:"DocSearch-Button-Key"},"K"))))})),Ae=t(35742),Le=t(66177),Pe=t(239),Re=t(43320);var Ne=t(73935);const Oe={button:{buttonText:(0,l.I)({id:"theme.SearchBar.label",message:"Search",description:"The ARIA label and placeholder for search button"}),buttonAriaLabel:(0,l.I)({id:"theme.SearchBar.label",message:"Search",description:"The ARIA label and placeholder for search button"})},modal:{searchBox:{resetButtonTitle:(0,l.I)({id:"theme.SearchModal.searchBox.resetButtonTitle",message:"Clear the query",description:"The label and ARIA label for search box reset button"}),resetButtonAriaLabel:(0,l.I)({id:"theme.SearchModal.searchBox.resetButtonTitle",message:"Clear the query",description:"The label and ARIA label for search box reset button"}),cancelButtonText:(0,l.I)({id:"theme.SearchModal.searchBox.cancelButtonText",message:"Cancel",description:"The label and ARIA label for search box cancel button"}),cancelButtonAriaLabel:(0,l.I)({id:"theme.SearchModal.searchBox.cancelButtonText",message:"Cancel",description:"The label and ARIA label for search box cancel button"})},startScreen:{recentSearchesTitle:(0,l.I)({id:"theme.SearchModal.startScreen.recentSearchesTitle",message:"Recent",description:"The title for recent searches"}),noRecentSearchesText:(0,l.I)({id:"theme.SearchModal.startScreen.noRecentSearchesText",message:"No recent searches",description:"The text when no recent searches"}),saveRecentSearchButtonTitle:(0,l.I)({id:"theme.SearchModal.startScreen.saveRecentSearchButtonTitle",message:"Save this search",description:"The label for save recent search button"}),removeRecentSearchButtonTitle:(0,l.I)({id:"theme.SearchModal.startScreen.removeRecentSearchButtonTitle",message:"Remove this search from history",description:"The label for remove recent search button"}),favoriteSearchesTitle:(0,l.I)({id:"theme.SearchModal.startScreen.favoriteSearchesTitle",message:"Favorite",description:"The title for favorite searches"}),removeFavoriteSearchButtonTitle:(0,l.I)({id:"theme.SearchModal.startScreen.removeFavoriteSearchButtonTitle",message:"Remove this search from favorites",description:"The label for remove favorite search button"})},errorScreen:{titleText:(0,l.I)({id:"theme.SearchModal.errorScreen.titleText",message:"Unable to fetch results",description:"The title for error screen of search modal"}),helpText:(0,l.I)({id:"theme.SearchModal.errorScreen.helpText",message:"You might want to check your network connection.",description:"The help text for error screen of search modal"})},footer:{selectText:(0,l.I)({id:"theme.SearchModal.footer.selectText",message:"to select",description:"The explanatory text of the action for the enter key"}),selectKeyAriaLabel:(0,l.I)({id:"theme.SearchModal.footer.selectKeyAriaLabel",message:"Enter key",description:"The ARIA label for the Enter key button that makes the selection"}),navigateText:(0,l.I)({id:"theme.SearchModal.footer.navigateText",message:"to navigate",description:"The explanatory text of the action for the Arrow up and Arrow down key"}),navigateUpKeyAriaLabel:(0,l.I)({id:"theme.SearchModal.footer.navigateUpKeyAriaLabel",message:"Arrow up",description:"The ARIA label for the Arrow up key button that makes the navigation"}),navigateDownKeyAriaLabel:(0,l.I)({id:"theme.SearchModal.footer.navigateDownKeyAriaLabel",message:"Arrow down",description:"The ARIA label for the Arrow down key button that makes the navigation"}),closeText:(0,l.I)({id:"theme.SearchModal.footer.closeText",message:"to close",description:"The explanatory text of the action for Escape key"}),closeKeyAriaLabel:(0,l.I)({id:"theme.SearchModal.footer.closeKeyAriaLabel",message:"Escape key",description:"The ARIA label for the Escape key button that close the modal"}),searchByText:(0,l.I)({id:"theme.SearchModal.footer.searchByText",message:"Search by",description:"The text explain that the search is making by Algolia"})},noResultsScreen:{noResultsText:(0,l.I)({id:"theme.SearchModal.noResultsScreen.noResultsText",message:"No results for",description:"The text explains that there are no results for the following search"}),suggestedQueryText:(0,l.I)({id:"theme.SearchModal.noResultsScreen.suggestedQueryText",message:"Try searching for",description:"The text for the suggested query when no results are found for the following search"}),reportMissingResultsText:(0,l.I)({id:"theme.SearchModal.noResultsScreen.reportMissingResultsText",message:"Believe this query should return results?",description:"The text for the question where the user thinks there are missing results"}),reportMissingResultsLinkText:(0,l.I)({id:"theme.SearchModal.noResultsScreen.reportMissingResultsLinkText",message:"Let us know.",description:"The text for the link to report missing results"})}},placeholder:(0,l.I)({id:"theme.SearchModal.placeholder",message:"Search docs",description:"The placeholder of the input of the DocSearch pop-up modal"})};let Ie=null;function De(e){let{hit:n,children:t}=e;return o.createElement(ee.Z,{to:n.url},t)}function Me(e){let{state:n,onClose:t}=e;const r=(0,Le.M)();return o.createElement(ee.Z,{to:r(n.query),onClick:t},o.createElement(l.Z,{id:"theme.SearchBar.seeAll",values:{count:n.context.nbHits}},"See all {count} results"))}function je(e){var n;let{contextualSearch:r,externalUrlRegex:a,...s}=e;const{siteMetadata:l}=(0,ue.Z)(),d=(0,Pe.l)(),u=function(){const{locale:e,tags:n}=(0,Re._q)();return[`language:${e}`,n.map((e=>`docusaurus_tag:${e}`))]}(),p=(null==(n=s.searchParameters)?void 0:n.facetFilters)??[],f=r?function(e,n){const t=e=>"string"==typeof e?[e]:e;return[...t(e),...t(n)]}(u,p):p,m={...s.searchParameters,facetFilters:f},h=(0,c.k6)(),g=(0,o.useRef)(null),b=(0,o.useRef)(null),[v,k]=(0,o.useState)(!1),[w,y]=(0,o.useState)(void 0),_=(0,o.useCallback)((()=>Ie?Promise.resolve():Promise.all([t.e(6780).then(t.bind(t,76780)),Promise.all([t.e(532),t.e(6945)]).then(t.bind(t,46945)),Promise.all([t.e(532),t.e(8894)]).then(t.bind(t,18894))]).then((e=>{let[{DocSearchModal:n}]=e;Ie=n}))),[]),x=(0,o.useCallback)((()=>{_().then((()=>{g.current=document.createElement("div"),document.body.insertBefore(g.current,document.body.firstChild),k(!0)}))}),[_,k]),E=(0,o.useCallback)((()=>{var e;k(!1),null==(e=g.current)||e.remove()}),[k]),S=(0,o.useCallback)((e=>{_().then((()=>{k(!0),y(e.key)}))}),[_,k,y]),C=(0,o.useRef)({navigate(e){let{itemUrl:n}=e;(0,oe.F)(a,n)?window.location.href=n:h.push(n)}}).current,T=(0,o.useRef)((e=>s.transformItems?s.transformItems(e):e.map((e=>({...e,url:d(e.url)}))))).current,A=(0,o.useMemo)((()=>e=>o.createElement(Me,(0,i.Z)({},e,{onClose:E}))),[E]),L=(0,o.useCallback)((e=>(e.addAlgoliaAgent("docusaurus",l.docusaurusVersion),e)),[l.docusaurusVersion]);return function(e){var n=e.isOpen,t=e.onOpen,r=e.onClose,a=e.onInput,s=e.searchButtonRef;o.useEffect((function(){function e(e){(27===e.keyCode&&n||"k"===e.key&&(e.metaKey||e.ctrlKey)||!function(e){var n=e.target,t=n.tagName;return n.isContentEditable||"INPUT"===t||"SELECT"===t||"TEXTAREA"===t}(e)&&"/"===e.key&&!n)&&(e.preventDefault(),n?r():document.body.classList.contains("DocSearch--active")||document.body.classList.contains("DocSearch--active")||t()),s&&s.current===document.activeElement&&a&&/[a-zA-Z0-9]/.test(String.fromCharCode(e.keyCode))&&a(e)}return window.addEventListener("keydown",e),function(){window.removeEventListener("keydown",e)}}),[n,t,r,a,s])}({isOpen:v,onOpen:x,onClose:E,onInput:S,searchButtonRef:b}),o.createElement(o.Fragment,null,o.createElement(Ae.Z,null,o.createElement("link",{rel:"preconnect",href:`https://${s.appId}-dsn.algolia.net`,crossOrigin:"anonymous"})),o.createElement(Te,{onTouchStart:_,onFocus:_,onMouseOver:_,onClick:x,ref:b,translations:Oe.button}),v&&Ie&&g.current&&(0,Ne.createPortal)(o.createElement(Ie,(0,i.Z)({onClose:E,initialScrollY:window.scrollY,initialQuery:w,navigator:C,transformItems:T,hitComponent:De,transformSearchClient:L},s.searchPagePath&&{resultsFooterComponent:A},s,{searchParameters:m,placeholder:Oe.placeholder,translations:Oe.modal})),g.current))}function Be(){const{siteConfig:e}=(0,ue.Z)();return o.createElement(je,e.themeConfig.algolia)}function Fe(e){return o.createElement(o.Fragment,null,o.createElement(Be,e))}const qe="searchBox_ZlJk";function ze(e){let{children:n,className:t}=e;return o.createElement("div",{className:(0,r.Z)(t,qe)},n)}var Ue=t(80143),$e=t(53438);var Ge=t(60373);const He=e=>e.docs.find((n=>n.id===e.mainDocId));const Ze={default:ce,localeDropdown:function(e){let{mobile:n,dropdownItemsBefore:t,dropdownItemsAfter:r,...a}=e;const{i18n:{currentLocale:s,locales:d,localeConfigs:u}}=(0,ue.Z)(),p=(0,ge.l)(),{search:f,hash:m}=(0,c.TH)(),h=[...t,...d.map((e=>{const t=`${`pathname://${p.createUrl({locale:e,fullyQualified:!1})}`}${f}${m}`;return{label:u[e].label,lang:u[e].htmlLang,to:t,target:"_self",autoAddBaseUrl:!1,className:e===s?n?"menu__link--active":"dropdown__link--active":""}})),...r],g=n?(0,l.I)({message:"Languages",id:"theme.navbar.mobileLanguageDropdown.label",description:"The label for the mobile language switcher dropdown"}):u[s].label;return o.createElement(he,(0,i.Z)({},a,{mobile:n,label:o.createElement(o.Fragment,null,o.createElement(be,{className:ve}),g),items:h}))},search:function(e){let{mobile:n,className:t}=e;return n?null:o.createElement(ze,{className:t},o.createElement(Fe,null))},dropdown:he,html:function(e){let{value:n,className:t,mobile:a=!1,isDropdownItem:s=!1}=e;const i=s?"li":"div";return o.createElement(i,{className:(0,r.Z)({navbar__item:!a&&!s,"menu__list-item":a},t),dangerouslySetInnerHTML:{__html:n}})},doc:function(e){let{docId:n,label:t,docsPluginId:r,...a}=e;const{activeDoc:s}=(0,Ue.Iw)(r),c=(0,$e.vY)(n,r);return null===c?null:o.createElement(ce,(0,i.Z)({exact:!0},a,{isActive:()=>(null==s?void 0:s.path)===c.path||!(null==s||!s.sidebar)&&s.sidebar===c.sidebar,label:t??c.id,to:c.path}))},docSidebar:function(e){let{sidebarId:n,label:t,docsPluginId:r,...a}=e;const{activeDoc:s}=(0,Ue.Iw)(r),c=(0,$e.oz)(n,r).link;if(!c)throw new Error(`DocSidebarNavbarItem: Sidebar with ID "${n}" doesn't have anything to be linked to.`);return o.createElement(ce,(0,i.Z)({exact:!0},a,{isActive:()=>(null==s?void 0:s.sidebar)===n,label:t??c.label,to:c.path}))},docsVersion:function(e){let{label:n,to:t,docsPluginId:r,...a}=e;const s=(0,$e.lO)(r)[0],c=n??s.label,l=t??(e=>e.docs.find((n=>n.id===e.mainDocId)))(s).path;return o.createElement(ce,(0,i.Z)({},a,{label:c,to:l}))},docsVersionDropdown:function(e){let{mobile:n,docsPluginId:t,dropdownActiveClassDisabled:r,dropdownItemsBefore:a,dropdownItemsAfter:s,...d}=e;const{search:u,hash:p}=(0,c.TH)(),f=(0,Ue.Iw)(t),m=(0,Ue.gB)(t),{savePreferredVersionName:h}=(0,Ge.J)(t),g=[...a,...m.map((e=>{const n=f.alternateDocVersions[e.name]??He(e);return{label:e.label,to:`${n.path}${u}${p}`,isActive:()=>e===f.activeVersion,onClick:()=>h(e.name)}})),...s],b=(0,$e.lO)(t)[0],v=n&&g.length>1?(0,l.I)({id:"theme.navbar.mobileVersionsDropdown.label",message:"Versions",description:"The label for the navbar versions dropdown on mobile view"}):b.label,k=n&&g.length>1?void 0:He(b).path;return g.length<=1?o.createElement(ce,(0,i.Z)({},d,{mobile:n,label:v,to:k,isActive:r?()=>!1:void 0})):o.createElement(he,(0,i.Z)({},d,{mobile:n,label:v,to:k,items:g,isActive:r?()=>!1:void 0}))}};function Ve(e){let{type:n,...t}=e;const r=function(e,n){return e&&"default"!==e?e:"items"in n?"dropdown":"default"}(n,t),a=Ze[r];if(!a)throw new Error(`No NavbarItem component found for type "${n}".`);return o.createElement(a,t)}function We(e){const{docsPluginId:n,type:t}=e,{pathname:r}=(0,c.TH)();return"docsVersionDropdown"===t&&-1===r.search(new RegExp(`^/${n}/`,"g"))?o.createElement(o.Fragment,null):o.createElement(o.Fragment,null,o.createElement(Ve,e))}function Ke(){const e=(0,N.e)(),n=(0,w.L)().navbar.items;return o.createElement("ul",{className:"menu__list"},n.map(((n,t)=>o.createElement(We,(0,i.Z)({mobile:!0},n,{onClick:()=>e.toggle(),key:t})))))}function Ye(e){return o.createElement("button",(0,i.Z)({},e,{type:"button",className:"clean-btn navbar-sidebar__back"}),o.createElement(l.Z,{id:"theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel",description:"The label of the back button to return to main menu, inside the mobile navbar sidebar secondary menu (notably used to display the docs sidebar)"},"\u2190 Back to main menu"))}function Qe(){const e=0===(0,w.L)().navbar.items.length,n=F();return o.createElement(o.Fragment,null,!e&&o.createElement(Ye,{onClick:()=>n.hide()}),n.content)}function Xe(){const e=(0,N.e)();var n;return void 0===(n=e.shown)&&(n=!0),(0,o.useEffect)((()=>(document.body.style.overflow=n?"hidden":"visible",()=>{document.body.style.overflow="visible"})),[n]),e.shouldRender?o.createElement(q,{header:o.createElement(J,null),primaryMenu:o.createElement(Ke,null),secondaryMenu:o.createElement(Qe,null)}):null}const Je="navbarHideable_m1mJ",en="navbarHidden_jGov";function nn(e){return o.createElement("div",(0,i.Z)({role:"presentation"},e,{className:(0,r.Z)("navbar-sidebar__backdrop",e.className)}))}function tn(e){let{children:n}=e;const{navbar:{hideOnScroll:t,style:a}}=(0,w.L)(),s=(0,N.e)(),{navbarRef:i,isNavbarVisible:c}=function(e){const[n,t]=(0,o.useState)(e),r=(0,o.useRef)(!1),a=(0,o.useRef)(0),s=(0,o.useCallback)((e=>{null!==e&&(a.current=e.getBoundingClientRect().height)}),[]);return(0,O.RF)(((n,o)=>{let{scrollY:s}=n;if(!e)return;if(s=i?t(!1):s+l{if(!e)return;const o=n.location.hash;if(o?document.getElementById(o.substring(1)):void 0)return r.current=!0,void t(!1);t(!0)})),{navbarRef:s,isNavbarVisible:n}}(t);return o.createElement("nav",{ref:i,"aria-label":(0,l.I)({id:"theme.NavBar.navAriaLabel",message:"Main",description:"The ARIA label for the main navigation"}),className:(0,r.Z)("navbar","navbar--fixed-top",t&&[Je,!c&&en],{"navbar--dark":"dark"===a,"navbar--primary":"primary"===a,"navbar-sidebar--show":s.shown})},n,o.createElement(nn,{onClick:s.toggle}),o.createElement(Xe,null))}var on=t(18780);const rn="errorBoundaryError_a6uf";function an(e){return o.createElement("button",(0,i.Z)({type:"button"},e),o.createElement(l.Z,{id:"theme.ErrorPageContent.tryAgain",description:"The label of the button to try again rendering when the React error boundary captures an error"},"Try again"))}function sn(e){let{error:n}=e;const t=(0,on.getErrorCausalChain)(n).map((e=>e.message)).join("\n\nCause:\n");return o.createElement("p",{className:rn},t)}class cn extends o.Component{componentDidCatch(e,n){throw this.props.onError(e,n)}render(){return this.props.children}}function ln(e){let{width:n=30,height:t=30,className:r,...a}=e;return o.createElement("svg",(0,i.Z)({className:r,width:n,height:t,viewBox:"0 0 30 30","aria-hidden":"true"},a),o.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"M4 7h22M4 15h22M4 23h22"}))}function dn(){const{toggle:e,shown:n}=(0,N.e)();return o.createElement("button",{onClick:e,"aria-label":(0,l.I)({id:"theme.docs.sidebar.toggleSidebarButtonAriaLabel",message:"Toggle navigation bar",description:"The ARIA label for hamburger menu button of mobile navigation"}),"aria-expanded":n,className:"navbar__toggle clean-btn",type:"button"},o.createElement(ln,null))}const un="colorModeToggle_DEke";function pn(e){let{items:n}=e;return o.createElement(o.Fragment,null,n.map(((e,n)=>o.createElement(cn,{key:n,onError:n=>new Error(`A theme navbar item failed to render.\nPlease double-check the following navbar item (themeConfig.navbar.items) of your Docusaurus config:\n${JSON.stringify(e,null,2)}`,{cause:n})},o.createElement(We,e)))))}function fn(e){let{left:n,right:t}=e;return o.createElement("div",{className:"navbar__inner"},o.createElement("div",{className:"navbar__items"},n),o.createElement("div",{className:"navbar__items navbar__items--right"},t))}function mn(){const e=(0,N.e)(),n=(0,w.L)().navbar.items,[t,r]=function(e){function n(e){return"left"===(e.position??"right")}return[e.filter(n),e.filter((e=>!n(e)))]}(n),a=n.find((e=>"search"===e.type));return o.createElement(fn,{left:o.createElement(o.Fragment,null,!e.disabled&&o.createElement(dn,null),o.createElement(Q,null),o.createElement(pn,{items:t})),right:o.createElement(o.Fragment,null,o.createElement(pn,{items:r}),o.createElement(K,{className:un}),!a&&o.createElement(ze,null,o.createElement(Fe,null)))})}function hn(){return o.createElement(tn,null,o.createElement(mn,null))}function gn(e){let{item:n}=e;const{to:t,href:r,label:a,prependBaseUrlToHref:s,...c}=n,l=(0,ne.Z)(t),d=(0,ne.Z)(r,{forcePrependBaseUrl:!0});return o.createElement(ee.Z,(0,i.Z)({className:"footer__link-item"},r?{href:s?d:r}:{to:l},c),a,r&&!(0,te.Z)(r)&&o.createElement(re.Z,null))}function bn(e){let{item:n}=e;return n.html?o.createElement("li",{className:"footer__item",dangerouslySetInnerHTML:{__html:n.html}}):o.createElement("li",{key:n.href??n.to,className:"footer__item"},o.createElement(gn,{item:n}))}function vn(e){let{column:n}=e;return o.createElement("div",{className:"col footer__col"},o.createElement("div",{className:"footer__title"},n.title),o.createElement("ul",{className:"footer__items clean-list"},n.items.map(((e,n)=>o.createElement(bn,{key:n,item:e})))))}function kn(e){let{columns:n}=e;return o.createElement("div",{className:"row footer__links"},n.map(((e,n)=>o.createElement(vn,{key:n,column:e}))))}function wn(){return o.createElement("span",{className:"footer__link-separator"},"\xb7")}function yn(e){let{item:n}=e;return n.html?o.createElement("span",{className:"footer__link-item",dangerouslySetInnerHTML:{__html:n.html}}):o.createElement(gn,{item:n})}function _n(e){let{links:n}=e;return o.createElement("div",{className:"footer__links text--center"},o.createElement("div",{className:"footer__links"},n.map(((e,t)=>o.createElement(o.Fragment,{key:t},o.createElement(yn,{item:e}),n.length!==t+1&&o.createElement(wn,null))))))}function xn(e){let{links:n}=e;return function(e){return"title"in e[0]}(n)?o.createElement(kn,{columns:n}):o.createElement(_n,{links:n})}var En=t(50941);const Sn="footerLogoLink_BH7S";function Cn(e){let{logo:n}=e;const{withBaseUrl:t}=(0,ne.C)(),a={light:t(n.src),dark:t(n.srcDark??n.src)};return o.createElement(En.Z,{className:(0,r.Z)("footer__logo",n.className),alt:n.alt,sources:a,width:n.width,height:n.height,style:n.style})}function Tn(e){let{logo:n}=e;return n.href?o.createElement(ee.Z,{href:n.href,className:Sn,target:n.target},o.createElement(Cn,{logo:n})):o.createElement(Cn,{logo:n})}function An(e){let{copyright:n}=e;return o.createElement("div",{className:"footer__copyright",dangerouslySetInnerHTML:{__html:n}})}function Ln(e){let{style:n,links:t,logo:a,copyright:s}=e;return o.createElement("footer",{className:(0,r.Z)("footer",{"footer--dark":"dark"===n})},o.createElement("div",{className:"container container-fluid"},t,(a||s)&&o.createElement("div",{className:"footer__bottom text--center"},a&&o.createElement("div",{className:"margin-bottom--sm"},a),s)))}function Pn(){const{footer:e}=(0,w.L)();if(!e)return null;const{copyright:n,links:t,logo:r,style:a}=e;return o.createElement(Ln,{style:a,links:t&&t.length>0&&o.createElement(xn,{links:t}),logo:r&&o.createElement(Tn,{logo:r}),copyright:n&&o.createElement(An,{copyright:n})})}const Rn=o.memo(Pn),Nn=(0,I.Qc)([z.S,y.pl,O.OC,Ge.L5,s.VC,function(e){let{children:n}=e;return o.createElement(D.n2,null,o.createElement(N.M,null,o.createElement(j,null,n)))}]);function On(e){let{children:n}=e;return o.createElement(Nn,null,n)}function In(e){let{error:n,tryAgain:t}=e;return o.createElement("main",{className:"container margin-vert--xl"},o.createElement("div",{className:"row"},o.createElement("div",{className:"col col--6 col--offset-3"},o.createElement("h1",{className:"hero__title"},o.createElement(l.Z,{id:"theme.ErrorPageContent.title",description:"The title of the fallback page when the page crashed"},"This page crashed.")),o.createElement("div",{className:"margin-vert--lg"},o.createElement(an,{onClick:t,className:"button button--primary shadow--lw"})),o.createElement("hr",null),o.createElement("div",{className:"margin-vert--md"},o.createElement(sn,{error:n})))))}const Dn="mainWrapper_z2l0";function Mn(e){const{children:n,noFooter:t,wrapperClassName:i,title:c,description:l}=e;return(0,b.t)(),o.createElement(On,null,o.createElement(s.d,{title:c,description:l}),o.createElement(k,null),o.createElement(R,null),o.createElement(hn,null),o.createElement("div",{id:u,className:(0,r.Z)(g.k.wrapper.main,Dn,i)},o.createElement(a.Z,{fallback:e=>o.createElement(In,e)},n)),!t&&o.createElement(Rn,null))}},21327:(e,n,t)=>{"use strict";t.d(n,{Z:()=>u});var o=t(87462),r=t(67294),a=t(39960),s=t(44996),i=t(52263),c=t(86668),l=t(50941);function d(e){let{logo:n,alt:t,imageClassName:o}=e;const a={light:(0,s.Z)(n.src),dark:(0,s.Z)(n.srcDark||n.src)},i=r.createElement(l.Z,{className:n.className,sources:a,height:n.height,width:n.width,alt:t,style:n.style});return o?r.createElement("div",{className:o},i):i}function u(e){const{siteConfig:{title:n}}=(0,i.Z)(),{navbar:{title:t,logo:l}}=(0,c.L)(),{imageClassName:u,titleClassName:p,...f}=e,m=(0,s.Z)((null==l?void 0:l.href)||"/"),h=t?"":n,g=(null==l?void 0:l.alt)??h;return r.createElement(a.Z,(0,o.Z)({to:m},f,(null==l?void 0:l.target)&&{target:l.target}),l&&r.createElement(d,{logo:l,alt:g,imageClassName:u}),null!=t&&r.createElement("b",{className:p},t))}},90197:(e,n,t)=>{"use strict";t.d(n,{Z:()=>a});var o=t(67294),r=t(35742);function a(e){let{locale:n,version:t,tag:a}=e;const s=n;return o.createElement(r.Z,null,n&&o.createElement("meta",{name:"docusaurus_locale",content:n}),t&&o.createElement("meta",{name:"docusaurus_version",content:t}),a&&o.createElement("meta",{name:"docusaurus_tag",content:a}),s&&o.createElement("meta",{name:"docsearch:language",content:s}),t&&o.createElement("meta",{name:"docsearch:version",content:t}),a&&o.createElement("meta",{name:"docsearch:docusaurus_tag",content:a}))}},50941:(e,n,t)=>{"use strict";t.d(n,{Z:()=>l});var o=t(87462),r=t(67294),a=t(86010),s=t(72389),i=t(92949);const c={themedImage:"themedImage_ToTc","themedImage--light":"themedImage--light_HNdA","themedImage--dark":"themedImage--dark_i4oU"};function l(e){const n=(0,s.Z)(),{colorMode:t}=(0,i.I)(),{sources:l,className:d,alt:u,...p}=e,f=n?"dark"===t?["dark"]:["light"]:["light","dark"];return r.createElement(r.Fragment,null,f.map((e=>r.createElement("img",(0,o.Z)({key:e,src:l[e],alt:u,className:(0,a.Z)(c.themedImage,c[`themedImage--${e}`],d)},p)))))}},86043:(e,n,t)=>{"use strict";t.d(n,{u:()=>i,z:()=>h});var o=t(87462),r=t(67294),a=t(10412),s=t(91442);function i(e){let{initialState:n}=e;const[t,o]=(0,r.useState)(n??!1),a=(0,r.useCallback)((()=>{o((e=>!e))}),[]);return{collapsed:t,setCollapsed:o,toggleCollapsed:a}}const c={display:"none",overflow:"hidden",height:"0px"},l={display:"block",overflow:"visible",height:"auto"};function d(e,n){const t=n?c:l;e.style.display=t.display,e.style.overflow=t.overflow,e.style.height=t.height}function u(e){let{collapsibleRef:n,collapsed:t,animation:o}=e;const a=(0,r.useRef)(!1);(0,r.useEffect)((()=>{const e=n.current;function r(){const n=e.scrollHeight,t=(null==o?void 0:o.duration)??function(e){if((0,s.n)())return 1;const n=e/36;return Math.round(10*(4+15*n**.25+n/5))}(n);return{transition:`height ${t}ms ${(null==o?void 0:o.easing)??"ease-in-out"}`,height:`${n}px`}}function i(){const n=r();e.style.transition=n.transition,e.style.height=n.height}if(!a.current)return d(e,t),void(a.current=!0);return e.style.willChange="height",function(){const n=requestAnimationFrame((()=>{t?(i(),requestAnimationFrame((()=>{e.style.height=c.height,e.style.overflow=c.overflow}))):(e.style.display="block",requestAnimationFrame((()=>{i()})))}));return()=>cancelAnimationFrame(n)}()}),[n,t,o])}function p(e){if(!a.Z.canUseDOM)return e?c:l}function f(e){let{as:n="div",collapsed:t,children:o,animation:a,onCollapseTransitionEnd:s,className:i,disableSSRStyle:c}=e;const l=(0,r.useRef)(null);return u({collapsibleRef:l,collapsed:t,animation:a}),r.createElement(n,{ref:l,style:c?void 0:p(t),onTransitionEnd:e=>{"height"===e.propertyName&&(d(l.current,t),null==s||s(t))},className:i},o)}function m(e){let{collapsed:n,...t}=e;const[a,s]=(0,r.useState)(!n),[i,c]=(0,r.useState)(n);return(0,r.useLayoutEffect)((()=>{n||s(!0)}),[n]),(0,r.useLayoutEffect)((()=>{a&&c(n)}),[a,n]),a?r.createElement(f,(0,o.Z)({},t,{collapsed:i})):null}function h(e){let{lazy:n,...t}=e;const o=n?m:f;return r.createElement(o,t)}},59689:(e,n,t)=>{"use strict";t.d(n,{nT:()=>m,pl:()=>f});var o=t(67294),r=t(72389),a=t(50012),s=t(902),i=t(86668);const c=(0,a.WA)("docusaurus.announcement.dismiss"),l=(0,a.WA)("docusaurus.announcement.id"),d=()=>"true"===c.get(),u=e=>c.set(String(e)),p=o.createContext(null);function f(e){let{children:n}=e;const t=function(){const{announcementBar:e}=(0,i.L)(),n=(0,r.Z)(),[t,a]=(0,o.useState)((()=>!!n&&d()));(0,o.useEffect)((()=>{a(d())}),[]);const s=(0,o.useCallback)((()=>{u(!0),a(!0)}),[]);return(0,o.useEffect)((()=>{if(!e)return;const{id:n}=e;let t=l.get();"annoucement-bar"===t&&(t="announcement-bar");const o=n!==t;l.set(n),o&&u(!1),!o&&d()||a(!1)}),[e]),(0,o.useMemo)((()=>({isActive:!!e&&!t,close:s})),[e,t,s])}();return o.createElement(p.Provider,{value:t},n)}function m(){const e=(0,o.useContext)(p);if(!e)throw new s.i6("AnnouncementBarProvider");return e}},92949:(e,n,t)=>{"use strict";t.d(n,{I:()=>g,S:()=>h});var o=t(67294),r=t(10412),a=t(902),s=t(50012),i=t(86668);const c=o.createContext(void 0),l="theme",d=(0,s.WA)(l),u="light",p="dark",f=e=>e===p?p:u;function m(){const{colorMode:{defaultMode:e,disableSwitch:n,respectPrefersColorScheme:t}}=(0,i.L)(),[a,s]=(0,o.useState)((e=>r.Z.canUseDOM?f(document.documentElement.getAttribute("data-theme")):f(e))(e));(0,o.useEffect)((()=>{n&&d.del()}),[n]);const c=(0,o.useCallback)((function(n,o){void 0===o&&(o={});const{persist:r=!0}=o;n?(s(n),r&&(e=>{d.set(f(e))})(n)):(s(t?window.matchMedia("(prefers-color-scheme: dark)").matches?p:u:e),d.del())}),[t,e]);(0,o.useEffect)((()=>{document.documentElement.setAttribute("data-theme",f(a))}),[a]),(0,o.useEffect)((()=>{if(n)return;const e=e=>{if(e.key!==l)return;const n=d.get();null!==n&&c(f(n))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)}),[n,c]);const m=(0,o.useRef)(!1);return(0,o.useEffect)((()=>{if(n&&!t)return;const e=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>{window.matchMedia("print").matches||m.current?m.current=window.matchMedia("print").matches:c(null)};return e.addListener(o),()=>e.removeListener(o)}),[c,n,t]),(0,o.useMemo)((()=>({colorMode:a,setColorMode:c,get isDarkTheme(){return a===p},setLightTheme(){c(u)},setDarkTheme(){c(p)}})),[a,c])}function h(e){let{children:n}=e;const t=m();return o.createElement(c.Provider,{value:t},n)}function g(){const e=(0,o.useContext)(c);if(null==e)throw new a.i6("ColorModeProvider","Please see https://docusaurus.io/docs/api/themes/configuration#use-color-mode.");return e}},60373:(e,n,t)=>{"use strict";t.d(n,{J:()=>k,L5:()=>b,Oh:()=>w});var o=t(67294),r=t(80143),a=t(29935),s=t(86668),i=t(53438),c=t(902),l=t(50012);const d=e=>`docs-preferred-version-${e}`,u=(e,n,t)=>{(0,l.WA)(d(e),{persistence:n}).set(t)},p=(e,n)=>(0,l.WA)(d(e),{persistence:n}).get(),f=(e,n)=>{(0,l.WA)(d(e),{persistence:n}).del()};const m=o.createContext(null);function h(){const e=(0,r._r)(),n=(0,s.L)().docs.versionPersistence,t=(0,o.useMemo)((()=>Object.keys(e)),[e]),[a,i]=(0,o.useState)((()=>(e=>Object.fromEntries(e.map((e=>[e,{preferredVersionName:null}]))))(t)));(0,o.useEffect)((()=>{i(function(e){let{pluginIds:n,versionPersistence:t,allDocsData:o}=e;function r(e){const n=p(e,t);return o[e].versions.some((e=>e.name===n))?{preferredVersionName:n}:(f(e,t),{preferredVersionName:null})}return Object.fromEntries(n.map((e=>[e,r(e)])))}({allDocsData:e,versionPersistence:n,pluginIds:t}))}),[e,n,t]);return[a,(0,o.useMemo)((()=>({savePreferredVersion:function(e,t){u(e,n,t),i((n=>({...n,[e]:{preferredVersionName:t}})))}})),[n])]}function g(e){let{children:n}=e;const t=h();return o.createElement(m.Provider,{value:t},n)}function b(e){let{children:n}=e;return i.cE?o.createElement(g,null,n):o.createElement(o.Fragment,null,n)}function v(){const e=(0,o.useContext)(m);if(!e)throw new c.i6("DocsPreferredVersionContextProvider");return e}function k(e){void 0===e&&(e=a.m);const n=(0,r.zh)(e),[t,s]=v(),{preferredVersionName:i}=t[e];return{preferredVersion:n.versions.find((e=>e.name===i))??null,savePreferredVersionName:(0,o.useCallback)((n=>{s.savePreferredVersion(e,n)}),[s,e])}}function w(){const e=(0,r._r)(),[n]=v();function t(t){const o=e[t],{preferredVersionName:r}=n[t];return o.versions.find((e=>e.name===r))??null}const o=Object.keys(e);return Object.fromEntries(o.map((e=>[e,t(e)])))}},1116:(e,n,t)=>{"use strict";t.d(n,{V:()=>c,b:()=>i});var o=t(67294),r=t(902);const a=Symbol("EmptyContext"),s=o.createContext(a);function i(e){let{children:n,name:t,items:r}=e;const a=(0,o.useMemo)((()=>t&&r?{name:t,items:r}:null),[t,r]);return o.createElement(s.Provider,{value:a},n)}function c(){const e=(0,o.useContext)(s);if(e===a)throw new r.i6("DocsSidebarProvider");return e}},74477:(e,n,t)=>{"use strict";t.d(n,{E:()=>i,q:()=>s});var o=t(67294),r=t(902);const a=o.createContext(null);function s(e){let{children:n,version:t}=e;return o.createElement(a.Provider,{value:t},n)}function i(){const e=(0,o.useContext)(a);if(null===e)throw new r.i6("DocsVersionProvider");return e}},93163:(e,n,t)=>{"use strict";t.d(n,{M:()=>u,e:()=>p});var o=t(67294),r=t(13102),a=t(87524),s=t(91980),i=t(86668),c=t(902);const l=o.createContext(void 0);function d(){const e=function(){const e=(0,r.HY)(),{items:n}=(0,i.L)().navbar;return 0===n.length&&!e.component}(),n=(0,a.i)(),t=!e&&"mobile"===n,[c,l]=(0,o.useState)(!1);(0,s.Rb)((()=>{if(c)return l(!1),!1}));const d=(0,o.useCallback)((()=>{l((e=>!e))}),[]);return(0,o.useEffect)((()=>{"desktop"===n&&l(!1)}),[n]),(0,o.useMemo)((()=>({disabled:e,shouldRender:t,toggle:d,shown:c})),[e,t,d,c])}function u(e){let{children:n}=e;const t=d();return o.createElement(l.Provider,{value:t},n)}function p(){const e=o.useContext(l);if(void 0===e)throw new c.i6("NavbarMobileSidebarProvider");return e}},13102:(e,n,t)=>{"use strict";t.d(n,{HY:()=>i,Zo:()=>c,n2:()=>s});var o=t(67294),r=t(902);const a=o.createContext(null);function s(e){let{children:n}=e;const t=(0,o.useState)({component:null,props:null});return o.createElement(a.Provider,{value:t},n)}function i(){const e=(0,o.useContext)(a);if(!e)throw new r.i6("NavbarSecondaryMenuContentProvider");return e[0]}function c(e){let{component:n,props:t}=e;const s=(0,o.useContext)(a);if(!s)throw new r.i6("NavbarSecondaryMenuContentProvider");const[,i]=s,c=(0,r.Ql)(t);return(0,o.useEffect)((()=>{i({component:n,props:c})}),[i,n,c]),(0,o.useEffect)((()=>()=>i({component:null,props:null})),[i]),null}},19727:(e,n,t)=>{"use strict";t.d(n,{h:()=>r,t:()=>a});var o=t(67294);const r="navigation-with-keyboard";function a(){(0,o.useEffect)((()=>{function e(e){"keydown"===e.type&&"Tab"===e.key&&document.body.classList.add(r),"mousedown"===e.type&&document.body.classList.remove(r)}return document.addEventListener("keydown",e),document.addEventListener("mousedown",e),()=>{document.body.classList.remove(r),document.removeEventListener("keydown",e),document.removeEventListener("mousedown",e)}}),[])}},66177:(e,n,t)=>{"use strict";t.d(n,{K:()=>s,M:()=>i});var o=t(67294),r=t(52263),a=t(91980);function s(){return(0,a.Nc)("q")}function i(){const{siteConfig:{baseUrl:e,themeConfig:n}}=(0,r.Z)(),{algolia:{searchPagePath:t}}=n;return(0,o.useCallback)((n=>`${e}${t}?q=${encodeURIComponent(n)}`),[e,t])}},87524:(e,n,t)=>{"use strict";t.d(n,{i:()=>l});var o=t(67294),r=t(10412);const a="desktop",s="mobile",i="ssr";function c(){return r.Z.canUseDOM?window.innerWidth>996?a:s:i}function l(){const[e,n]=(0,o.useState)((()=>c()));return(0,o.useEffect)((()=>{function e(){n(c())}return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e),clearTimeout(undefined)}}),[]),e}},35281:(e,n,t)=>{"use strict";t.d(n,{k:()=>o});const o={page:{blogListPage:"blog-list-page",blogPostPage:"blog-post-page",blogTagsListPage:"blog-tags-list-page",blogTagPostListPage:"blog-tags-post-list-page",docsDocPage:"docs-doc-page",docsTagsListPage:"docs-tags-list-page",docsTagDocListPage:"docs-tags-doc-list-page",mdxPage:"mdx-page"},wrapper:{main:"main-wrapper",blogPages:"blog-wrapper",docsPages:"docs-wrapper",mdxPages:"mdx-wrapper"},common:{editThisPage:"theme-edit-this-page",lastUpdated:"theme-last-updated",backToTopButton:"theme-back-to-top-button",codeBlock:"theme-code-block",admonition:"theme-admonition",admonitionType:e=>`theme-admonition-${e}`},layout:{},docs:{docVersionBanner:"theme-doc-version-banner",docVersionBadge:"theme-doc-version-badge",docBreadcrumbs:"theme-doc-breadcrumbs",docMarkdown:"theme-doc-markdown",docTocMobile:"theme-doc-toc-mobile",docTocDesktop:"theme-doc-toc-desktop",docFooter:"theme-doc-footer",docFooterTagsRow:"theme-doc-footer-tags-row",docFooterEditMetaRow:"theme-doc-footer-edit-meta-row",docSidebarContainer:"theme-doc-sidebar-container",docSidebarMenu:"theme-doc-sidebar-menu",docSidebarItemCategory:"theme-doc-sidebar-item-category",docSidebarItemLink:"theme-doc-sidebar-item-link",docSidebarItemCategoryLevel:e=>`theme-doc-sidebar-item-category-level-${e}`,docSidebarItemLinkLevel:e=>`theme-doc-sidebar-item-link-level-${e}`},blog:{}}},91442:(e,n,t)=>{"use strict";function o(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}t.d(n,{n:()=>o})},53438:(e,n,t)=>{"use strict";t.d(n,{MN:()=>E,Wl:()=>m,_F:()=>b,cE:()=>p,hI:()=>x,jA:()=>h,lO:()=>w,oz:()=>y,s1:()=>k,vY:()=>_,xz:()=>f});var o=t(67294),r=t(76775),a=t(18790),s=t(80143),i=t(60373),c=t(74477),l=t(1116),d=t(67392),u=t(48596);const p=!!s._r;function f(e){const n=(0,c.E)();if(!e)return;const t=n.docs[e];if(!t)throw new Error(`no version doc found by id=${e}`);return t}function m(e){if(e.href)return e.href;for(const n of e.items){if("link"===n.type)return n.href;if("category"===n.type){const e=m(n);if(e)return e}}}function h(){const{pathname:e}=(0,r.TH)(),n=(0,l.V)();if(!n)throw new Error("Unexpected: cant find current sidebar in context");const t=v({sidebarItems:n.items,pathname:e,onlyCategories:!0}).slice(-1)[0];if(!t)throw new Error(`${e} is not associated with a category. useCurrentSidebarCategory() should only be used on category index pages.`);return t}const g=(e,n)=>void 0!==e&&(0,u.Mg)(e,n);function b(e,n){return"link"===e.type?g(e.href,n):"category"===e.type&&(g(e.href,n)||((e,n)=>e.some((e=>b(e,n))))(e.items,n))}function v(e){let{sidebarItems:n,pathname:t,onlyCategories:o=!1}=e;const r=[];return function e(n){for(const a of n)if("category"===a.type&&((0,u.Mg)(a.href,t)||e(a.items))||"link"===a.type&&(0,u.Mg)(a.href,t)){return o&&"category"!==a.type||r.unshift(a),!0}return!1}(n),r}function k(){var e;const n=(0,l.V)(),{pathname:t}=(0,r.TH)();return!1!==(null==(e=(0,s.gA)())?void 0:e.pluginData.breadcrumbs)&&n?v({sidebarItems:n.items,pathname:t}):null}function w(e){const{activeVersion:n}=(0,s.Iw)(e),{preferredVersion:t}=(0,i.J)(e),r=(0,s.yW)(e);return(0,o.useMemo)((()=>(0,d.j)([n,t,r].filter(Boolean))),[n,t,r])}function y(e,n){const t=w(n);return(0,o.useMemo)((()=>{const n=t.flatMap((e=>e.sidebars?Object.entries(e.sidebars):[])),o=n.find((n=>n[0]===e));if(!o)throw new Error(`Can't find any sidebar with id "${e}" in version${t.length>1?"s":""} ${t.map((e=>e.name)).join(", ")}".\nAvailable sidebar ids are:\n- ${n.map((e=>e[0])).join("\n- ")}`);return o[1]}),[e,t])}function _(e,n){const t=w(n);return(0,o.useMemo)((()=>{const n=t.flatMap((e=>e.docs)),o=n.find((n=>n.id===e));if(!o){if(t.flatMap((e=>e.draftIds)).includes(e))return null;throw new Error(`Couldn't find any doc with id "${e}" in version${t.length>1?"s":""} "${t.map((e=>e.name)).join(", ")}".\nAvailable doc ids are:\n- ${(0,d.j)(n.map((e=>e.id))).join("\n- ")}`)}return o}),[e,t])}function x(e){let{route:n,versionMetadata:t}=e;const o=(0,r.TH)(),s=n.routes,i=s.find((e=>(0,r.LX)(o.pathname,e)));if(!i)return null;const c=i.sidebar,l=c?t.docsSidebars[c]:void 0;return{docElement:(0,a.H)(s),sidebarName:c,sidebarItems:l}}function E(e){return e.filter((e=>"category"!==e.type||!!m(e)))}},82128:(e,n,t)=>{"use strict";t.d(n,{p:()=>r});var o=t(52263);function r(e){const{siteConfig:n}=(0,o.Z)(),{title:t,titleDelimiter:r}=n;return null!=e&&e.trim().length?`${e.trim()} ${r} ${t}`:t}},91980:(e,n,t)=>{"use strict";t.d(n,{Nc:()=>l,Rb:()=>i,_X:()=>c});var o=t(67294),r=t(76775),a=t(61688),s=t(902);function i(e){!function(e){const n=(0,r.k6)(),t=(0,s.zX)(e);(0,o.useEffect)((()=>n.block(((e,n)=>t(e,n)))),[n,t])}(((n,t)=>{if("POP"===t)return e(n,t)}))}function c(e){return function(e){const n=(0,r.k6)();return(0,a.useSyncExternalStore)(n.listen,(()=>e(n)),(()=>e(n)))}((n=>null===e?null:new URLSearchParams(n.location.search).get(e)))}function l(e){const n=c(e)??"",t=function(){const e=(0,r.k6)();return(0,o.useCallback)(((n,t,o)=>{const r=new URLSearchParams(e.location.search);t?r.set(n,t):r.delete(n),(null!=o&&o.push?e.push:e.replace)({search:r.toString()})}),[e])}();return[n,(0,o.useCallback)(((n,o)=>{t(e,n,o)}),[t,e])]}},67392:(e,n,t)=>{"use strict";function o(e,n){return void 0===n&&(n=(e,n)=>e===n),e.filter(((t,o)=>e.findIndex((e=>n(e,t)))!==o))}function r(e){return Array.from(new Set(e))}t.d(n,{j:()=>r,l:()=>o})},10833:(e,n,t)=>{"use strict";t.d(n,{FG:()=>p,d:()=>d,VC:()=>f});var o=t(67294),r=t(86010),a=t(35742),s=t(30226);function i(){const e=o.useContext(s._);if(!e)throw new Error("Unexpected: no Docusaurus route context found");return e}var c=t(44996),l=t(82128);function d(e){let{title:n,description:t,keywords:r,image:s,children:i}=e;const d=(0,l.p)(n),{withBaseUrl:u}=(0,c.C)(),p=s?u(s,{absolute:!0}):void 0;return o.createElement(a.Z,null,n&&o.createElement("title",null,d),n&&o.createElement("meta",{property:"og:title",content:d}),t&&o.createElement("meta",{name:"description",content:t}),t&&o.createElement("meta",{property:"og:description",content:t}),r&&o.createElement("meta",{name:"keywords",content:Array.isArray(r)?r.join(","):r}),p&&o.createElement("meta",{property:"og:image",content:p}),p&&o.createElement("meta",{name:"twitter:image",content:p}),i)}const u=o.createContext(void 0);function p(e){let{className:n,children:t}=e;const s=o.useContext(u),i=(0,r.Z)(s,n);return o.createElement(u.Provider,{value:i},o.createElement(a.Z,null,o.createElement("html",{className:i})),t)}function f(e){let{children:n}=e;const t=i(),a=`plugin-${t.plugin.name.replace(/docusaurus-(?:plugin|theme)-(?:content-)?/gi,"")}`;const s=`plugin-id-${t.plugin.id}`;return o.createElement(p,{className:(0,r.Z)(a,s)},n)}},902:(e,n,t)=>{"use strict";t.d(n,{D9:()=>s,Qc:()=>l,Ql:()=>c,i6:()=>i,zX:()=>a});var o=t(67294);const r=t(10412).Z.canUseDOM?o.useLayoutEffect:o.useEffect;function a(e){const n=(0,o.useRef)(e);return r((()=>{n.current=e}),[e]),(0,o.useCallback)((function(){return n.current(...arguments)}),[])}function s(e){const n=(0,o.useRef)();return r((()=>{n.current=e})),n.current}class i extends Error{constructor(e,n){var t,o,r;super(),this.name="ReactContextError",this.message=`Hook ${(null==(t=this.stack)||null==(o=t.split("\n")[1])||null==(r=o.match(/at (?:\w+\.)?(?\w+)/))?void 0:r.groups.name)??""} is called outside the <${e}>. ${n??""}`}}function c(e){const n=Object.entries(e);return n.sort(((e,n)=>e[0].localeCompare(n[0]))),(0,o.useMemo)((()=>e),n.flat())}function l(e){return n=>{let{children:t}=n;return o.createElement(o.Fragment,null,e.reduceRight(((e,n)=>o.createElement(n,null,e)),t))}}},98022:(e,n,t)=>{"use strict";function o(e,n){return void 0!==e&&void 0!==n&&new RegExp(e,"gi").test(n)}t.d(n,{F:()=>o})},48596:(e,n,t)=>{"use strict";t.d(n,{Mg:()=>s,Ns:()=>i});var o=t(67294),r=t(723),a=t(52263);function s(e,n){const t=e=>{var n;return null==(n=!e||e.endsWith("/")?e:`${e}/`)?void 0:n.toLowerCase()};return t(e)===t(n)}function i(){const{baseUrl:e}=(0,a.Z)().siteConfig;return(0,o.useMemo)((()=>function(e){let{baseUrl:n,routes:t}=e;function o(e){return e.path===n&&!0===e.exact}function r(e){return e.path===n&&!e.exact}return function e(n){if(0===n.length)return;return n.find(o)||e(n.filter(r).flatMap((e=>e.routes??[])))}(t)}({routes:r.Z,baseUrl:e})),[e])}},12466:(e,n,t)=>{"use strict";t.d(n,{Ct:()=>f,OC:()=>c,RF:()=>u,o5:()=>p});var o=t(67294),r=t(10412),a=t(72389),s=t(902);const i=o.createContext(void 0);function c(e){let{children:n}=e;const t=function(){const e=(0,o.useRef)(!0);return(0,o.useMemo)((()=>({scrollEventsEnabledRef:e,enableScrollEvents:()=>{e.current=!0},disableScrollEvents:()=>{e.current=!1}})),[])}();return o.createElement(i.Provider,{value:t},n)}function l(){const e=(0,o.useContext)(i);if(null==e)throw new s.i6("ScrollControllerProvider");return e}const d=()=>r.Z.canUseDOM?{scrollX:window.pageXOffset,scrollY:window.pageYOffset}:null;function u(e,n){void 0===n&&(n=[]);const{scrollEventsEnabledRef:t}=l(),r=(0,o.useRef)(d()),a=(0,s.zX)(e);(0,o.useEffect)((()=>{const e=()=>{if(!t.current)return;const e=d();a(e,r.current),r.current=e},n={passive:!0};return e(),window.addEventListener("scroll",e,n),()=>window.removeEventListener("scroll",e,n)}),[a,t,...n])}function p(){const e=l(),n=function(){const e=(0,o.useRef)({elem:null,top:0}),n=(0,o.useCallback)((n=>{e.current={elem:n,top:n.getBoundingClientRect().top}}),[]),t=(0,o.useCallback)((()=>{const{current:{elem:n,top:t}}=e;if(!n)return{restored:!1};const o=n.getBoundingClientRect().top-t;return o&&window.scrollBy({left:0,top:o}),e.current={elem:null,top:0},{restored:0!==o}}),[]);return(0,o.useMemo)((()=>({save:n,restore:t})),[t,n])}(),t=(0,o.useRef)(void 0),r=(0,o.useCallback)((o=>{n.save(o),e.disableScrollEvents(),t.current=()=>{const{restored:o}=n.restore();if(t.current=void 0,o){const n=()=>{e.enableScrollEvents(),window.removeEventListener("scroll",n)};window.addEventListener("scroll",n)}else e.enableScrollEvents()}}),[e,n]);return(0,o.useLayoutEffect)((()=>{queueMicrotask((()=>null==t.current?void 0:t.current()))})),{blockElementScrollPositionUntilNextRender:r}}function f(){const e=(0,o.useRef)(null),n=(0,a.Z)()&&"smooth"===getComputedStyle(document.documentElement).scrollBehavior;return{startScroll:t=>{e.current=n?function(e){return window.scrollTo({top:e,behavior:"smooth"}),()=>{}}(t):function(e){let n=null;const t=document.documentElement.scrollTop>e;return function o(){const r=document.documentElement.scrollTop;(t&&r>e||!t&&rn&&cancelAnimationFrame(n)}(t)},cancelScroll:()=>null==e.current?void 0:e.current()}}},43320:(e,n,t)=>{"use strict";t.d(n,{HX:()=>s,_q:()=>c,os:()=>i});var o=t(80143),r=t(52263),a=t(60373);const s="default";function i(e,n){return`docs-${e}-${n}`}function c(){const{i18n:e}=(0,r.Z)(),n=(0,o._r)(),t=(0,o.WS)(),c=(0,a.Oh)();const l=[s,...Object.keys(n).map((function(e){const o=(null==t?void 0:t.activePlugin.pluginId)===e?t.activeVersion:void 0,r=c[e],a=n[e].versions.find((e=>e.isLast));return i(e,(o??r??a).name)}))];return{locale:e.currentLocale,tags:l}}},50012:(e,n,t)=>{"use strict";t.d(n,{Nk:()=>u,WA:()=>d});var o=t(67294),r=t(61688);const a="localStorage";function s(e){let{key:n,oldValue:t,newValue:o,storage:r}=e;if(t===o)return;const a=document.createEvent("StorageEvent");a.initStorageEvent("storage",!1,!1,n,t,o,window.location.href,r),window.dispatchEvent(a)}function i(e){if(void 0===e&&(e=a),"undefined"==typeof window)throw new Error("Browser storage is not available on Node.js/Docusaurus SSR process.");if("none"===e)return null;try{return window[e]}catch(t){return n=t,c||(console.warn("Docusaurus browser storage is not available.\nPossible reasons: running Docusaurus in an iframe, in an incognito browser session, or using too strict browser privacy settings.",n),c=!0),null}var n}let c=!1;const l={get:()=>null,set:()=>{},del:()=>{},listen:()=>()=>{}};function d(e,n){if("undefined"==typeof window)return function(e){function n(){throw new Error(`Illegal storage API usage for storage key "${e}".\nDocusaurus storage APIs are not supposed to be called on the server-rendering process.\nPlease only call storage APIs in effects and event handlers.`)}return{get:n,set:n,del:n,listen:n}}(e);const t=i(null==n?void 0:n.persistence);return null===t?l:{get:()=>{try{return t.getItem(e)}catch(n){return console.error(`Docusaurus storage error, can't get key=${e}`,n),null}},set:n=>{try{const o=t.getItem(e);t.setItem(e,n),s({key:e,oldValue:o,newValue:n,storage:t})}catch(o){console.error(`Docusaurus storage error, can't set ${e}=${n}`,o)}},del:()=>{try{const n=t.getItem(e);t.removeItem(e),s({key:e,oldValue:n,newValue:null,storage:t})}catch(n){console.error(`Docusaurus storage error, can't delete key=${e}`,n)}},listen:n=>{try{const o=o=>{o.storageArea===t&&o.key===e&&n(o)};return window.addEventListener("storage",o),()=>window.removeEventListener("storage",o)}catch(o){return console.error(`Docusaurus storage error, can't listen for changes of key=${e}`,o),()=>{}}}}}function u(e,n){const t=(0,o.useRef)((()=>null===e?l:d(e,n))).current(),a=(0,o.useCallback)((e=>"undefined"==typeof window?()=>{}:t.listen(e)),[t]);return[(0,r.useSyncExternalStore)(a,(()=>"undefined"==typeof window?null:t.get()),(()=>null)),t]}},94711:(e,n,t)=>{"use strict";t.d(n,{l:()=>a});var o=t(52263),r=t(76775);function a(){const{siteConfig:{baseUrl:e,url:n},i18n:{defaultLocale:t,currentLocale:a}}=(0,o.Z)(),{pathname:s}=(0,r.TH)(),i=a===t?e:e.replace(`/${a}/`,"/"),c=s.replace(e,"");return{createUrl:function(e){let{locale:o,fullyQualified:r}=e;return`${r?n:""}${function(e){return e===t?`${i}`:`${i}${e}/`}(o)}${c}`}}}},85936:(e,n,t)=>{"use strict";t.d(n,{S:()=>s});var o=t(67294),r=t(76775),a=t(902);function s(e){const n=(0,r.TH)(),t=(0,a.D9)(n),s=(0,a.zX)(e);(0,o.useEffect)((()=>{t&&n!==t&&s({location:n,previousLocation:t})}),[s,n,t])}},86668:(e,n,t)=>{"use strict";t.d(n,{L:()=>r});var o=t(52263);function r(){return(0,o.Z)().siteConfig.themeConfig}},6278:(e,n,t)=>{"use strict";t.d(n,{L:()=>r});var o=t(52263);function r(){const{siteConfig:{themeConfig:e}}=(0,o.Z)();return e}},239:(e,n,t)=>{"use strict";t.d(n,{l:()=>i});var o=t(67294),r=t(98022),a=t(44996),s=t(6278);function i(){const{withBaseUrl:e}=(0,a.C)(),{algolia:{externalUrlRegex:n,replaceSearchResultPathname:t}}=(0,s.L)();return(0,o.useCallback)((o=>{const a=new URL(o);if((0,r.F)(n,a.href))return o;const s=`${a.pathname+a.hash}`;return e(function(e,n){return n?e.replaceAll(new RegExp(n.from,"g"),n.to):e}(s,t))}),[e,n,t])}},8802:(e,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e,n){const{trailingSlash:t,baseUrl:o}=n;if(e.startsWith("#"))return e;if(void 0===t)return e;const[r]=e.split(/[#?]/),a="/"===r||r===o?r:(s=r,t?function(e){return e.endsWith("/")?e:`${e}/`}(s):function(e){return e.endsWith("/")?e.slice(0,-1):e}(s));var s;return e.replace(r,a)}},54143:(e,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.getErrorCausalChain=void 0,n.getErrorCausalChain=function e(n){return n.cause?[n,...e(n.cause)]:[n]}},18780:function(e,n,t){"use strict";var o=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(n,"__esModule",{value:!0}),n.getErrorCausalChain=n.applyTrailingSlash=n.blogPostContainerID=void 0,n.blogPostContainerID="__blog-post-container";var r=t(8802);Object.defineProperty(n,"applyTrailingSlash",{enumerable:!0,get:function(){return o(r).default}});var a=t(54143);Object.defineProperty(n,"getErrorCausalChain",{enumerable:!0,get:function(){return a.getErrorCausalChain}})},86010:(e,n,t)=>{"use strict";function o(e){var n,t,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(n=0;nr});const r=function(){for(var e,n,t=0,r="";t{"use strict";t.d(n,{lX:()=>w,q_:()=>C,ob:()=>f,PP:()=>A,Ep:()=>p});var o=t(87462);function r(e){return"/"===e.charAt(0)}function a(e,n){for(var t=n,o=t+1,r=e.length;o=0;p--){var f=s[p];"."===f?a(s,p):".."===f?(a(s,p),u++):u&&(a(s,p),u--)}if(!l)for(;u--;u)s.unshift("..");!l||""===s[0]||s[0]&&r(s[0])||s.unshift("");var m=s.join("/");return t&&"/"!==m.substr(-1)&&(m+="/"),m};var i=t(2177);function c(e){return"/"===e.charAt(0)?e:"/"+e}function l(e){return"/"===e.charAt(0)?e.substr(1):e}function d(e,n){return function(e,n){return 0===e.toLowerCase().indexOf(n.toLowerCase())&&-1!=="/?#".indexOf(e.charAt(n.length))}(e,n)?e.substr(n.length):e}function u(e){return"/"===e.charAt(e.length-1)?e.slice(0,-1):e}function p(e){var n=e.pathname,t=e.search,o=e.hash,r=n||"/";return t&&"?"!==t&&(r+="?"===t.charAt(0)?t:"?"+t),o&&"#"!==o&&(r+="#"===o.charAt(0)?o:"#"+o),r}function f(e,n,t,r){var a;"string"==typeof e?(a=function(e){var n=e||"/",t="",o="",r=n.indexOf("#");-1!==r&&(o=n.substr(r),n=n.substr(0,r));var a=n.indexOf("?");return-1!==a&&(t=n.substr(a),n=n.substr(0,a)),{pathname:n,search:"?"===t?"":t,hash:"#"===o?"":o}}(e),a.state=n):(void 0===(a=(0,o.Z)({},e)).pathname&&(a.pathname=""),a.search?"?"!==a.search.charAt(0)&&(a.search="?"+a.search):a.search="",a.hash?"#"!==a.hash.charAt(0)&&(a.hash="#"+a.hash):a.hash="",void 0!==n&&void 0===a.state&&(a.state=n));try{a.pathname=decodeURI(a.pathname)}catch(i){throw i instanceof URIError?new URIError('Pathname "'+a.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):i}return t&&(a.key=t),r?a.pathname?"/"!==a.pathname.charAt(0)&&(a.pathname=s(a.pathname,r.pathname)):a.pathname=r.pathname:a.pathname||(a.pathname="/"),a}function m(){var e=null;var n=[];return{setPrompt:function(n){return e=n,function(){e===n&&(e=null)}},confirmTransitionTo:function(n,t,o,r){if(null!=e){var a="function"==typeof e?e(n,t):e;"string"==typeof a?"function"==typeof o?o(a,r):r(!0):r(!1!==a)}else r(!0)},appendListener:function(e){var t=!0;function o(){t&&e.apply(void 0,arguments)}return n.push(o),function(){t=!1,n=n.filter((function(e){return e!==o}))}},notifyListeners:function(){for(var e=arguments.length,t=new Array(e),o=0;on?t.splice(n,t.length-n,r):t.push(r),u({action:o,location:r,index:n,entries:t})}}))},replace:function(e,n){var o="REPLACE",r=f(e,n,h(),w.location);d.confirmTransitionTo(r,o,t,(function(e){e&&(w.entries[w.index]=r,u({action:o,location:r}))}))},go:k,goBack:function(){k(-1)},goForward:function(){k(1)},canGo:function(e){var n=w.index+e;return n>=0&&n{"use strict";var o=t(59864),r={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},a={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},s={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},i={};function c(e){return o.isMemo(e)?s:i[e.$$typeof]||r}i[o.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},i[o.Memo]=s;var l=Object.defineProperty,d=Object.getOwnPropertyNames,u=Object.getOwnPropertySymbols,p=Object.getOwnPropertyDescriptor,f=Object.getPrototypeOf,m=Object.prototype;e.exports=function e(n,t,o){if("string"!=typeof t){if(m){var r=f(t);r&&r!==m&&e(n,r,o)}var s=d(t);u&&(s=s.concat(u(t)));for(var i=c(n),h=c(t),g=0;g{"use strict";e.exports=function(e,n,t,o,r,a,s,i){if(!e){var c;if(void 0===n)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[t,o,r,a,s,i],d=0;(c=new Error(n.replace(/%s/g,(function(){return l[d++]})))).name="Invariant Violation"}throw c.framesToPop=1,c}}},5826:e=>{e.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},32497:(e,n,t)=>{"use strict";t.r(n)},52295:(e,n,t)=>{"use strict";t.r(n)},74865:function(e,n,t){var o,r;o=function(){var e,n,t={version:"0.2.0"},o=t.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'
'};function r(e,n,t){return et?t:e}function a(e){return 100*(-1+e)}function s(e,n,t){var r;return(r="translate3d"===o.positionUsing?{transform:"translate3d("+a(e)+"%,0,0)"}:"translate"===o.positionUsing?{transform:"translate("+a(e)+"%,0)"}:{"margin-left":a(e)+"%"}).transition="all "+n+"ms "+t,r}t.configure=function(e){var n,t;for(n in e)void 0!==(t=e[n])&&e.hasOwnProperty(n)&&(o[n]=t);return this},t.status=null,t.set=function(e){var n=t.isStarted();e=r(e,o.minimum,1),t.status=1===e?null:e;var a=t.render(!n),l=a.querySelector(o.barSelector),d=o.speed,u=o.easing;return a.offsetWidth,i((function(n){""===o.positionUsing&&(o.positionUsing=t.getPositioningCSS()),c(l,s(e,d,u)),1===e?(c(a,{transition:"none",opacity:1}),a.offsetWidth,setTimeout((function(){c(a,{transition:"all "+d+"ms linear",opacity:0}),setTimeout((function(){t.remove(),n()}),d)}),d)):setTimeout(n,d)})),this},t.isStarted=function(){return"number"==typeof t.status},t.start=function(){t.status||t.set(0);var e=function(){setTimeout((function(){t.status&&(t.trickle(),e())}),o.trickleSpeed)};return o.trickle&&e(),this},t.done=function(e){return e||t.status?t.inc(.3+.5*Math.random()).set(1):this},t.inc=function(e){var n=t.status;return n?("number"!=typeof e&&(e=(1-n)*r(Math.random()*n,.1,.95)),n=r(n+e,0,.994),t.set(n)):t.start()},t.trickle=function(){return t.inc(Math.random()*o.trickleRate)},e=0,n=0,t.promise=function(o){return o&&"resolved"!==o.state()?(0===n&&t.start(),e++,n++,o.always((function(){0==--n?(e=0,t.done()):t.set((e-n)/e)})),this):this},t.render=function(e){if(t.isRendered())return document.getElementById("nprogress");d(document.documentElement,"nprogress-busy");var n=document.createElement("div");n.id="nprogress",n.innerHTML=o.template;var r,s=n.querySelector(o.barSelector),i=e?"-100":a(t.status||0),l=document.querySelector(o.parent);return c(s,{transition:"all 0 linear",transform:"translate3d("+i+"%,0,0)"}),o.showSpinner||(r=n.querySelector(o.spinnerSelector))&&f(r),l!=document.body&&d(l,"nprogress-custom-parent"),l.appendChild(n),n},t.remove=function(){u(document.documentElement,"nprogress-busy"),u(document.querySelector(o.parent),"nprogress-custom-parent");var e=document.getElementById("nprogress");e&&f(e)},t.isRendered=function(){return!!document.getElementById("nprogress")},t.getPositioningCSS=function(){var e=document.body.style,n="WebkitTransform"in e?"Webkit":"MozTransform"in e?"Moz":"msTransform"in e?"ms":"OTransform"in e?"O":"";return n+"Perspective"in e?"translate3d":n+"Transform"in e?"translate":"margin"};var i=function(){var e=[];function n(){var t=e.shift();t&&t(n)}return function(t){e.push(t),1==e.length&&n()}}(),c=function(){var e=["Webkit","O","Moz","ms"],n={};function t(e){return e.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,(function(e,n){return n.toUpperCase()}))}function o(n){var t=document.body.style;if(n in t)return n;for(var o,r=e.length,a=n.charAt(0).toUpperCase()+n.slice(1);r--;)if((o=e[r]+a)in t)return o;return n}function r(e){return e=t(e),n[e]||(n[e]=o(e))}function a(e,n,t){n=r(n),e.style[n]=t}return function(e,n){var t,o,r=arguments;if(2==r.length)for(t in n)void 0!==(o=n[t])&&n.hasOwnProperty(t)&&a(e,t,o);else a(e,r[1],r[2])}}();function l(e,n){return("string"==typeof e?e:p(e)).indexOf(" "+n+" ")>=0}function d(e,n){var t=p(e),o=t+n;l(t,n)||(e.className=o.substring(1))}function u(e,n){var t,o=p(e);l(e,n)&&(t=o.replace(" "+n+" "," "),e.className=t.substring(1,t.length-1))}function p(e){return(" "+(e.className||"")+" ").replace(/\s+/gi," ")}function f(e){e&&e.parentNode&&e.parentNode.removeChild(e)}return t},void 0===(r="function"==typeof o?o.call(n,t,n,e):o)||(e.exports=r)},27418:e=>{"use strict";var n=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function r(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var n={},t=0;t<10;t++)n["_"+String.fromCharCode(t)]=t;if("0123456789"!==Object.getOwnPropertyNames(n).map((function(e){return n[e]})).join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach((function(e){o[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(r){return!1}}()?Object.assign:function(e,a){for(var s,i,c=r(e),l=1;l{var o=t(5826);e.exports=f,e.exports.parse=a,e.exports.compile=function(e,n){return i(a(e,n),n)},e.exports.tokensToFunction=i,e.exports.tokensToRegExp=p;var r=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function a(e,n){for(var t,o=[],a=0,s=0,i="",d=n&&n.delimiter||"/";null!=(t=r.exec(e));){var u=t[0],p=t[1],f=t.index;if(i+=e.slice(s,f),s=f+u.length,p)i+=p[1];else{var m=e[s],h=t[2],g=t[3],b=t[4],v=t[5],k=t[6],w=t[7];i&&(o.push(i),i="");var y=null!=h&&null!=m&&m!==h,_="+"===k||"*"===k,x="?"===k||"*"===k,E=t[2]||d,S=b||v;o.push({name:g||a++,prefix:h||"",delimiter:E,optional:x,repeat:_,partial:y,asterisk:!!w,pattern:S?l(S):w?".*":"[^"+c(E)+"]+?"})}}return s{"use strict";t.d(n,{Z:()=>a});var o=function(){var e=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,t={},o={util:{encode:function e(n){return n instanceof r?new r(n.type,e(n.content),n.alias):Array.isArray(n)?n.map(e):n.replace(/&/g,"&").replace(/=u.reach);x+=_.value.length,_=_.next){var E=_.value;if(n.length>e.length)return;if(!(E instanceof r)){var S,C=1;if(v){if(!(S=a(y,x,e,b))||S.index>=e.length)break;var T=S.index,A=S.index+S[0].length,L=x;for(L+=_.value.length;T>=L;)L+=(_=_.next).value.length;if(x=L-=_.value.length,_.value instanceof r)continue;for(var P=_;P!==n.tail&&(Lu.reach&&(u.reach=I);var D=_.prev;if(N&&(D=c(n,D,N),x+=N.length),l(n,D,C),_=c(n,D,new r(p,g?o.tokenize(R,g):R,k,R)),O&&c(n,_,O),C>1){var M={cause:p+","+m,reach:I};s(e,n,t,_.prev,x,M),u&&M.reach>u.reach&&(u.reach=M.reach)}}}}}}function i(){var e={value:null,prev:null,next:null},n={value:null,prev:e,next:null};e.next=n,this.head=e,this.tail=n,this.length=0}function c(e,n,t){var o=n.next,r={value:t,prev:n,next:o};return n.next=r,o.prev=r,e.length++,r}function l(e,n,t){for(var o=n.next,r=0;r"+a.content+""},o}(),r=o;o.default=o,r.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},r.languages.markup.tag.inside["attr-value"].inside.entity=r.languages.markup.entity,r.languages.markup.doctype.inside["internal-subset"].inside=r.languages.markup,r.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(r.languages.markup.tag,"addInlined",{value:function(e,n){var t={};t["language-"+n]={pattern:/(^$)/i,lookbehind:!0,inside:r.languages[n]},t.cdata=/^$/i;var o={"included-cdata":{pattern://i,inside:t}};o["language-"+n]={pattern:/[\s\S]+/,inside:r.languages[n]};var a={};a[e]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:o},r.languages.insertBefore("markup","cdata",a)}}),Object.defineProperty(r.languages.markup.tag,"addAttribute",{value:function(e,n){r.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[n,"language-"+n],inside:r.languages[n]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),r.languages.html=r.languages.markup,r.languages.mathml=r.languages.markup,r.languages.svg=r.languages.markup,r.languages.xml=r.languages.extend("markup",{}),r.languages.ssml=r.languages.xml,r.languages.atom=r.languages.xml,r.languages.rss=r.languages.xml,function(e){var n="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",t={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},o={bash:t,environment:{pattern:RegExp("\\$"+n),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+n),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+n),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:o},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:t}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:o},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:o.entity}}],environment:{pattern:RegExp("\\$?"+n),alias:"constant"},variable:o.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},t.inside=e.languages.bash;for(var r=["comment","function-name","for-or-select","assign-left","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],a=o.variable[1].inside,s=0;s]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},r.languages.c=r.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),r.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),r.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},r.languages.c.string],char:r.languages.c.char,comment:r.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:r.languages.c}}}}),r.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete r.languages.c.boolean,function(e){var n=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,t=/\b(?!)\w+(?:\s*\.\s*\w+)*\b/.source.replace(//g,(function(){return n.source}));e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!)\w+/.source.replace(//g,(function(){return n.source}))),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:n,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/(?:\s*:\s*)?|:\s*/.source.replace(//g,(function(){return t}))+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),e.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e.languages.cpp}}}}),e.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),e.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend("cpp",{})}}),e.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp["base-clause"])}(r),function(e){var n=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+n.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+n.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+n.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:n,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var t=e.languages.markup;t&&(t.tag.addInlined("style","css"),t.tag.addAttribute("style","css"))}(r),function(e){var n,t=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;e.languages.css.selector={pattern:e.languages.css.selector.pattern,lookbehind:!0,inside:n={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-\w]+/,id:/#[-\w]+/,attribute:{pattern:RegExp("\\[(?:[^[\\]\"']|"+t.source+")*\\]"),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)(?:(?!\s)[-*\w\xA0-\uFFFF])*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+/,lookbehind:!0},"attr-value":[t,{pattern:/(=\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],combinator:/>|\+|~|\|\|/,punctuation:/[(),]/}},e.languages.css.atrule.inside["selector-function-argument"].inside=n,e.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*/i,lookbehind:!0}});var o={pattern:/(\b\d+)(?:%|[a-z]+(?![\w-]))/,lookbehind:!0},r={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0};e.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#[\da-f]{3,8}\b/i,alias:"color"},color:[{pattern:/(^|[^\w-])(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)(?![\w-])/i,lookbehind:!0},{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:o,number:r,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:o,number:r})}(r),r.languages.javascript=r.languages.extend("clike",{"class-name":[r.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),r.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,r.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:r.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:r.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:r.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:r.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:r.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),r.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:r.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),r.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),r.languages.markup&&(r.languages.markup.tag.addInlined("script","javascript"),r.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),r.languages.js=r.languages.javascript,function(e){var n=/#(?!\{).+/,t={pattern:/#\{[^}]+\}/,alias:"variable"};e.languages.coffeescript=e.languages.extend("javascript",{comment:n,string:[{pattern:/'(?:\\[\s\S]|[^\\'])*'/,greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0,inside:{interpolation:t}}],keyword:/\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,"class-member":{pattern:/@(?!\d)\w+/,alias:"variable"}}),e.languages.insertBefore("coffeescript","comment",{"multiline-comment":{pattern:/###[\s\S]+?###/,alias:"comment"},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:"regex",inside:{comment:n,interpolation:t}}}),e.languages.insertBefore("coffeescript","string",{"inline-javascript":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,inside:{delimiter:{pattern:/^`|`$/,alias:"punctuation"},script:{pattern:/[\s\S]+/,alias:"language-javascript",inside:e.languages.javascript}}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,greedy:!0,alias:"string"},{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:"string",inside:{interpolation:t}}]}),e.languages.insertBefore("coffeescript","keyword",{property:/(?!\d)\w+(?=\s*:(?!:))/}),delete e.languages.coffeescript["template-string"],e.languages.coffee=e.languages.coffeescript}(r),function(e){var n=/[*&][^\s[\]{},]+/,t=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,o="(?:"+t.source+"(?:[ \t]+"+n.source+")?|"+n.source+"(?:[ \t]+"+t.source+")?)",r=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-])(?:[ \t]*(?:(?![#:])|:))*/.source.replace(//g,(function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source})),a=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function s(e,n){n=(n||"").replace(/m/g,"")+"m";var t=/([:\-,[{]\s*(?:\s<>[ \t]+)?)(?:<>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<>/g,(function(){return o})).replace(/<>/g,(function(){return e}));return RegExp(t,n)}e.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<>/g,(function(){return o}))),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<>[ \t]+)?)<>(?=\s*:\s)/.source.replace(/<>/g,(function(){return o})).replace(/<>/g,(function(){return"(?:"+r+"|"+a+")"}))),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:s(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:s(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:s(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:s(a),lookbehind:!0,greedy:!0},number:{pattern:s(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:t,important:n,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml}(r),function(e){var n=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function t(e){return e=e.replace(//g,(function(){return n})),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var o=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,r=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,(function(){return o})),a=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+r+a+"(?:"+r+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+r+a+")(?:"+r+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(o),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+r+")"+a+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+r+"$"),inside:{"table-header":{pattern:RegExp(o),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:t(/\b__(?:(?!_)|_(?:(?!_))+_)+__\b|\*\*(?:(?!\*)|\*(?:(?!\*))+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:t(/\b_(?:(?!_)|__(?:(?!_))+__)+_\b|\*(?:(?!\*)|\*\*(?:(?!\*))+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:t(/(~~?)(?:(?!~))+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:t(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\]))+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach((function(n){["url","bold","italic","strike","code-snippet"].forEach((function(t){n!==t&&(e.languages.markdown[n].inside.content.inside[t]=e.languages.markdown[t])}))})),e.hooks.add("after-tokenize",(function(e){"markdown"!==e.language&&"md"!==e.language||function e(n){if(n&&"string"!=typeof n)for(var t=0,o=n.length;t",quot:'"'},c=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(r),r.languages.graphql={comment:/#.*/,description:{pattern:/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,greedy:!0,alias:"string",inside:{"language-markdown":{pattern:/(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,lookbehind:!0,inside:r.languages.markdown}}},string:{pattern:/"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,boolean:/\b(?:false|true)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:"function"},"attr-name":{pattern:/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,greedy:!0},"atom-input":{pattern:/\b[A-Z]\w*Input\b/,alias:"class-name"},scalar:/\b(?:Boolean|Float|ID|Int|String)\b/,constant:/\b[A-Z][A-Z_\d]*\b/,"class-name":{pattern:/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,lookbehind:!0},fragment:{pattern:/(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-mutation":{pattern:/(\bmutation\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-query":{pattern:/(\bquery\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},keyword:/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,operator:/[!=|&]|\.{3}/,"property-query":/\w+(?=\s*\()/,object:/\w+(?=\s*\{)/,punctuation:/[!(){}\[\]:=,]/,property:/\w+/},r.hooks.add("after-tokenize",(function(e){if("graphql"===e.language)for(var n=e.tokens.filter((function(e){return"string"!=typeof e&&"comment"!==e.type&&"scalar"!==e.type})),t=0;t0)){var i=p(/^\{$/,/^\}$/);if(-1===i)continue;for(var c=t;c=0&&f(l,"variable-input")}}}}function d(e){return n[t+e]}function u(e,n){n=n||0;for(var t=0;t?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},function(e){var n=e.languages.javascript["template-string"],t=n.pattern.source,o=n.inside.interpolation,r=o.inside["interpolation-punctuation"],a=o.pattern.source;function s(n,o){if(e.languages[n])return{pattern:RegExp("((?:"+o+")\\s*)"+t),lookbehind:!0,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},"embedded-code":{pattern:/[\s\S]+/,alias:n}}}}function i(e,n){return"___"+n.toUpperCase()+"_"+e+"___"}function c(n,t,o){var r={code:n,grammar:t,language:o};return e.hooks.run("before-tokenize",r),r.tokens=e.tokenize(r.code,r.grammar),e.hooks.run("after-tokenize",r),r.tokens}function l(n){var t={};t["interpolation-punctuation"]=r;var a=e.tokenize(n,t);if(3===a.length){var s=[1,1];s.push.apply(s,c(a[1],e.languages.javascript,"javascript")),a.splice.apply(a,s)}return new e.Token("interpolation",a,o.alias,n)}function d(n,t,o){var r=e.tokenize(n,{interpolation:{pattern:RegExp(a),lookbehind:!0}}),s=0,d={},u=c(r.map((function(e){if("string"==typeof e)return e;for(var t,r=e.content;-1!==n.indexOf(t=i(s++,o)););return d[t]=r,t})).join(""),t,o),p=Object.keys(d);return s=0,function e(n){for(var t=0;t=p.length)return;var o=n[t];if("string"==typeof o||"string"==typeof o.content){var r=p[s],a="string"==typeof o?o:o.content,i=a.indexOf(r);if(-1!==i){++s;var c=a.substring(0,i),u=l(d[r]),f=a.substring(i+r.length),m=[];if(c&&m.push(c),m.push(u),f){var h=[f];e(h),m.push.apply(m,h)}"string"==typeof o?(n.splice.apply(n,[t,1].concat(m)),t+=m.length-1):o.content=m}}else{var g=o.content;Array.isArray(g)?e(g):e([g])}}}(u),new e.Token(o,u,"language-"+o,n)}e.languages.javascript["template-string"]=[s("css",/\b(?:styled(?:\([^)]*\))?(?:\s*\.\s*\w+(?:\([^)]*\))*)*|css(?:\s*\.\s*(?:global|resolve))?|createGlobalStyle|keyframes)/.source),s("html",/\bhtml|\.\s*(?:inner|outer)HTML\s*\+?=/.source),s("svg",/\bsvg/.source),s("markdown",/\b(?:markdown|md)/.source),s("graphql",/\b(?:gql|graphql(?:\s*\.\s*experimental)?)/.source),s("sql",/\bsql/.source),n].filter(Boolean);var u={javascript:!0,js:!0,typescript:!0,ts:!0,jsx:!0,tsx:!0};function p(e){return"string"==typeof e?e:Array.isArray(e)?e.map(p).join(""):p(e.content)}e.hooks.add("after-tokenize",(function(n){n.language in u&&function n(t){for(var o=0,r=t.length;o]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var n=e.languages.extend("typescript",{});delete n["class-name"],e.languages.typescript["class-name"].inside=n,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:n}}}}),e.languages.ts=e.languages.typescript}(r),function(e){function n(e,n){return RegExp(e.replace(//g,(function(){return/(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/.source})),n)}e.languages.insertBefore("javascript","function-variable",{"method-variable":{pattern:RegExp("(\\.\\s*)"+e.languages.javascript["function-variable"].pattern.source),lookbehind:!0,alias:["function-variable","method","function","property-access"]}}),e.languages.insertBefore("javascript","function",{method:{pattern:RegExp("(\\.\\s*)"+e.languages.javascript.function.source),lookbehind:!0,alias:["function","property-access"]}}),e.languages.insertBefore("javascript","constant",{"known-class-name":[{pattern:/\b(?:(?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)?Array|ArrayBuffer|BigInt|Boolean|DataView|Date|Error|Function|Intl|JSON|(?:Weak)?(?:Map|Set)|Math|Number|Object|Promise|Proxy|Reflect|RegExp|String|Symbol|WebAssembly)\b/,alias:"class-name"},{pattern:/\b(?:[A-Z]\w*)Error\b/,alias:"class-name"}]}),e.languages.insertBefore("javascript","keyword",{imports:{pattern:n(/(\bimport\b\s*)(?:(?:\s*,\s*(?:\*\s*as\s+|\{[^{}]*\}))?|\*\s*as\s+|\{[^{}]*\})(?=\s*\bfrom\b)/.source),lookbehind:!0,inside:e.languages.javascript},exports:{pattern:n(/(\bexport\b\s*)(?:\*(?:\s*as\s+)?(?=\s*\bfrom\b)|\{[^{}]*\})/.source),lookbehind:!0,inside:e.languages.javascript}}),e.languages.javascript.keyword.unshift({pattern:/\b(?:as|default|export|from|import)\b/,alias:"module"},{pattern:/\b(?:await|break|catch|continue|do|else|finally|for|if|return|switch|throw|try|while|yield)\b/,alias:"control-flow"},{pattern:/\bnull\b/,alias:["null","nil"]},{pattern:/\bundefined\b/,alias:"nil"}),e.languages.insertBefore("javascript","operator",{spread:{pattern:/\.{3}/,alias:"operator"},arrow:{pattern:/=>/,alias:"operator"}}),e.languages.insertBefore("javascript","punctuation",{"property-access":{pattern:n(/(\.\s*)#?/.source),lookbehind:!0},"maybe-class-name":{pattern:/(^|[^$\w\xA0-\uFFFF])[A-Z][$\w\xA0-\uFFFF]+/,lookbehind:!0},dom:{pattern:/\b(?:document|(?:local|session)Storage|location|navigator|performance|window)\b/,alias:"variable"},console:{pattern:/\bconsole(?=\s*\.)/,alias:"class-name"}});for(var t=["function","function-variable","method","method-variable","property-access"],o=0;o*\.{3}(?:[^{}]|)*\})/.source;function a(e,n){return e=e.replace(//g,(function(){return t})).replace(//g,(function(){return o})).replace(//g,(function(){return r})),RegExp(e,n)}r=a(r).source,e.languages.jsx=e.languages.extend("markup",n),e.languages.jsx.tag.pattern=a(/<\/?(?:[\w.:-]+(?:+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|))?|))**\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=n.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:a(//.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:a(/=/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);var s=function(e){return e?"string"==typeof e?e:"string"==typeof e.content?e.content:e.content.map(s).join(""):""},i=function(n){for(var t=[],o=0;o0&&t[t.length-1].tagName===s(r.content[0].content[1])&&t.pop():"/>"===r.content[r.content.length-1].content||t.push({tagName:s(r.content[0].content[1]),openedBraces:0}):t.length>0&&"punctuation"===r.type&&"{"===r.content?t[t.length-1].openedBraces++:t.length>0&&t[t.length-1].openedBraces>0&&"punctuation"===r.type&&"}"===r.content?t[t.length-1].openedBraces--:a=!0),(a||"string"==typeof r)&&t.length>0&&0===t[t.length-1].openedBraces){var c=s(r);o0&&("string"==typeof n[o-1]||"plain-text"===n[o-1].type)&&(c=s(n[o-1])+c,n.splice(o-1,1),o--),n[o]=new e.Token("plain-text",c,null,c)}r.content&&"string"!=typeof r.content&&i(r.content)}};e.hooks.add("after-tokenize",(function(e){"jsx"!==e.language&&"tsx"!==e.language||i(e.tokens)}))}(r),function(e){e.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var n={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(n).forEach((function(t){var o=n[t],r=[];/^\w+$/.test(t)||r.push(/\w+/.exec(t)[0]),"diff"===t&&r.push("bold"),e.languages.diff[t]={pattern:RegExp("^(?:["+o+"].*(?:\r\n?|\n|(?![\\s\\S])))+","m"),alias:r,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(t)[0]}}}})),Object.defineProperty(e.languages.diff,"PREFIXES",{value:n})}(r),r.languages.git={comment:/^#.*/m,deleted:/^[-\u2013].*/m,inserted:/^\+.*/m,string:/("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,command:{pattern:/^.*\$ git .*$/m,inside:{parameter:/\s--?\w+/}},coord:/^@@.*@@$/m,"commit-sha1":/^commit \w{40}$/m},r.languages.go=r.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),r.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete r.languages.go["class-name"],function(e){function n(e,n){return"___"+e.toUpperCase()+n+"___"}Object.defineProperties(e.languages["markup-templating"]={},{buildPlaceholders:{value:function(t,o,r,a){if(t.language===o){var s=t.tokenStack=[];t.code=t.code.replace(r,(function(e){if("function"==typeof a&&!a(e))return e;for(var r,i=s.length;-1!==t.code.indexOf(r=n(o,i));)++i;return s[i]=e,r})),t.grammar=e.languages.markup}}},tokenizePlaceholders:{value:function(t,o){if(t.language===o&&t.tokenStack){t.grammar=e.languages[o];var r=0,a=Object.keys(t.tokenStack);!function s(i){for(var c=0;c=a.length);c++){var l=i[c];if("string"==typeof l||l.content&&"string"==typeof l.content){var d=a[r],u=t.tokenStack[d],p="string"==typeof l?l:l.content,f=n(o,d),m=p.indexOf(f);if(m>-1){++r;var h=p.substring(0,m),g=new e.Token(o,e.tokenize(u,t.grammar),"language-"+o,u),b=p.substring(m+f.length),v=[];h&&v.push.apply(v,s([h])),v.push(g),b&&v.push.apply(v,s([b])),"string"==typeof l?i.splice.apply(i,[c,1].concat(v)):l.content=v}}else l.content&&s(l.content)}return i}(t.tokens)}}}})}(r),function(e){e.languages.handlebars={comment:/\{\{![\s\S]*?\}\}/,delimiter:{pattern:/^\{\{\{?|\}\}\}?$/,alias:"punctuation"},string:/(["'])(?:\\.|(?!\1)[^\\\r\n])*\1/,number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][+-]?\d+)?/,boolean:/\b(?:false|true)\b/,block:{pattern:/^(\s*(?:~\s*)?)[#\/]\S+?(?=\s*(?:~\s*)?$|\s)/,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/,variable:/[\s\S]+/}},punctuation:/[!"#%&':()*+,.\/;<=>@\[\\\]^`{|}~]/,variable:/[^!"#%&'()*+,\/;<=>@\[\\\]^`{|}~\s]+/},e.hooks.add("before-tokenize",(function(n){e.languages["markup-templating"].buildPlaceholders(n,"handlebars",/\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/g)})),e.hooks.add("after-tokenize",(function(n){e.languages["markup-templating"].tokenizePlaceholders(n,"handlebars")})),e.languages.hbs=e.languages.handlebars}(r),r.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},r.languages.webmanifest=r.languages.json,r.languages.less=r.languages.extend("css",{comment:[/\/\*[\s\S]*?\*\//,{pattern:/(^|[^\\])\/\/.*/,lookbehind:!0}],atrule:{pattern:/@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{punctuation:/[:()]/}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{variable:/@+[\w-]+/}},property:/(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,operator:/[+\-*\/]/}),r.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,lookbehind:!0,alias:"function"}}),r.languages.makefile={comment:{pattern:/(^|[^\\])#(?:\\(?:\r\n|[\s\S])|[^\\\r\n])*/,lookbehind:!0},string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"builtin-target":{pattern:/\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,alias:"builtin"},target:{pattern:/^(?:[^:=\s]|[ \t]+(?![\s:]))+(?=\s*:(?!=))/m,alias:"symbol",inside:{variable:/\$+(?:(?!\$)[^(){}:#=\s]+|(?=[({]))/}},variable:/\$+(?:(?!\$)[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,keyword:/-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,function:{pattern:/(\()(?:abspath|addsuffix|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:list|s)?)(?=[ \t])/,lookbehind:!0},operator:/(?:::|[?:+!])?=|[|@]/,punctuation:/[:;(){}]/},r.languages.objectivec=r.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete r.languages.objectivec["class-name"],r.languages.objc=r.languages.objectivec,r.languages.ocaml={comment:{pattern:/\(\*[\s\S]*?\*\)/,greedy:!0},char:{pattern:/'(?:[^\\\r\n']|\\(?:.|[ox]?[0-9a-f]{1,3}))'/i,greedy:!0},string:[{pattern:/"(?:\\(?:[\s\S]|\r\n)|[^\\\r\n"])*"/,greedy:!0},{pattern:/\{([a-z_]*)\|[\s\S]*?\|\1\}/,greedy:!0}],number:[/\b(?:0b[01][01_]*|0o[0-7][0-7_]*)\b/i,/\b0x[a-f0-9][a-f0-9_]*(?:\.[a-f0-9_]*)?(?:p[+-]?\d[\d_]*)?(?!\w)/i,/\b\d[\d_]*(?:\.[\d_]*)?(?:e[+-]?\d[\d_]*)?(?!\w)/i],directive:{pattern:/\B#\w+/,alias:"property"},label:{pattern:/\B~\w+/,alias:"property"},"type-variable":{pattern:/\B'\w+/,alias:"function"},variant:{pattern:/`\w+/,alias:"symbol"},keyword:/\b(?:as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|match|method|module|mutable|new|nonrec|object|of|open|private|rec|sig|struct|then|to|try|type|val|value|virtual|when|where|while|with)\b/,boolean:/\b(?:false|true)\b/,"operator-like-punctuation":{pattern:/\[[<>|]|[>|]\]|\{<|>\}/,alias:"punctuation"},operator:/\.[.~]|:[=>]|[=<>@^|&+\-*\/$%!?~][!$%&*+\-.\/:<=>?@^|~]*|\b(?:and|asr|land|lor|lsl|lsr|lxor|mod|or)\b/,punctuation:/;;|::|[(){}\[\].,:;#]|\b_\b/},r.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},r.languages.python["string-interpolation"].inside.interpolation.inside.rest=r.languages.python,r.languages.py=r.languages.python,r.languages.reason=r.languages.extend("clike",{string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,greedy:!0},"class-name":/\b[A-Z]\w*/,keyword:/\b(?:and|as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|method|module|mutable|new|nonrec|object|of|open|or|private|rec|sig|struct|switch|then|to|try|type|val|virtual|when|while|with)\b/,operator:/\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:asr|land|lor|lsl|lsr|lxor|mod)\b/}),r.languages.insertBefore("reason","class-name",{char:{pattern:/'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,greedy:!0},constructor:/\b[A-Z]\w*\b(?!\s*\.)/,label:{pattern:/\b[a-z]\w*(?=::)/,alias:"symbol"}}),delete r.languages.reason.function,function(e){e.languages.sass=e.languages.extend("css",{comment:{pattern:/^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,lookbehind:!0,greedy:!0}}),e.languages.insertBefore("sass","atrule",{"atrule-line":{pattern:/^(?:[ \t]*)[@+=].+/m,greedy:!0,inside:{atrule:/(?:@[\w-]+|[+=])/}}}),delete e.languages.sass.atrule;var n=/\$[-\w]+|#\{\$[-\w]+\}/,t=[/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|not|or)\b/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}];e.languages.insertBefore("sass","property",{"variable-line":{pattern:/^[ \t]*\$.+/m,greedy:!0,inside:{punctuation:/:/,variable:n,operator:t}},"property-line":{pattern:/^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,greedy:!0,inside:{property:[/[^:\s]+(?=\s*:)/,{pattern:/(:)[^:\s]+/,lookbehind:!0}],punctuation:/:/,variable:n,operator:t,important:e.languages.sass.important}}}),delete e.languages.sass.property,delete e.languages.sass.important,e.languages.insertBefore("sass","punctuation",{selector:{pattern:/^([ \t]*)\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*)*/m,lookbehind:!0,greedy:!0}})}(r),r.languages.scss=r.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),r.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),r.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),r.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),r.languages.scss.atrule.inside.rest=r.languages.scss,function(e){var n={pattern:/(\b\d+)(?:%|[a-z]+)/,lookbehind:!0},t={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0},o={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},url:{pattern:/\burl\((["']?).*?\1\)/i,greedy:!0},string:{pattern:/("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,greedy:!0},interpolation:null,func:null,important:/\B!(?:important|optional)\b/i,keyword:{pattern:/(^|\s+)(?:(?:else|for|if|return|unless)(?=\s|$)|@[\w-]+)/,lookbehind:!0},hexcode:/#[\da-f]{3,6}/i,color:[/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:n,number:t,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:n,boolean:/\b(?:false|true)\b/,operator:[/~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.{2,3}|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/],number:t,punctuation:/[{}()\[\];:,]/};o.interpolation={pattern:/\{[^\r\n}:]+\}/,alias:"variable",inside:{delimiter:{pattern:/^\{|\}$/,alias:"punctuation"},rest:o}},o.func={pattern:/[\w-]+\([^)]*\).*/,inside:{function:/^[^(]+/,rest:o}},e.languages.stylus={"atrule-declaration":{pattern:/(^[ \t]*)@.+/m,lookbehind:!0,inside:{atrule:/^@[\w-]+/,rest:o}},"variable-declaration":{pattern:/(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:\{[^{}]*\}|\S.*|$)/m,lookbehind:!0,inside:{variable:/^\S+/,rest:o}},statement:{pattern:/(^[ \t]*)(?:else|for|if|return|unless)[ \t].+/m,lookbehind:!0,inside:{keyword:/^\S+/,rest:o}},"property-declaration":{pattern:/((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)(?!\s)[^{\r\n]*(?:;|[^{\r\n,]$(?!(?:\r?\n|\r)(?:\{|\2[ \t])))/m,lookbehind:!0,inside:{property:{pattern:/^[^\s:]+/,inside:{interpolation:o.interpolation}},rest:o}},selector:{pattern:/(^[ \t]*)(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\)|(?![\w-]))|\{[^}\r\n]+\})+)(?:(?:\r?\n|\r)(?:\1(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\)|(?![\w-]))|\{[^}\r\n]+\})+)))*(?:,$|\{|(?=(?:\r?\n|\r)(?:\{|\1[ \t])))/m,lookbehind:!0,inside:{interpolation:o.interpolation,comment:o.comment,punctuation:/[{},]/}},func:o.func,string:o.string,comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0,greedy:!0},interpolation:o.interpolation,punctuation:/[{}()\[\];:.]/}}(r),function(e){var n=e.util.clone(e.languages.typescript);e.languages.tsx=e.languages.extend("jsx",n),delete e.languages.tsx.parameter,delete e.languages.tsx["literal-property"];var t=e.languages.tsx.tag;t.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+t.pattern.source+")",t.pattern.flags),t.lookbehind=!0}(r),r.languages.wasm={comment:[/\(;[\s\S]*?;\)/,{pattern:/;;.*/,greedy:!0}],string:{pattern:/"(?:\\[\s\S]|[^"\\])*"/,greedy:!0},keyword:[{pattern:/\b(?:align|offset)=/,inside:{operator:/=/}},{pattern:/\b(?:(?:f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|neg?|nearest|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|sqrt|store(?:8|16|32)?|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))?|memory\.(?:grow|size))\b/,inside:{punctuation:/\./}},/\b(?:anyfunc|block|br(?:_if|_table)?|call(?:_indirect)?|data|drop|elem|else|end|export|func|get_(?:global|local)|global|if|import|local|loop|memory|module|mut|nop|offset|param|result|return|select|set_(?:global|local)|start|table|tee_local|then|type|unreachable)\b/],variable:/\$[\w!#$%&'*+\-./:<=>?@\\^`|~]+/,number:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/,punctuation:/[()]/};const a=r},29901:e=>{e.exports&&(e.exports={core:{meta:{path:"components/prism-core.js",option:"mandatory"},core:"Core"},themes:{meta:{path:"themes/{id}.css",link:"index.html?theme={id}",exclusive:!0},prism:{title:"Default",option:"default"},"prism-dark":"Dark","prism-funky":"Funky","prism-okaidia":{title:"Okaidia",owner:"ocodia"},"prism-twilight":{title:"Twilight",owner:"remybach"},"prism-coy":{title:"Coy",owner:"tshedor"},"prism-solarizedlight":{title:"Solarized Light",owner:"hectormatos2011 "},"prism-tomorrow":{title:"Tomorrow Night",owner:"Rosey"}},languages:{meta:{path:"components/prism-{id}",noCSS:!0,examplesPath:"examples/prism-{id}",addCheckAll:!0},markup:{title:"Markup",alias:["html","xml","svg","mathml","ssml","atom","rss"],aliasTitles:{html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",ssml:"SSML",atom:"Atom",rss:"RSS"},option:"default"},css:{title:"CSS",option:"default",modify:"markup"},clike:{title:"C-like",option:"default"},javascript:{title:"JavaScript",require:"clike",modify:"markup",optional:"regex",alias:"js",option:"default"},abap:{title:"ABAP",owner:"dellagustin"},abnf:{title:"ABNF",owner:"RunDevelopment"},actionscript:{title:"ActionScript",require:"javascript",modify:"markup",owner:"Golmote"},ada:{title:"Ada",owner:"Lucretia"},agda:{title:"Agda",owner:"xy-ren"},al:{title:"AL",owner:"RunDevelopment"},antlr4:{title:"ANTLR4",alias:"g4",owner:"RunDevelopment"},apacheconf:{title:"Apache Configuration",owner:"GuiTeK"},apex:{title:"Apex",require:["clike","sql"],owner:"RunDevelopment"},apl:{title:"APL",owner:"ngn"},applescript:{title:"AppleScript",owner:"Golmote"},aql:{title:"AQL",owner:"RunDevelopment"},arduino:{title:"Arduino",require:"cpp",alias:"ino",owner:"dkern"},arff:{title:"ARFF",owner:"Golmote"},armasm:{title:"ARM Assembly",alias:"arm-asm",owner:"RunDevelopment"},arturo:{title:"Arturo",alias:"art",optional:["bash","css","javascript","markup","markdown","sql"],owner:"drkameleon"},asciidoc:{alias:"adoc",title:"AsciiDoc",owner:"Golmote"},aspnet:{title:"ASP.NET (C#)",require:["markup","csharp"],owner:"nauzilus"},asm6502:{title:"6502 Assembly",owner:"kzurawel"},asmatmel:{title:"Atmel AVR Assembly",owner:"cerkit"},autohotkey:{title:"AutoHotkey",owner:"aviaryan"},autoit:{title:"AutoIt",owner:"Golmote"},avisynth:{title:"AviSynth",alias:"avs",owner:"Zinfidel"},"avro-idl":{title:"Avro IDL",alias:"avdl",owner:"RunDevelopment"},awk:{title:"AWK",alias:"gawk",aliasTitles:{gawk:"GAWK"},owner:"RunDevelopment"},bash:{title:"Bash",alias:["sh","shell"],aliasTitles:{sh:"Shell",shell:"Shell"},owner:"zeitgeist87"},basic:{title:"BASIC",owner:"Golmote"},batch:{title:"Batch",owner:"Golmote"},bbcode:{title:"BBcode",alias:"shortcode",aliasTitles:{shortcode:"Shortcode"},owner:"RunDevelopment"},bbj:{title:"BBj",owner:"hyyan"},bicep:{title:"Bicep",owner:"johnnyreilly"},birb:{title:"Birb",require:"clike",owner:"Calamity210"},bison:{title:"Bison",require:"c",owner:"Golmote"},bnf:{title:"BNF",alias:"rbnf",aliasTitles:{rbnf:"RBNF"},owner:"RunDevelopment"},bqn:{title:"BQN",owner:"yewscion"},brainfuck:{title:"Brainfuck",owner:"Golmote"},brightscript:{title:"BrightScript",owner:"RunDevelopment"},bro:{title:"Bro",owner:"wayward710"},bsl:{title:"BSL (1C:Enterprise)",alias:"oscript",aliasTitles:{oscript:"OneScript"},owner:"Diversus23"},c:{title:"C",require:"clike",owner:"zeitgeist87"},csharp:{title:"C#",require:"clike",alias:["cs","dotnet"],owner:"mvalipour"},cpp:{title:"C++",require:"c",owner:"zeitgeist87"},cfscript:{title:"CFScript",require:"clike",alias:"cfc",owner:"mjclemente"},chaiscript:{title:"ChaiScript",require:["clike","cpp"],owner:"RunDevelopment"},cil:{title:"CIL",owner:"sbrl"},cilkc:{title:"Cilk/C",require:"c",alias:"cilk-c",owner:"OpenCilk"},cilkcpp:{title:"Cilk/C++",require:"cpp",alias:["cilk-cpp","cilk"],owner:"OpenCilk"},clojure:{title:"Clojure",owner:"troglotit"},cmake:{title:"CMake",owner:"mjrogozinski"},cobol:{title:"COBOL",owner:"RunDevelopment"},coffeescript:{title:"CoffeeScript",require:"javascript",alias:"coffee",owner:"R-osey"},concurnas:{title:"Concurnas",alias:"conc",owner:"jasontatton"},csp:{title:"Content-Security-Policy",owner:"ScottHelme"},cooklang:{title:"Cooklang",owner:"ahue"},coq:{title:"Coq",owner:"RunDevelopment"},crystal:{title:"Crystal",require:"ruby",owner:"MakeNowJust"},"css-extras":{title:"CSS Extras",require:"css",modify:"css",owner:"milesj"},csv:{title:"CSV",owner:"RunDevelopment"},cue:{title:"CUE",owner:"RunDevelopment"},cypher:{title:"Cypher",owner:"RunDevelopment"},d:{title:"D",require:"clike",owner:"Golmote"},dart:{title:"Dart",require:"clike",owner:"Golmote"},dataweave:{title:"DataWeave",owner:"machaval"},dax:{title:"DAX",owner:"peterbud"},dhall:{title:"Dhall",owner:"RunDevelopment"},diff:{title:"Diff",owner:"uranusjr"},django:{title:"Django/Jinja2",require:"markup-templating",alias:"jinja2",owner:"romanvm"},"dns-zone-file":{title:"DNS zone file",owner:"RunDevelopment",alias:"dns-zone"},docker:{title:"Docker",alias:"dockerfile",owner:"JustinBeckwith"},dot:{title:"DOT (Graphviz)",alias:"gv",optional:"markup",owner:"RunDevelopment"},ebnf:{title:"EBNF",owner:"RunDevelopment"},editorconfig:{title:"EditorConfig",owner:"osipxd"},eiffel:{title:"Eiffel",owner:"Conaclos"},ejs:{title:"EJS",require:["javascript","markup-templating"],owner:"RunDevelopment",alias:"eta",aliasTitles:{eta:"Eta"}},elixir:{title:"Elixir",owner:"Golmote"},elm:{title:"Elm",owner:"zwilias"},etlua:{title:"Embedded Lua templating",require:["lua","markup-templating"],owner:"RunDevelopment"},erb:{title:"ERB",require:["ruby","markup-templating"],owner:"Golmote"},erlang:{title:"Erlang",owner:"Golmote"},"excel-formula":{title:"Excel Formula",alias:["xlsx","xls"],owner:"RunDevelopment"},fsharp:{title:"F#",require:"clike",owner:"simonreynolds7"},factor:{title:"Factor",owner:"catb0t"},false:{title:"False",owner:"edukisto"},"firestore-security-rules":{title:"Firestore security rules",require:"clike",owner:"RunDevelopment"},flow:{title:"Flow",require:"javascript",owner:"Golmote"},fortran:{title:"Fortran",owner:"Golmote"},ftl:{title:"FreeMarker Template Language",require:"markup-templating",owner:"RunDevelopment"},gml:{title:"GameMaker Language",alias:"gamemakerlanguage",require:"clike",owner:"LiarOnce"},gap:{title:"GAP (CAS)",owner:"RunDevelopment"},gcode:{title:"G-code",owner:"RunDevelopment"},gdscript:{title:"GDScript",owner:"RunDevelopment"},gedcom:{title:"GEDCOM",owner:"Golmote"},gettext:{title:"gettext",alias:"po",owner:"RunDevelopment"},gherkin:{title:"Gherkin",owner:"hason"},git:{title:"Git",owner:"lgiraudel"},glsl:{title:"GLSL",require:"c",owner:"Golmote"},gn:{title:"GN",alias:"gni",owner:"RunDevelopment"},"linker-script":{title:"GNU Linker Script",alias:"ld",owner:"RunDevelopment"},go:{title:"Go",require:"clike",owner:"arnehormann"},"go-module":{title:"Go module",alias:"go-mod",owner:"RunDevelopment"},gradle:{title:"Gradle",require:"clike",owner:"zeabdelkhalek-badido18"},graphql:{title:"GraphQL",optional:"markdown",owner:"Golmote"},groovy:{title:"Groovy",require:"clike",owner:"robfletcher"},haml:{title:"Haml",require:"ruby",optional:["css","css-extras","coffeescript","erb","javascript","less","markdown","scss","textile"],owner:"Golmote"},handlebars:{title:"Handlebars",require:"markup-templating",alias:["hbs","mustache"],aliasTitles:{mustache:"Mustache"},owner:"Golmote"},haskell:{title:"Haskell",alias:"hs",owner:"bholst"},haxe:{title:"Haxe",require:"clike",optional:"regex",owner:"Golmote"},hcl:{title:"HCL",owner:"outsideris"},hlsl:{title:"HLSL",require:"c",owner:"RunDevelopment"},hoon:{title:"Hoon",owner:"matildepark"},http:{title:"HTTP",optional:["csp","css","hpkp","hsts","javascript","json","markup","uri"],owner:"danielgtaylor"},hpkp:{title:"HTTP Public-Key-Pins",owner:"ScottHelme"},hsts:{title:"HTTP Strict-Transport-Security",owner:"ScottHelme"},ichigojam:{title:"IchigoJam",owner:"BlueCocoa"},icon:{title:"Icon",owner:"Golmote"},"icu-message-format":{title:"ICU Message Format",owner:"RunDevelopment"},idris:{title:"Idris",alias:"idr",owner:"KeenS",require:"haskell"},ignore:{title:".ignore",owner:"osipxd",alias:["gitignore","hgignore","npmignore"],aliasTitles:{gitignore:".gitignore",hgignore:".hgignore",npmignore:".npmignore"}},inform7:{title:"Inform 7",owner:"Golmote"},ini:{title:"Ini",owner:"aviaryan"},io:{title:"Io",owner:"AlesTsurko"},j:{title:"J",owner:"Golmote"},java:{title:"Java",require:"clike",owner:"sherblot"},javadoc:{title:"JavaDoc",require:["markup","java","javadoclike"],modify:"java",optional:"scala",owner:"RunDevelopment"},javadoclike:{title:"JavaDoc-like",modify:["java","javascript","php"],owner:"RunDevelopment"},javastacktrace:{title:"Java stack trace",owner:"RunDevelopment"},jexl:{title:"Jexl",owner:"czosel"},jolie:{title:"Jolie",require:"clike",owner:"thesave"},jq:{title:"JQ",owner:"RunDevelopment"},jsdoc:{title:"JSDoc",require:["javascript","javadoclike","typescript"],modify:"javascript",optional:["actionscript","coffeescript"],owner:"RunDevelopment"},"js-extras":{title:"JS Extras",require:"javascript",modify:"javascript",optional:["actionscript","coffeescript","flow","n4js","typescript"],owner:"RunDevelopment"},json:{title:"JSON",alias:"webmanifest",aliasTitles:{webmanifest:"Web App Manifest"},owner:"CupOfTea696"},json5:{title:"JSON5",require:"json",owner:"RunDevelopment"},jsonp:{title:"JSONP",require:"json",owner:"RunDevelopment"},jsstacktrace:{title:"JS stack trace",owner:"sbrl"},"js-templates":{title:"JS Templates",require:"javascript",modify:"javascript",optional:["css","css-extras","graphql","markdown","markup","sql"],owner:"RunDevelopment"},julia:{title:"Julia",owner:"cdagnino"},keepalived:{title:"Keepalived Configure",owner:"dev-itsheng"},keyman:{title:"Keyman",owner:"mcdurdin"},kotlin:{title:"Kotlin",alias:["kt","kts"],aliasTitles:{kts:"Kotlin Script"},require:"clike",owner:"Golmote"},kumir:{title:"KuMir (\u041a\u0443\u041c\u0438\u0440)",alias:"kum",owner:"edukisto"},kusto:{title:"Kusto",owner:"RunDevelopment"},latex:{title:"LaTeX",alias:["tex","context"],aliasTitles:{tex:"TeX",context:"ConTeXt"},owner:"japborst"},latte:{title:"Latte",require:["clike","markup-templating","php"],owner:"nette"},less:{title:"Less",require:"css",optional:"css-extras",owner:"Golmote"},lilypond:{title:"LilyPond",require:"scheme",alias:"ly",owner:"RunDevelopment"},liquid:{title:"Liquid",require:"markup-templating",owner:"cinhtau"},lisp:{title:"Lisp",alias:["emacs","elisp","emacs-lisp"],owner:"JuanCaicedo"},livescript:{title:"LiveScript",owner:"Golmote"},llvm:{title:"LLVM IR",owner:"porglezomp"},log:{title:"Log file",optional:"javastacktrace",owner:"RunDevelopment"},lolcode:{title:"LOLCODE",owner:"Golmote"},lua:{title:"Lua",owner:"Golmote"},magma:{title:"Magma (CAS)",owner:"RunDevelopment"},makefile:{title:"Makefile",owner:"Golmote"},markdown:{title:"Markdown",require:"markup",optional:"yaml",alias:"md",owner:"Golmote"},"markup-templating":{title:"Markup templating",require:"markup",owner:"Golmote"},mata:{title:"Mata",owner:"RunDevelopment"},matlab:{title:"MATLAB",owner:"Golmote"},maxscript:{title:"MAXScript",owner:"RunDevelopment"},mel:{title:"MEL",owner:"Golmote"},mermaid:{title:"Mermaid",owner:"RunDevelopment"},metafont:{title:"METAFONT",owner:"LaeriExNihilo"},mizar:{title:"Mizar",owner:"Golmote"},mongodb:{title:"MongoDB",owner:"airs0urce",require:"javascript"},monkey:{title:"Monkey",owner:"Golmote"},moonscript:{title:"MoonScript",alias:"moon",owner:"RunDevelopment"},n1ql:{title:"N1QL",owner:"TMWilds"},n4js:{title:"N4JS",require:"javascript",optional:"jsdoc",alias:"n4jsd",owner:"bsmith-n4"},"nand2tetris-hdl":{title:"Nand To Tetris HDL",owner:"stephanmax"},naniscript:{title:"Naninovel Script",owner:"Elringus",alias:"nani"},nasm:{title:"NASM",owner:"rbmj"},neon:{title:"NEON",owner:"nette"},nevod:{title:"Nevod",owner:"nezaboodka"},nginx:{title:"nginx",owner:"volado"},nim:{title:"Nim",owner:"Golmote"},nix:{title:"Nix",owner:"Golmote"},nsis:{title:"NSIS",owner:"idleberg"},objectivec:{title:"Objective-C",require:"c",alias:"objc",owner:"uranusjr"},ocaml:{title:"OCaml",owner:"Golmote"},odin:{title:"Odin",owner:"edukisto"},opencl:{title:"OpenCL",require:"c",modify:["c","cpp"],owner:"Milania1"},openqasm:{title:"OpenQasm",alias:"qasm",owner:"RunDevelopment"},oz:{title:"Oz",owner:"Golmote"},parigp:{title:"PARI/GP",owner:"Golmote"},parser:{title:"Parser",require:"markup",owner:"Golmote"},pascal:{title:"Pascal",alias:"objectpascal",aliasTitles:{objectpascal:"Object Pascal"},owner:"Golmote"},pascaligo:{title:"Pascaligo",owner:"DefinitelyNotAGoat"},psl:{title:"PATROL Scripting Language",owner:"bertysentry"},pcaxis:{title:"PC-Axis",alias:"px",owner:"RunDevelopment"},peoplecode:{title:"PeopleCode",alias:"pcode",owner:"RunDevelopment"},perl:{title:"Perl",owner:"Golmote"},php:{title:"PHP",require:"markup-templating",owner:"milesj"},phpdoc:{title:"PHPDoc",require:["php","javadoclike"],modify:"php",owner:"RunDevelopment"},"php-extras":{title:"PHP Extras",require:"php",modify:"php",owner:"milesj"},"plant-uml":{title:"PlantUML",alias:"plantuml",owner:"RunDevelopment"},plsql:{title:"PL/SQL",require:"sql",owner:"Golmote"},powerquery:{title:"PowerQuery",alias:["pq","mscript"],owner:"peterbud"},powershell:{title:"PowerShell",owner:"nauzilus"},processing:{title:"Processing",require:"clike",owner:"Golmote"},prolog:{title:"Prolog",owner:"Golmote"},promql:{title:"PromQL",owner:"arendjr"},properties:{title:".properties",owner:"Golmote"},protobuf:{title:"Protocol Buffers",require:"clike",owner:"just-boris"},pug:{title:"Pug",require:["markup","javascript"],optional:["coffeescript","ejs","handlebars","less","livescript","markdown","scss","stylus","twig"],owner:"Golmote"},puppet:{title:"Puppet",owner:"Golmote"},pure:{title:"Pure",optional:["c","cpp","fortran"],owner:"Golmote"},purebasic:{title:"PureBasic",require:"clike",alias:"pbfasm",owner:"HeX0R101"},purescript:{title:"PureScript",require:"haskell",alias:"purs",owner:"sriharshachilakapati"},python:{title:"Python",alias:"py",owner:"multipetros"},qsharp:{title:"Q#",require:"clike",alias:"qs",owner:"fedonman"},q:{title:"Q (kdb+ database)",owner:"Golmote"},qml:{title:"QML",require:"javascript",owner:"RunDevelopment"},qore:{title:"Qore",require:"clike",owner:"temnroegg"},r:{title:"R",owner:"Golmote"},racket:{title:"Racket",require:"scheme",alias:"rkt",owner:"RunDevelopment"},cshtml:{title:"Razor C#",alias:"razor",require:["markup","csharp"],optional:["css","css-extras","javascript","js-extras"],owner:"RunDevelopment"},jsx:{title:"React JSX",require:["markup","javascript"],optional:["jsdoc","js-extras","js-templates"],owner:"vkbansal"},tsx:{title:"React TSX",require:["jsx","typescript"]},reason:{title:"Reason",require:"clike",owner:"Golmote"},regex:{title:"Regex",owner:"RunDevelopment"},rego:{title:"Rego",owner:"JordanSh"},renpy:{title:"Ren'py",alias:"rpy",owner:"HyuchiaDiego"},rescript:{title:"ReScript",alias:"res",owner:"vmarcosp"},rest:{title:"reST (reStructuredText)",owner:"Golmote"},rip:{title:"Rip",owner:"ravinggenius"},roboconf:{title:"Roboconf",owner:"Golmote"},robotframework:{title:"Robot Framework",alias:"robot",owner:"RunDevelopment"},ruby:{title:"Ruby",require:"clike",alias:"rb",owner:"samflores"},rust:{title:"Rust",owner:"Golmote"},sas:{title:"SAS",optional:["groovy","lua","sql"],owner:"Golmote"},sass:{title:"Sass (Sass)",require:"css",optional:"css-extras",owner:"Golmote"},scss:{title:"Sass (SCSS)",require:"css",optional:"css-extras",owner:"MoOx"},scala:{title:"Scala",require:"java",owner:"jozic"},scheme:{title:"Scheme",owner:"bacchus123"},"shell-session":{title:"Shell session",require:"bash",alias:["sh-session","shellsession"],owner:"RunDevelopment"},smali:{title:"Smali",owner:"RunDevelopment"},smalltalk:{title:"Smalltalk",owner:"Golmote"},smarty:{title:"Smarty",require:"markup-templating",optional:"php",owner:"Golmote"},sml:{title:"SML",alias:"smlnj",aliasTitles:{smlnj:"SML/NJ"},owner:"RunDevelopment"},solidity:{title:"Solidity (Ethereum)",alias:"sol",require:"clike",owner:"glachaud"},"solution-file":{title:"Solution file",alias:"sln",owner:"RunDevelopment"},soy:{title:"Soy (Closure Template)",require:"markup-templating",owner:"Golmote"},sparql:{title:"SPARQL",require:"turtle",owner:"Triply-Dev",alias:"rq"},"splunk-spl":{title:"Splunk SPL",owner:"RunDevelopment"},sqf:{title:"SQF: Status Quo Function (Arma 3)",require:"clike",owner:"RunDevelopment"},sql:{title:"SQL",owner:"multipetros"},squirrel:{title:"Squirrel",require:"clike",owner:"RunDevelopment"},stan:{title:"Stan",owner:"RunDevelopment"},stata:{title:"Stata Ado",require:["mata","java","python"],owner:"RunDevelopment"},iecst:{title:"Structured Text (IEC 61131-3)",owner:"serhioromano"},stylus:{title:"Stylus",owner:"vkbansal"},supercollider:{title:"SuperCollider",alias:"sclang",owner:"RunDevelopment"},swift:{title:"Swift",owner:"chrischares"},systemd:{title:"Systemd configuration file",owner:"RunDevelopment"},"t4-templating":{title:"T4 templating",owner:"RunDevelopment"},"t4-cs":{title:"T4 Text Templates (C#)",require:["t4-templating","csharp"],alias:"t4",owner:"RunDevelopment"},"t4-vb":{title:"T4 Text Templates (VB)",require:["t4-templating","vbnet"],owner:"RunDevelopment"},tap:{title:"TAP",owner:"isaacs",require:"yaml"},tcl:{title:"Tcl",owner:"PeterChaplin"},tt2:{title:"Template Toolkit 2",require:["clike","markup-templating"],owner:"gflohr"},textile:{title:"Textile",require:"markup",optional:"css",owner:"Golmote"},toml:{title:"TOML",owner:"RunDevelopment"},tremor:{title:"Tremor",alias:["trickle","troy"],owner:"darach",aliasTitles:{trickle:"trickle",troy:"troy"}},turtle:{title:"Turtle",alias:"trig",aliasTitles:{trig:"TriG"},owner:"jakubklimek"},twig:{title:"Twig",require:"markup-templating",owner:"brandonkelly"},typescript:{title:"TypeScript",require:"javascript",optional:"js-templates",alias:"ts",owner:"vkbansal"},typoscript:{title:"TypoScript",alias:"tsconfig",aliasTitles:{tsconfig:"TSConfig"},owner:"dkern"},unrealscript:{title:"UnrealScript",alias:["uscript","uc"],owner:"RunDevelopment"},uorazor:{title:"UO Razor Script",owner:"jaseowns"},uri:{title:"URI",alias:"url",aliasTitles:{url:"URL"},owner:"RunDevelopment"},v:{title:"V",require:"clike",owner:"taggon"},vala:{title:"Vala",require:"clike",optional:"regex",owner:"TemplarVolk"},vbnet:{title:"VB.Net",require:"basic",owner:"Bigsby"},velocity:{title:"Velocity",require:"markup",owner:"Golmote"},verilog:{title:"Verilog",owner:"a-rey"},vhdl:{title:"VHDL",owner:"a-rey"},vim:{title:"vim",owner:"westonganger"},"visual-basic":{title:"Visual Basic",alias:["vb","vba"],aliasTitles:{vba:"VBA"},owner:"Golmote"},warpscript:{title:"WarpScript",owner:"RunDevelopment"},wasm:{title:"WebAssembly",owner:"Golmote"},"web-idl":{title:"Web IDL",alias:"webidl",owner:"RunDevelopment"},wgsl:{title:"WGSL",owner:"Dr4gonthree"},wiki:{title:"Wiki markup",require:"markup",owner:"Golmote"},wolfram:{title:"Wolfram language",alias:["mathematica","nb","wl"],aliasTitles:{mathematica:"Mathematica",nb:"Mathematica Notebook"},owner:"msollami"},wren:{title:"Wren",owner:"clsource"},xeora:{title:"Xeora",require:"markup",alias:"xeoracube",aliasTitles:{xeoracube:"XeoraCube"},owner:"freakmaxi"},"xml-doc":{title:"XML doc (.net)",require:"markup",modify:["csharp","fsharp","vbnet"],owner:"RunDevelopment"},xojo:{title:"Xojo (REALbasic)",owner:"Golmote"},xquery:{title:"XQuery",require:"markup",owner:"Golmote"},yaml:{title:"YAML",alias:"yml",owner:"hason"},yang:{title:"YANG",owner:"RunDevelopment"},zig:{title:"Zig",owner:"RunDevelopment"}},plugins:{meta:{path:"plugins/{id}/prism-{id}",link:"plugins/{id}/"},"line-highlight":{title:"Line Highlight",description:"Highlights specific lines and/or line ranges."},"line-numbers":{title:"Line Numbers",description:"Line number at the beginning of code lines.",owner:"kuba-kubula"},"show-invisibles":{title:"Show Invisibles",description:"Show hidden characters such as tabs and line breaks.",optional:["autolinker","data-uri-highlight"]},autolinker:{title:"Autolinker",description:"Converts URLs and emails in code to clickable links. Parses Markdown links in comments."},wpd:{title:"WebPlatform Docs",description:'Makes tokens link to WebPlatform.org documentation. The links open in a new tab.'},"custom-class":{title:"Custom Class",description:"This plugin allows you to prefix Prism's default classes (.comment can become .namespace--comment) or replace them with your defined ones (like .editor__comment). You can even add new classes.",owner:"dvkndn",noCSS:!0},"file-highlight":{title:"File Highlight",description:"Fetch external files and highlight them with Prism. Used on the Prism website itself.",noCSS:!0},"show-language":{title:"Show Language",description:"Display the highlighted language in code blocks (inline code does not show the label).",owner:"nauzilus",noCSS:!0,require:"toolbar"},"jsonp-highlight":{title:"JSONP Highlight",description:"Fetch content with JSONP and highlight some interesting content (e.g. GitHub/Gists or Bitbucket API).",noCSS:!0,owner:"nauzilus"},"highlight-keywords":{title:"Highlight Keywords",description:"Adds special CSS classes for each keyword for fine-grained highlighting.",owner:"vkbansal",noCSS:!0},"remove-initial-line-feed":{title:"Remove initial line feed",description:"Removes the initial line feed in code blocks.",owner:"Golmote",noCSS:!0},"inline-color":{title:"Inline color",description:"Adds a small inline preview for colors in style sheets.",require:"css-extras",owner:"RunDevelopment"},previewers:{title:"Previewers",description:"Previewers for angles, colors, gradients, easing and time.",require:"css-extras",owner:"Golmote"},autoloader:{title:"Autoloader",description:"Automatically loads the needed languages to highlight the code blocks.",owner:"Golmote",noCSS:!0},"keep-markup":{title:"Keep Markup",description:"Prevents custom markup from being dropped out during highlighting.",owner:"Golmote",optional:"normalize-whitespace",noCSS:!0},"command-line":{title:"Command Line",description:"Display a command line with a prompt and, optionally, the output/response from the commands.",owner:"chriswells0"},"unescaped-markup":{title:"Unescaped Markup",description:"Write markup without having to escape anything."},"normalize-whitespace":{title:"Normalize Whitespace",description:"Supports multiple operations to normalize whitespace in code blocks.",owner:"zeitgeist87",optional:"unescaped-markup",noCSS:!0},"data-uri-highlight":{title:"Data-URI Highlight",description:"Highlights data-URI contents.",owner:"Golmote",noCSS:!0},toolbar:{title:"Toolbar",description:"Attach a toolbar for plugins to easily register buttons on the top of a code block.",owner:"mAAdhaTTah"},"copy-to-clipboard":{title:"Copy to Clipboard Button",description:"Add a button that copies the code block to the clipboard when clicked.",owner:"mAAdhaTTah",require:"toolbar",noCSS:!0},"download-button":{title:"Download Button",description:"A button in the toolbar of a code block adding a convenient way to download a code file.",owner:"Golmote",require:"toolbar",noCSS:!0},"match-braces":{title:"Match braces",description:"Highlights matching braces.",owner:"RunDevelopment"},"diff-highlight":{title:"Diff Highlight",description:"Highlights the code inside diff blocks.",owner:"RunDevelopment",require:"diff"},"filter-highlight-all":{title:"Filter highlightAll",description:"Filters the elements the highlightAll and highlightAllUnder methods actually highlight.",owner:"RunDevelopment",noCSS:!0},treeview:{title:"Treeview",description:"A language with special styles to highlight file system tree structures.",owner:"Golmote"}}})},2885:(e,n,t)=>{const o=t(29901),r=t(39642),a=new Set;function s(e){void 0===e?e=Object.keys(o.languages).filter((e=>"meta"!=e)):Array.isArray(e)||(e=[e]);const n=[...a,...Object.keys(Prism.languages)];r(o,e,n).load((e=>{if(!(e in o.languages))return void(s.silent||console.warn("Language does not exist: "+e));const n="./prism-"+e;delete t.c[t(16500).resolve(n)],delete Prism.languages[e],t(16500)(n),a.add(e)}))}s.silent=!1,e.exports=s},6726:(e,n,t)=>{var o={"./":2885};function r(e){var n=a(e);return t(n)}function a(e){if(!t.o(o,e)){var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}return o[e]}r.keys=function(){return Object.keys(o)},r.resolve=a,e.exports=r,r.id=6726},16500:(e,n,t)=>{var o={"./":2885};function r(e){var n=a(e);return t(n)}function a(e){if(!t.o(o,e)){var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}return o[e]}r.keys=function(){return Object.keys(o)},r.resolve=a,e.exports=r,r.id=16500},39642:e=>{"use strict";var n=function(){var e=function(){};function n(e,n){Array.isArray(e)?e.forEach(n):null!=e&&n(e,0)}function t(e){for(var n={},t=0,o=e.length;t "));var i={},c=e[o];if(c){function l(n){if(!(n in e))throw new Error(o+" depends on an unknown component "+n);if(!(n in i))for(var s in r(n,a),i[n]=!0,t[n])i[s]=!0}n(c.require,l),n(c.optional,l),n(c.modify,l)}t[o]=i,a.pop()}}return function(e){var n=t[e];return n||(r(e,o),n=t[e]),n}}function r(e){for(var n in e)return!0;return!1}return function(a,s,i){var c=function(e){var n={};for(var t in e){var o=e[t];for(var r in o)if("meta"!=r){var a=o[r];n[r]="string"==typeof a?{title:a}:a}}return n}(a),l=function(e){var t;return function(o){if(o in e)return o;if(!t)for(var r in t={},e){var a=e[r];n(a&&a.alias,(function(n){if(n in t)throw new Error(n+" cannot be alias for both "+r+" and "+t[n]);if(n in e)throw new Error(n+" cannot be alias of "+r+" because it is a component.");t[n]=r}))}return t[o]||o}}(c);s=s.map(l),i=(i||[]).map(l);var d=t(s),u=t(i);s.forEach((function e(t){var o=c[t];n(o&&o.require,(function(n){n in u||(d[n]=!0,e(n))}))}));for(var p,f=o(c),m=d;r(m);){for(var h in p={},m){var g=c[h];n(g&&g.modify,(function(e){e in u&&(p[e]=!0)}))}for(var b in u)if(!(b in d))for(var v in f(b))if(v in d){p[b]=!0;break}for(var k in m=p)d[k]=!0}var w={getIds:function(){var e=[];return w.load((function(n){e.push(n)})),e},load:function(n,t){return function(n,t,o,r){var a=r?r.series:void 0,s=r?r.parallel:e,i={},c={};function l(e){if(e in i)return i[e];c[e]=!0;var r,d=[];for(var u in n(e))u in t&&d.push(u);if(0===d.length)r=o(e);else{var p=s(d.map((function(e){var n=l(e);return delete c[e],n})));a?r=a(p,(function(){return o(e)})):o(e)}return i[e]=r}for(var d in t)l(d);var u=[];for(var p in c)u.push(i[p]);return s(u)}(f,d,n,t)}};return w}}();e.exports=n},92703:(e,n,t)=>{"use strict";var o=t(50414);function r(){}function a(){}a.resetWarningCache=r,e.exports=function(){function e(e,n,t,r,a,s){if(s!==o){var i=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function n(){return e}e.isRequired=e;var t={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:n,element:e,elementType:e,instanceOf:n,node:e,objectOf:n,oneOf:n,oneOfType:n,shape:n,exact:n,checkPropTypes:a,resetWarningCache:r};return t.PropTypes=t,t}},45697:(e,n,t)=>{e.exports=t(92703)()},50414:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},64448:(e,n,t)=>{"use strict";var o=t(67294),r=t(27418),a=t(63840);function s(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,t=1;t